gdk_pixbuf2 3.3.9 → 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -27
- data/sample/anim.rb +8 -8
- data/sample/composite.rb +7 -7
- data/sample/flip.rb +8 -16
- data/sample/format.rb +10 -20
- data/sample/loader.rb +8 -4
- data/sample/rotate.rb +8 -16
- data/sample/save.rb +3 -3
- data/sample/scale.rb +8 -8
- data/sample/simpleanim.rb +14 -14
- data/sample/utils.rb +9 -8
- data/sample/xpm.rb +18 -17
- data/test/gdk_pixbuf2-test-utils.rb +2 -2
- data/test/run-test.rb +10 -31
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3708a8694fdf16a69a325e25ffeda0acb39fbaeeacfecc8a0e7dd7bf5f3f947b
|
4
|
+
data.tar.gz: c627cdb803280433ae6f0d628c4493b1f33921e2fa4264204fd4948f823b440e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a9a28161a741b6297071cc89cb551f68f5664da73ba1469509db5bd04f8b877ca0369be826c99d6f2b19b9a8f7c62e2c76495e4a968accc5526f64dce00176
|
7
|
+
data.tar.gz: c9f77febfb4961060e034b5b3dd366b70d01886c4cacd1164a31cbfb71e7b851f2bb88fac4cc092afd54df73510a27577aad7d86dcce47a79ba342c8bfcf3c1a
|
data/README.md
CHANGED
@@ -1,30 +1,24 @@
|
|
1
|
-
Ruby/GdkPixbuf2
|
2
|
-
|
1
|
+
# Ruby/GdkPixbuf2
|
2
|
+
|
3
3
|
Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x.
|
4
4
|
|
5
|
-
Requirements
|
6
|
-
|
7
|
-
* Ruby
|
8
|
-
*
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
This program is free software.
|
24
|
-
You can distribute/modify this program under the terms of
|
25
|
-
the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
|
26
|
-
|
27
|
-
Project Websites
|
28
|
-
----------------
|
29
|
-
* https://ruby-gnome2.osdn.jp/
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
* Ruby/GIO2
|
8
|
+
* [GdkPixbuf](https://gitlab.gnome.org/GNOME/gdk-pixbuf)
|
9
|
+
|
10
|
+
## Install
|
11
|
+
|
12
|
+
gem install gdk_pixbuf2
|
13
|
+
|
14
|
+
## License
|
15
|
+
|
16
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
17
|
+
|
18
|
+
This program is free software. You can distribute/modify this program
|
19
|
+
under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
|
20
|
+
|
21
|
+
## Project Websites
|
22
|
+
|
30
23
|
* https://github.com/ruby-gnome/ruby-gnome
|
24
|
+
* https://ruby-gnome2.osdn.jp/
|
data/sample/anim.rb
CHANGED
@@ -2,35 +2,35 @@
|
|
2
2
|
=begin
|
3
3
|
anim.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: anim.rb,v 1.5 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
11
|
+
require 'gtk3'
|
12
12
|
|
13
13
|
w = Gtk::Window.new
|
14
14
|
w.signal_connect('delete-event') do
|
15
15
|
Gtk.main_quit
|
16
16
|
end
|
17
17
|
|
18
|
-
box = Gtk::
|
19
|
-
src =
|
20
|
-
box.pack_start(Gtk::Image.new(src))
|
18
|
+
box = Gtk::Box.new(:vertical)
|
19
|
+
src = GdkPixbuf::PixbufAnimation.new(File.join(__dir__, "floppybuddy.gif"))
|
20
|
+
box.pack_start(Gtk::Image.new(animation: src))
|
21
21
|
p src.width
|
22
22
|
p src.height
|
23
23
|
p src.static_image?
|
24
24
|
|
25
25
|
static_image = src.static_image
|
26
|
-
box.pack_start(Gtk::Image.new(static_image))
|
26
|
+
box.pack_start(Gtk::Image.new(pixbuf: static_image))
|
27
27
|
|
28
28
|
iter = src.get_iter
|
29
29
|
p iter.advance
|
30
30
|
p iter.delay_time
|
31
31
|
p iter.on_currently_loading_frame?
|
32
32
|
|
33
|
-
box.pack_start(Gtk::Image.new(iter.pixbuf))
|
33
|
+
box.pack_start(Gtk::Image.new(pixbuf: iter.pixbuf))
|
34
34
|
|
35
35
|
w.add(box)
|
36
36
|
w.show_all
|
data/sample/composite.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
composite.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: composite.rb,v 1.6 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
11
|
+
require 'gtk3'
|
12
12
|
|
13
13
|
filename = ARGV[0]
|
14
14
|
unless filename
|
@@ -18,7 +18,7 @@ end
|
|
18
18
|
|
19
19
|
src = GdkPixbuf::Pixbuf.new(:file => filename)
|
20
20
|
|
21
|
-
vbox = Gtk::
|
21
|
+
vbox = Gtk::Box.new(:vertical)
|
22
22
|
|
23
23
|
dst = src.composite(:dest_width => 100,
|
24
24
|
:dest_height => 100,
|
@@ -27,7 +27,7 @@ dst = src.composite(:dest_width => 100,
|
|
27
27
|
:check_size => 32,
|
28
28
|
:color1 => 0xFF0000,
|
29
29
|
:color2 => 0x00FF00)
|
30
|
-
vbox.pack_start(Gtk::Image.new(dst))
|
30
|
+
vbox.pack_start(Gtk::Image.new(:pixbuf => dst))
|
31
31
|
|
32
32
|
dst = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
33
33
|
:has_alpha => true,
|
@@ -41,7 +41,7 @@ dst.composite!(src,
|
|
41
41
|
:scale_y => 1.8,
|
42
42
|
:interp_type => :hyper,
|
43
43
|
:overall_alpha => 200)
|
44
|
-
vbox.pack_start(Gtk::Image.new(dst))
|
44
|
+
vbox.pack_start(Gtk::Image.new(:pixbuf => dst))
|
45
45
|
|
46
46
|
dst = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
47
47
|
:has_alpha => true,
|
@@ -63,7 +63,7 @@ dst.composite!(src,
|
|
63
63
|
:check_size => 16,
|
64
64
|
:color1 => 0x999999,
|
65
65
|
:color2 => 0xdddddd)
|
66
|
-
vbox.pack_start(Gtk::Image.new(dst))
|
66
|
+
vbox.pack_start(Gtk::Image.new(:pixbuf => dst))
|
67
67
|
|
68
68
|
window = Gtk::Window.new.add(vbox)
|
69
69
|
window.signal_connect('delete-event') do
|
data/sample/flip.rb
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
flip.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2005-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2005-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: flip.rb,v 1.3 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
12
|
-
|
11
|
+
require 'gtk3'
|
13
12
|
|
14
13
|
filename = ARGV[0]
|
15
14
|
unless filename
|
@@ -17,24 +16,18 @@ unless filename
|
|
17
16
|
exit(1)
|
18
17
|
end
|
19
18
|
|
20
|
-
|
21
|
-
puts "This sample requires GTK+ 2.6.0 or later"
|
22
|
-
puts str
|
23
|
-
exit
|
24
|
-
end
|
25
|
-
|
26
|
-
vbox = Gtk::VBox.new
|
19
|
+
vbox = Gtk::Box.new(:vertical)
|
27
20
|
|
28
|
-
src = GdkPixbuf::Pixbuf.new(:
|
29
|
-
vbox.add(Gtk::Image.new(src))
|
21
|
+
src = GdkPixbuf::Pixbuf.new(file: filename)
|
22
|
+
vbox.add(Gtk::Image.new(pixbuf: src))
|
30
23
|
|
31
24
|
# Horizontal
|
32
25
|
dst = src.flip(true)
|
33
|
-
vbox.add(Gtk::Image.new(dst))
|
26
|
+
vbox.add(Gtk::Image.new(pixbuf: dst))
|
34
27
|
|
35
28
|
# Vertical
|
36
29
|
dst2 = src.flip(false)
|
37
|
-
vbox.add(Gtk::Image.new(dst2))
|
30
|
+
vbox.add(Gtk::Image.new(pixbuf: dst2))
|
38
31
|
|
39
32
|
window = Gtk::Window.new
|
40
33
|
window.signal_connect('delete-event') do
|
@@ -44,4 +37,3 @@ end
|
|
44
37
|
window.add(vbox).show_all
|
45
38
|
|
46
39
|
Gtk.main
|
47
|
-
|
data/sample/format.rb
CHANGED
@@ -2,19 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
format.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2004-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2004-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: format.rb,v 1.4 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
12
|
-
|
13
|
-
if str = Gtk.check_version(2, 2, 0)
|
14
|
-
puts "This sample requires GTK+ 2.2.0 or later"
|
15
|
-
puts str
|
16
|
-
exit
|
17
|
-
end
|
11
|
+
require 'gtk3'
|
18
12
|
|
19
13
|
filename = ARGV[0]
|
20
14
|
unless filename
|
@@ -23,15 +17,11 @@ unless filename
|
|
23
17
|
end
|
24
18
|
|
25
19
|
puts fileinfo = GdkPixbuf::Pixbuf.get_file_info(filename)[0]
|
26
|
-
puts "name
|
20
|
+
puts "name = #{fileinfo.name}"
|
27
21
|
puts "description = #{fileinfo.description}"
|
28
|
-
puts "mime_types
|
29
|
-
puts "extensions
|
30
|
-
puts "writable
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
puts "scalable = #{fileinfo.scalable?}"
|
35
|
-
puts "disabled = #{fileinfo.disabled?}"
|
36
|
-
puts "license = #{fileinfo.license.inspect}"
|
37
|
-
end
|
22
|
+
puts "mime_types = #{fileinfo.mime_types.inspect}"
|
23
|
+
puts "extensions = #{fileinfo.extensions.inspect}"
|
24
|
+
puts "writable = #{fileinfo.writable?}"
|
25
|
+
puts "scalable = #{fileinfo.scalable?}"
|
26
|
+
puts "disabled = #{fileinfo.disabled?}"
|
27
|
+
puts "license = #{fileinfo.license.inspect}"
|
data/sample/loader.rb
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
loader.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2003-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2003-2020: Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: loader.rb,v 1.3 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
|
-
|
10
|
+
|
11
|
+
require 'gtk3'
|
11
12
|
|
12
13
|
loader = GdkPixbuf::PixbufLoader.new
|
13
14
|
File.open(File.join(__dir__, "gnome-foot.png"), "rb") { |f|
|
@@ -15,6 +16,9 @@ File.open(File.join(__dir__, "gnome-foot.png"), "rb") { |f|
|
|
15
16
|
}
|
16
17
|
pixbuf = loader.pixbuf
|
17
18
|
|
18
|
-
Gtk::Window.new
|
19
|
+
window = Gtk::Window.new
|
20
|
+
window.signal_connect('delete-event') { Gtk.main_quit }
|
21
|
+
window.add(Gtk::Image.new(pixbuf: pixbuf))
|
22
|
+
window.show_all
|
19
23
|
|
20
24
|
Gtk.main
|
data/sample/rotate.rb
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
rotate.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2005-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2005-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: rotate.rb,v 1.3 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
12
|
-
|
11
|
+
require 'gtk3'
|
13
12
|
|
14
13
|
filename = ARGV[0]
|
15
14
|
unless filename
|
@@ -17,22 +16,16 @@ unless filename
|
|
17
16
|
exit(1)
|
18
17
|
end
|
19
18
|
|
20
|
-
|
21
|
-
puts "This sample requires GTK+ 2.6.0 or later"
|
22
|
-
puts str
|
23
|
-
exit
|
24
|
-
end
|
25
|
-
|
26
|
-
vbox = Gtk::VBox.new
|
19
|
+
vbox = Gtk::Box.new(:vertical)
|
27
20
|
|
28
|
-
src = GdkPixbuf::Pixbuf.new(:
|
29
|
-
vbox.add(Gtk::Image.new(src))
|
21
|
+
src = GdkPixbuf::Pixbuf.new(file: filename)
|
22
|
+
vbox.add(Gtk::Image.new(pixbuf: src))
|
30
23
|
|
31
24
|
dst = src.rotate(:counterclockwise)
|
32
|
-
vbox.add(Gtk::Image.new(dst))
|
25
|
+
vbox.add(Gtk::Image.new(pixbuf: dst))
|
33
26
|
|
34
27
|
dst2 = src.rotate(:upsidedown)
|
35
|
-
vbox.add(Gtk::Image.new(dst2))
|
28
|
+
vbox.add(Gtk::Image.new(pixbuf: dst2))
|
36
29
|
|
37
30
|
window = Gtk::Window.new
|
38
31
|
window.signal_connect('delete-event') do
|
@@ -42,4 +35,3 @@ end
|
|
42
35
|
window.add(vbox).show_all
|
43
36
|
|
44
37
|
Gtk.main
|
45
|
-
|
data/sample/save.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
save.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: save.rb,v 1.5 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
@@ -17,7 +17,7 @@ if ! from or ! to
|
|
17
17
|
exit(1)
|
18
18
|
end
|
19
19
|
|
20
|
-
src =
|
20
|
+
src = GdkPixbuf::Pixbuf.new(:file => from)
|
21
21
|
|
22
22
|
dst = src.scale(300, 300, :hyper)
|
23
23
|
# This doesn't work ....
|
data/sample/scale.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
scale.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: scale.rb,v 1.10 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
11
|
+
require 'gtk3'
|
12
12
|
|
13
13
|
filename = ARGV[0]
|
14
14
|
unless filename
|
@@ -16,14 +16,14 @@ unless filename
|
|
16
16
|
exit(1)
|
17
17
|
end
|
18
18
|
|
19
|
-
vbox = Gtk::
|
19
|
+
vbox = Gtk::Box.new(:vertical)
|
20
20
|
|
21
21
|
src = GdkPixbuf::Pixbuf.new(:file => filename)
|
22
|
-
vbox.add(Gtk::Image.new(src))
|
22
|
+
vbox.add(Gtk::Image.new(:pixbuf => src))
|
23
23
|
|
24
24
|
dst = src.scale(200, 200, :nearest)
|
25
25
|
dst.scale!(src, 60, 60, 90, 90, -50, 50, 6, 3)
|
26
|
-
vbox.add(Gtk::Image.new(dst))
|
26
|
+
vbox.add(Gtk::Image.new(:pixbuf => dst))
|
27
27
|
|
28
28
|
dst2 = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
29
29
|
:has_alpha =>true,
|
@@ -32,7 +32,7 @@ dst2 = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
|
32
32
|
:height => 200)
|
33
33
|
dst2.scale!(src, 0, 0, 100, 100, 0, 0, 1.5, 1.5)
|
34
34
|
|
35
|
-
vbox.add(Gtk::Image.new(dst2))
|
35
|
+
vbox.add(Gtk::Image.new(:pixbuf => dst2))
|
36
36
|
|
37
37
|
dst3 = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
38
38
|
:has_alpha =>true,
|
@@ -40,7 +40,7 @@ dst3 = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
|
40
40
|
:width => 200,
|
41
41
|
:height => 200)
|
42
42
|
dst3.scale!(src, 0, 0, 200, 200, 0, 0, 5, 3, :hyper)
|
43
|
-
vbox.add(Gtk::Image.new(dst3))
|
43
|
+
vbox.add(Gtk::Image.new(:pixbuf => dst3))
|
44
44
|
|
45
45
|
window = Gtk::Window.new
|
46
46
|
window.signal_connect('delete-event') do
|
data/sample/simpleanim.rb
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
Inspired by http://mail.gnome.org/archives/gtk-perl-list/2005-September/msg00110.html
|
6
6
|
|
7
|
-
Copyright (c) 2002-
|
8
|
-
This program is licenced under the same licence as Ruby-
|
7
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
8
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
9
9
|
|
10
10
|
$Id: simpleanim.rb,v 1.2 2006/06/17 14:38:08 mutoh Exp $
|
11
11
|
=end
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'gtk3'
|
14
14
|
|
15
15
|
$stdout.sync = true
|
16
16
|
|
@@ -19,21 +19,21 @@ store_pixels = []
|
|
19
19
|
|
20
20
|
print 'generating frames'
|
21
21
|
for red in 0 .. 126
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
store_pixels << pixels = ([ 4*(63-red).abs, 0, 0 ] * (64*64)).pack('C*')
|
23
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:data => pixels,
|
24
|
+
:colorspace => :rgb,
|
25
|
+
:has_alpha =>false,
|
26
|
+
:bits_per_sample => 8,
|
27
|
+
:width => 64,
|
28
|
+
:height => 64,
|
29
|
+
:row_stride => 64*3)
|
30
|
+
simple_anim.add_frame(pixbuf)
|
31
|
+
print '.'
|
32
32
|
end
|
33
33
|
puts 'done'
|
34
34
|
|
35
35
|
window = Gtk::Window.new
|
36
|
-
image = Gtk::Image.new(simple_anim)
|
36
|
+
image = Gtk::Image.new(animation: simple_anim)
|
37
37
|
window.add(image)
|
38
38
|
window.show_all
|
39
39
|
window.signal_connect('destroy') { Gtk.main_quit }
|
data/sample/utils.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
=begin
|
3
3
|
utils.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: utils.rb,v 1.4 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
11
|
+
require 'gtk3'
|
12
12
|
|
13
13
|
filename = ARGV[0]
|
14
14
|
unless filename
|
@@ -18,7 +18,7 @@ end
|
|
18
18
|
|
19
19
|
src = GdkPixbuf::Pixbuf.new(:file => filename)
|
20
20
|
|
21
|
-
vbox = Gtk::
|
21
|
+
vbox = Gtk::Box.new(:vertical)
|
22
22
|
|
23
23
|
dst = src.add_alpha(true, 0, 0, 0)
|
24
24
|
vbox.pack_start(Gtk::Image.new(dst))
|
@@ -28,14 +28,15 @@ dst = GdkPixbuf::Pixbuf.new(:colorspace => :rgb,
|
|
28
28
|
:bits_per_sample => 8,
|
29
29
|
:width => src.width + 20,
|
30
30
|
:height => src.height + 30)
|
31
|
+
dst.fill!(0xff000099) # Clears a pixbuf to the given RGBA value
|
31
32
|
src.copy_area(0, 0, src.width / 2, src.height / 2, dst, 10, 20)
|
32
|
-
vbox.pack_start(Gtk::Image.new(dst))
|
33
|
+
vbox.pack_start(Gtk::Image.new(:pixbuf => dst))
|
33
34
|
|
34
35
|
dst = src.saturate_and_pixelate(0.3, true)
|
35
|
-
vbox.pack_start(Gtk::Image.new(dst))
|
36
|
+
vbox.pack_start(Gtk::Image.new(:pixbuf => dst))
|
36
37
|
|
37
|
-
dst = src.fill!(0xff000099)
|
38
|
-
vbox.pack_start(Gtk::Image.new(dst))
|
38
|
+
dst = src.fill!(0xff000099)
|
39
|
+
vbox.pack_start(Gtk::Image.new(:pixbuf => dst))
|
39
40
|
|
40
41
|
w = Gtk::Window.new.add(vbox)
|
41
42
|
w.signal_connect('delete-event') do
|
data/sample/xpm.rb
CHANGED
@@ -2,29 +2,30 @@
|
|
2
2
|
=begin
|
3
3
|
xpm.rb - Ruby/GdkPixbuf sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
|
8
8
|
$Id: xpm.rb,v 1.5 2006/06/17 14:38:08 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require '
|
11
|
+
require 'gtk3'
|
12
12
|
|
13
13
|
r_xpm = [
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
'10 10 3 1',
|
15
|
+
' c None',
|
16
|
+
'. c #FE0B0B',
|
17
|
+
'+ c #FFFFFF',
|
18
|
+
'+.......++',
|
19
|
+
'+.. ..+',
|
20
|
+
'+.. ..+',
|
21
|
+
'+.. ...+',
|
22
|
+
'+.......++',
|
23
|
+
'+.....++++',
|
24
|
+
'+..++..+++',
|
25
|
+
'+..++...++',
|
26
|
+
'+..+++...+',
|
27
|
+
'+..++++..+'
|
28
|
+
]
|
28
29
|
|
29
30
|
w = Gtk::Window.new
|
30
31
|
w.signal_connect('delete-event') do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
require "tempfile"
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "gdk_pixbuf2"
|
20
20
|
|
21
21
|
module GdkPixbufTestUtils
|
22
22
|
private
|
data/test/run-test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2016 Ruby-
|
3
|
+
# Copyright (C) 2016-2021 Ruby-GNOME Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -16,35 +16,14 @@
|
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
|
-
|
20
|
-
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
|
19
|
+
require_relative "../../glib2/test/run-test"
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
[gobject_introspection_base, "gobject-introspection"],
|
31
|
-
[gdk_pixbuf2_base, "gdk_pixbuf2"],
|
32
|
-
]
|
33
|
-
modules.each do |target, module_name|
|
34
|
-
makefile = File.join(target, "Makefile")
|
35
|
-
if File.exist?(makefile) and system("which make > /dev/null")
|
36
|
-
`make -C #{target.dump} > /dev/null` or exit(false)
|
37
|
-
end
|
38
|
-
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
|
39
|
-
$LOAD_PATH.unshift(File.join(target, "lib"))
|
21
|
+
run_test(__dir__,
|
22
|
+
[
|
23
|
+
"glib2",
|
24
|
+
"gobject-introspection",
|
25
|
+
"gio2",
|
26
|
+
"gdk_pixbuf2",
|
27
|
+
]) do
|
28
|
+
require_relative "gdk_pixbuf2-test-utils"
|
40
29
|
end
|
41
|
-
|
42
|
-
$LOAD_PATH.unshift(File.join(glib_base, "test"))
|
43
|
-
require "glib-test-init"
|
44
|
-
|
45
|
-
$LOAD_PATH.unshift(File.join(gdk_pixbuf2_base, "test"))
|
46
|
-
require "gdk_pixbuf2-test-utils"
|
47
|
-
|
48
|
-
require "gdk_pixbuf2"
|
49
|
-
|
50
|
-
exit Test::Unit::AutoRunner.run(true, File.join(gdk_pixbuf2_base, "test"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdk_pixbuf2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gio2
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.4.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.4.4
|
27
27
|
description: Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x.
|
28
28
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
29
29
|
executables: []
|
@@ -84,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
|
88
|
-
rubygems_version: 2.7.6.2
|
87
|
+
rubygems_version: 3.3.0.dev
|
89
88
|
signing_key:
|
90
89
|
specification_version: 4
|
91
90
|
summary: Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x.
|