Sha256: c66f64dcc527a2b4d8b9fd5f88afcb44f61758ce35b2b19420c5fa3101e20494

Contents?: true

Size: 1.08 KB

Versions: 90

Compression:

Stored size: 1.08 KB

Contents

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

  Copyright (c) 2002-2016 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 =  GdkPixbuf::Pixbuf.new(:file => filename)

vbox = Gtk::VBox.new

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

dst = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
                            :has_alpha => true,
                            :bits_per_sample => 8, 
                            :width => src.width + 20,
                            :height => 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

90 entries across 82 versions & 2 rubygems

Version Path
savant-echo-0.1.4 bin/packaging/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/utils.rb
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/utils.rb
savant-echo-0.1.3 bin/packaging/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/utils.rb
savant-echo-0.1.3 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/utils.rb
gdk_pixbuf2-3.1.0-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.1.0-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.1.0 sample/utils.rb
gdk_pixbuf2-3.0.9-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.9-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.0.9 sample/utils.rb