Sha256: 5712b343c4eb354d6d3d1518be8655c0ad11d0082d7af87710ed74140c1d1768

Contents?: true

Size: 952 Bytes

Versions: 110

Compression:

Stored size: 952 Bytes

Contents

#!/usr/bin/env ruby
=begin
  utils.rb - Ruby/GdkPixbuf sample script.

  Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.

  $Id: utils.rb,v 1.4 2006/06/17 14:38:08 mutoh Exp $
=end

require 'gtk2'

filename = ARGV[0]
unless filename
  puts "ruby #{$0} filename"
  exit(1)
end

src =  Gdk::Pixbuf.new(filename)

vbox = Gtk::VBox.new

dst = src.add_alpha(true, 0, 0, 0)
vbox.pack_start(Gtk::Image.new(dst))

dst = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, true, 8, 
                      src.width + 20, src.height + 30)
src.copy_area(0, 0, src.width / 2, src.height / 2, dst, 10, 20)
vbox.pack_start(Gtk::Image.new(dst))

dst = src.saturate_and_pixelate(0.3, true)
vbox.pack_start(Gtk::Image.new(dst))

dst = src.fill!(0xff000099) #RGBA
vbox.pack_start(Gtk::Image.new(dst))

w = Gtk::Window.new.add(vbox)
w.signal_connect('delete-event') do
  Gtk.main_quit
end

w.show_all

Gtk.main

Version data entries

110 entries across 110 versions & 2 rubygems

Version Path
gdk_pixbuf2-3.0.8-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.8-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.8 sample/utils.rb
gdk_pixbuf2-3.0.7-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.7-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.7 sample/utils.rb
gdk_pixbuf2-3.0.6-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.6-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.6 sample/utils.rb
gdk_pixbuf2-3.0.5-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.5-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.5 sample/utils.rb
gdk_pixbuf2-3.0.4-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.4-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.4 sample/utils.rb
gdk_pixbuf2-3.0.3-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.3-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.3 sample/utils.rb
gdk_pixbuf2-3.0.2-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.2-x86-mingw32 sample/utils.rb