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
gdk_pixbuf2-3.4.1 sample/utils.rb
gdk_pixbuf2-3.4.0 sample/utils.rb
gdk_pixbuf2-3.3.9 sample/utils.rb
gdk_pixbuf2-3.3.8 sample/utils.rb
gdk_pixbuf2-3.3.7 sample/utils.rb
gdk_pixbuf2-3.3.6 sample/utils.rb
gdk_pixbuf2-3.3.5 sample/utils.rb
gdk_pixbuf2-3.3.4 sample/utils.rb
gdk_pixbuf2-3.3.3 sample/utils.rb
gdk_pixbuf2-3.3.2 sample/utils.rb
gdk_pixbuf2-3.3.1 sample/utils.rb
gdk_pixbuf2-3.3.0 sample/utils.rb
gdk_pixbuf2-3.2.9-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.2.9-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.2.9 sample/utils.rb
gdk_pixbuf2-3.2.8-x64-mingw32 sample/utils.rb
gdk_pixbuf2-3.2.8-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.2.8 sample/utils.rb
gdk_pixbuf2-3.2.7-x86-mingw32 sample/utils.rb
gdk_pixbuf2-3.2.7-x64-mingw32 sample/utils.rb