Sha256: 13e44ce217cd498a80772952287d2ce271e3d11af5bad7e24c9b612c59914a7f

Contents?: true

Size: 1.3 KB

Versions: 90

Compression:

Stored size: 1.3 KB

Contents

#!/usr/bin/env ruby
=begin
  scale.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: scale.rb,v 1.10 2006/06/17 14:38:08 mutoh Exp $
=end

require 'gtk2'

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

vbox = Gtk::VBox.new

src =  GdkPixbuf::Pixbuf.new(:file => filename)
vbox.add(Gtk::Image.new(src))

dst = src.scale(200, 200, :nearest)
dst.scale!(src, 60, 60, 90, 90, -50, 50, 6, 3)
vbox.add(Gtk::Image.new(dst))

dst2 = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
                             :has_alpha =>true,
                             :bits_per_sample => 8,
                             :width => 200,
                             :height => 200)
dst2.scale!(src, 0, 0, 100, 100, 0, 0, 1.5, 1.5)

vbox.add(Gtk::Image.new(dst2))

dst3 = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
                             :has_alpha =>true,
                             :bits_per_sample => 8,
                             :width => 200,
                             :height => 200)
dst3.scale!(src, 0, 0, 200, 200, 0, 0, 5, 3, :hyper)
vbox.add(Gtk::Image.new(dst3))

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

window.add(vbox).show_all

Gtk.main

Version data entries

90 entries across 82 versions & 2 rubygems

Version Path
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/scale.rb
savant-echo-0.1.4 bin/packaging/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/scale.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/scale.rb
savant-echo-0.1.3 bin/packaging/vendor/ruby/2.2.0/gems/gdk_pixbuf2-3.1.0/sample/scale.rb
gdk_pixbuf2-3.1.0-x64-mingw32 sample/scale.rb
gdk_pixbuf2-3.1.0-x86-mingw32 sample/scale.rb
gdk_pixbuf2-3.1.0 sample/scale.rb
gdk_pixbuf2-3.0.9-x64-mingw32 sample/scale.rb
gdk_pixbuf2-3.0.9-x86-mingw32 sample/scale.rb
gdk_pixbuf2-3.0.9 sample/scale.rb