gdk_pixbuf2 3.0.8-x64-mingw32 → 3.0.9-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/gdk_pixbuf2.rb +11 -69
- data/lib/gdk_pixbuf2/deprecated.rb +160 -0
- data/lib/gdk_pixbuf2/loader.rb +51 -0
- data/lib/gdk_pixbuf2/pixbuf-loader.rb +24 -0
- data/lib/gdk_pixbuf2/pixbuf.rb +282 -0
- data/lib/gdk_pixbuf2/version.rb +33 -0
- data/sample/anim.rb +2 -2
- data/sample/composite.rb +41 -11
- data/sample/flip.rb +2 -2
- data/sample/format.rb +2 -4
- data/sample/loader.rb +3 -3
- data/sample/rotate.rb +4 -4
- data/sample/save.rb +3 -3
- data/sample/scale.rb +14 -6
- data/sample/simpleanim.rb +10 -4
- data/sample/utils.rb +7 -4
- data/sample/xpm.rb +9 -9
- data/test/fixture/floppybuddy.gif +0 -0
- data/test/fixture/gnome-logo-icon.png +0 -0
- data/test/fixture/image.gresource +0 -0
- data/test/fixture/image.gresource.xml +6 -0
- data/test/gdk_pixbuf2-test-utils.rb +11 -0
- data/test/run-test.rb +6 -3
- data/test/test-animation.rb +30 -0
- data/test/test-loader.rb +31 -0
- data/test/test-pixbuf.rb +334 -0
- data/vendor/local/bin/gdk-pixbuf-csource.exe +0 -0
- data/vendor/local/bin/gdk-pixbuf-pixdata.exe +0 -0
- data/vendor/local/bin/gdk-pixbuf-query-loaders.exe +0 -0
- data/vendor/local/bin/libgdk_pixbuf-2.0-0.dll +0 -0
- data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.a +0 -0
- data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll +0 -0
- data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll.a +0 -0
- data/vendor/local/lib/libgdk_pixbuf-2.0.dll.a +0 -0
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/GdkPixbufLoader.html +59 -59
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Animations.html +64 -64
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-File-Loading.html +89 -89
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-File-saving.html +85 -85
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Image-Data-in-Memory.html +23 -23
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Inline-data.html +36 -36
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Module-Interface.html +46 -46
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html +10 -10
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Scaling.html +13 -13
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html +52 -52
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Utilities.html +10 -10
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-X-Drawables-to-Pixbufs.html +3 -3
- data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-XlibRGB.html +4 -4
- metadata +17 -25
- data/README +0 -29
- data/ext/gdk_pixbuf2/depend +0 -11
- data/ext/gdk_pixbuf2/extconf.rb +0 -68
- data/ext/gdk_pixbuf2/gdk_pixbuf2.def +0 -2
- data/ext/gdk_pixbuf2/rbgdk-pixbuf-format.c +0 -179
- data/ext/gdk_pixbuf2/rbgdk-pixbuf-loader.c +0 -164
- data/ext/gdk_pixbuf2/rbgdk-pixbuf.c +0 -737
- data/ext/gdk_pixbuf2/rbgdk-pixbuf.h +0 -41
- data/ext/gdk_pixbuf2/rbgdk-pixbuf2conversions.h +0 -42
- data/ext/gdk_pixbuf2/rbgdk-pixbuf2private.h +0 -35
- data/ext/gdk_pixbuf2/rbgdk-pixbufanimation.c +0 -93
- data/ext/gdk_pixbuf2/rbgdk-pixbufanimationiter.c +0 -71
- data/ext/gdk_pixbuf2/rbgdk-pixbufsimpleanim.c +0 -53
- data/ext/gdk_pixbuf2/rbgdk-pixdata.c +0 -213
- data/extconf.rb +0 -49
- data/lib/2.2/gdk_pixbuf2.so +0 -0
- data/lib/2.3/gdk_pixbuf2.so +0 -0
- data/sample/inline.rb +0 -37
- data/sample/pixdata.rb +0 -39
- data/test/test-version.rb +0 -47
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestAnimationIter < Test::Unit::TestCase
|
18
|
+
include GdkPixbufTestUtils
|
19
|
+
|
20
|
+
setup do
|
21
|
+
@animation = GdkPixbuf::PixbufAnimation.new(fixture_path("floppybuddy.gif"))
|
22
|
+
@iter = @animation.get_iter
|
23
|
+
end
|
24
|
+
|
25
|
+
test("#on_currently_loading_frame?") do
|
26
|
+
assert do
|
27
|
+
not @iter.on_currently_loading_frame?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/test/test-loader.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestLoader < Test::Unit::TestCase
|
18
|
+
include GdkPixbufTestUtils
|
19
|
+
|
20
|
+
setup do
|
21
|
+
@loader = GdkPixbuf::PixbufLoader.new
|
22
|
+
end
|
23
|
+
|
24
|
+
test("#last_write") do
|
25
|
+
assert_nil(@loader.pixbuf)
|
26
|
+
File.open(fixture_path("gnome-logo-icon.png"), "rb") do |png|
|
27
|
+
@loader.last_write(png.read)
|
28
|
+
end
|
29
|
+
assert_not_nil(@loader.pixbuf)
|
30
|
+
end
|
31
|
+
end
|
data/test/test-pixbuf.rb
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestPixbuf < Test::Unit::TestCase
|
18
|
+
include GdkPixbufTestUtils
|
19
|
+
|
20
|
+
sub_test_case(".new") do
|
21
|
+
def r_xpm
|
22
|
+
[
|
23
|
+
"10 10 3 1",
|
24
|
+
" c None",
|
25
|
+
". c #FE0B0B",
|
26
|
+
"+ c #FFFFFF",
|
27
|
+
"+.......++",
|
28
|
+
"+.. ..+",
|
29
|
+
"+.. ..+",
|
30
|
+
"+.. ...+",
|
31
|
+
"+.......++",
|
32
|
+
"+.....++++",
|
33
|
+
"+..++..+++",
|
34
|
+
"+..++...++",
|
35
|
+
"+..+++...+",
|
36
|
+
"+..++++..+",
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
sub_test_case("legacy form") do
|
41
|
+
test "basic" do
|
42
|
+
colorspace = GdkPixbuf::Colorspace::RGB
|
43
|
+
width = 100
|
44
|
+
height = 100
|
45
|
+
has_alpha = true
|
46
|
+
bits_per_sample = 8
|
47
|
+
pixbuf = GdkPixbuf::Pixbuf.new(colorspace,
|
48
|
+
has_alpha,
|
49
|
+
bits_per_sample,
|
50
|
+
width,
|
51
|
+
height)
|
52
|
+
assert_equal(colorspace, pixbuf.colorspace)
|
53
|
+
assert_equal(width, pixbuf.width)
|
54
|
+
assert_equal(height, pixbuf.height)
|
55
|
+
assert_equal(has_alpha, pixbuf.has_alpha?)
|
56
|
+
assert_equal(bits_per_sample, pixbuf.bits_per_sample)
|
57
|
+
end
|
58
|
+
|
59
|
+
test "file" do
|
60
|
+
pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
61
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
62
|
+
end
|
63
|
+
|
64
|
+
test "xpm" do
|
65
|
+
pixbuf = GdkPixbuf::Pixbuf.new(r_xpm)
|
66
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
67
|
+
end
|
68
|
+
|
69
|
+
test "file: size" do
|
70
|
+
pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"),
|
71
|
+
32, 48)
|
72
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
73
|
+
assert_equal(32, pixbuf.width)
|
74
|
+
assert_equal(32, pixbuf.height)
|
75
|
+
end
|
76
|
+
|
77
|
+
test "file: scale" do
|
78
|
+
pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"),
|
79
|
+
32, 48, false)
|
80
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
81
|
+
assert_equal(32, pixbuf.width)
|
82
|
+
assert_equal(48, pixbuf.height)
|
83
|
+
end
|
84
|
+
|
85
|
+
test "subpixbuf" do
|
86
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
87
|
+
pixbuf = GdkPixbuf::Pixbuf.new(src_pixbuf, 0, 0, 32, 32)
|
88
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
89
|
+
assert_equal(32, pixbuf.width)
|
90
|
+
assert_equal(32, pixbuf.height)
|
91
|
+
end
|
92
|
+
|
93
|
+
test "data" do
|
94
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
95
|
+
data = src_pixbuf.pixels.pack("C*")
|
96
|
+
pixbuf = GdkPixbuf::Pixbuf.new(data,
|
97
|
+
src_pixbuf.colorspace,
|
98
|
+
src_pixbuf.has_alpha?,
|
99
|
+
src_pixbuf.bits_per_sample,
|
100
|
+
src_pixbuf.width,
|
101
|
+
src_pixbuf.height,
|
102
|
+
src_pixbuf.rowstride,
|
103
|
+
)
|
104
|
+
assert_equal(src_pixbuf.pixels, pixbuf.pixels)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
sub_test_case("Hash form") do
|
109
|
+
test "basic" do
|
110
|
+
colorspace = GdkPixbuf::Colorspace::RGB
|
111
|
+
width = 100
|
112
|
+
height = 100
|
113
|
+
has_alpha = true
|
114
|
+
bits_per_sample = 8
|
115
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:colorspace => colorspace,
|
116
|
+
:has_alpha => has_alpha,
|
117
|
+
:width => width,
|
118
|
+
:height => height,
|
119
|
+
:bits_per_sample => bits_per_sample)
|
120
|
+
assert_equal(colorspace, pixbuf.colorspace)
|
121
|
+
assert_equal(width, pixbuf.width)
|
122
|
+
assert_equal(height, pixbuf.height)
|
123
|
+
assert_equal(has_alpha, pixbuf.has_alpha?)
|
124
|
+
assert_equal(bits_per_sample, pixbuf.bits_per_sample)
|
125
|
+
end
|
126
|
+
|
127
|
+
test "file" do
|
128
|
+
filename = fixture_path("gnome-logo-icon.png")
|
129
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
130
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
131
|
+
end
|
132
|
+
|
133
|
+
test "xpm" do
|
134
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:xpm => r_xpm)
|
135
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
136
|
+
end
|
137
|
+
|
138
|
+
test "file: size" do
|
139
|
+
filename = fixture_path("gnome-logo-icon.png")
|
140
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => filename,
|
141
|
+
:width => 32,
|
142
|
+
:height => 48)
|
143
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
144
|
+
assert_equal(32, pixbuf.width)
|
145
|
+
assert_equal(32, pixbuf.height)
|
146
|
+
end
|
147
|
+
|
148
|
+
test "file: scale" do
|
149
|
+
filename = fixture_path("gnome-logo-icon.png")
|
150
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => filename,
|
151
|
+
:width => 32,
|
152
|
+
:height => 48,
|
153
|
+
:scale => true,
|
154
|
+
:preserve_aspect_ratio => false)
|
155
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
156
|
+
assert_equal(32, pixbuf.width)
|
157
|
+
assert_equal(48, pixbuf.height)
|
158
|
+
end
|
159
|
+
|
160
|
+
test "subpixbuf" do
|
161
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
162
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:src_pixbuf => src_pixbuf,
|
163
|
+
:src_x => 0,
|
164
|
+
:src_y => 0,
|
165
|
+
:width => 32,
|
166
|
+
:height => 32)
|
167
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
168
|
+
assert_equal(32, pixbuf.width)
|
169
|
+
assert_equal(32, pixbuf.height)
|
170
|
+
end
|
171
|
+
|
172
|
+
test "data" do
|
173
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
174
|
+
data = src_pixbuf.pixels.pack("C*")
|
175
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:data => data,
|
176
|
+
:colorspace => src_pixbuf.colorspace,
|
177
|
+
:has_alpha => src_pixbuf.has_alpha?,
|
178
|
+
:bits_per_sample => src_pixbuf.bits_per_sample,
|
179
|
+
:width => src_pixbuf.width,
|
180
|
+
:height => src_pixbuf.height,
|
181
|
+
:row_stride => src_pixbuf.rowstride,
|
182
|
+
)
|
183
|
+
assert_equal(src_pixbuf.pixels, pixbuf.pixels)
|
184
|
+
end
|
185
|
+
|
186
|
+
test "bytes" do
|
187
|
+
only_version(2, 32)
|
188
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
189
|
+
bytes = src_pixbuf.pixels.flatten.pack("C*")
|
190
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:bytes => bytes,
|
191
|
+
:colorspace => src_pixbuf.colorspace,
|
192
|
+
:has_alpha => src_pixbuf.has_alpha?,
|
193
|
+
:bits_per_sample => src_pixbuf.bits_per_sample,
|
194
|
+
:width => src_pixbuf.width,
|
195
|
+
:height => src_pixbuf.height,
|
196
|
+
:row_stride => src_pixbuf.rowstride,
|
197
|
+
)
|
198
|
+
assert_equal(src_pixbuf.pixels, pixbuf.pixels)
|
199
|
+
end
|
200
|
+
|
201
|
+
test "resource" do
|
202
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
203
|
+
resource = Gio::Resource.load(fixture_path("image.gresource"))
|
204
|
+
Gio::Resources.register(resource)
|
205
|
+
begin
|
206
|
+
resource_path = "/org/ruby/gnome/gnome-logo-icon.png"
|
207
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:resource => resource_path)
|
208
|
+
assert_equal(src_pixbuf.pixels, pixbuf.pixels)
|
209
|
+
ensure
|
210
|
+
Gio::Resources.unregister(resource)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
test "resource: scale" do
|
215
|
+
resource = Gio::Resource.load(fixture_path("image.gresource"))
|
216
|
+
Gio::Resources.register(resource)
|
217
|
+
begin
|
218
|
+
resource_path = "/org/ruby/gnome/gnome-logo-icon.png"
|
219
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:resource => resource_path,
|
220
|
+
:width => 32,
|
221
|
+
:height => 48,
|
222
|
+
:scale => true,
|
223
|
+
:preserve_aspect_ratio => false)
|
224
|
+
assert_equal([
|
225
|
+
GdkPixbuf::Colorspace::RGB,
|
226
|
+
32,
|
227
|
+
48,
|
228
|
+
],
|
229
|
+
[
|
230
|
+
pixbuf.colorspace,
|
231
|
+
pixbuf.width,
|
232
|
+
pixbuf.height,
|
233
|
+
])
|
234
|
+
ensure
|
235
|
+
Gio::Resources.unregister(resource)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_new_subpixbuf
|
241
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
242
|
+
pixbuf = src_pixbuf.new_subpixbuf(0, 0, 32, 32)
|
243
|
+
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
244
|
+
assert_equal(32, pixbuf.width)
|
245
|
+
assert_equal(32, pixbuf.height)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_dup
|
250
|
+
pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
251
|
+
assert_equal(pixbuf.pixels, pixbuf.dup.pixels)
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_fill!
|
255
|
+
filename = fixture_path("gnome-logo-icon.png")
|
256
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
257
|
+
pixbuf.fill!(0xffffffff)
|
258
|
+
assert_equal([0xff] * (pixbuf.rowstride * pixbuf.height),
|
259
|
+
pixbuf.pixels)
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_rotate
|
263
|
+
pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
264
|
+
inverted_pixbuf = pixbuf.rotate(:upsidedown)
|
265
|
+
assert_not_equal(pixbuf.pixels, inverted_pixbuf.pixels)
|
266
|
+
inverted_twice_pixbuf = inverted_pixbuf.rotate(:upsidedown)
|
267
|
+
assert_equal(pixbuf.pixels, inverted_twice_pixbuf.pixels)
|
268
|
+
end
|
269
|
+
|
270
|
+
sub_test_case("saturate_and_pixelate") do
|
271
|
+
# Based on the function gdk_pixbuf_saturate_and_pixelate
|
272
|
+
# in gdk-pixbuf-util.c
|
273
|
+
def saturate_and_pixelate_pixels(pixbuf, saturation, pixelate)
|
274
|
+
alpha = pixbuf.has_alpha?
|
275
|
+
width = pixbuf.width
|
276
|
+
height = pixbuf.height
|
277
|
+
pixels = pixbuf.pixels
|
278
|
+
dest_pix = []
|
279
|
+
dark_factor = 0.7
|
280
|
+
height.times do |i|
|
281
|
+
width.times do |k|
|
282
|
+
j =((i ) * width + k) * 4
|
283
|
+
intens = intensity(pixels[j + 0], pixels[j + 1], pixels[j + 2])
|
284
|
+
if pixelate == true && ( (i + k) % 2 == 0)
|
285
|
+
dest_pix << (intens / 2 + 127).floor
|
286
|
+
dest_pix << (intens / 2 + 127).floor
|
287
|
+
dest_pix << (intens / 2 + 127).floor
|
288
|
+
elsif pixelate == true
|
289
|
+
dest_pix << clamp_uchar(saturate(pixels[j + 0],
|
290
|
+
saturation, intens) * dark_factor).floor
|
291
|
+
dest_pix << clamp_uchar(saturate(pixels[j + 1],
|
292
|
+
saturation, intens) * dark_factor).floor
|
293
|
+
dest_pix << clamp_uchar(saturate(pixels[j + 2],
|
294
|
+
saturation, intens) * dark_factor).floor
|
295
|
+
else
|
296
|
+
dest_pix << clamp_uchar(saturate(pixels[j + 0], saturation, intens)).floor
|
297
|
+
dest_pix << clamp_uchar(saturate(pixels[j + 1], saturation, intens)).floor
|
298
|
+
dest_pix << clamp_uchar(saturate(pixels[j + 2], saturation, intens)).floor
|
299
|
+
end
|
300
|
+
dest_pix << pixels[j + 3] if alpha
|
301
|
+
end
|
302
|
+
end
|
303
|
+
dest_pix
|
304
|
+
end
|
305
|
+
|
306
|
+
def saturate(value, saturation, intensity)
|
307
|
+
(1.0 - saturation) * intensity + saturation * (1.0 * value)
|
308
|
+
end
|
309
|
+
|
310
|
+
def clamp_uchar(x)
|
311
|
+
[0, x, 255].sort[1]
|
312
|
+
end
|
313
|
+
|
314
|
+
def intensity(r, g, b)
|
315
|
+
(r * 0.30 + g * 0.59 + b * 0.11).floor
|
316
|
+
end
|
317
|
+
|
318
|
+
test "no modifications" do
|
319
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
320
|
+
pixbuf = src_pixbuf.saturate_and_pixelate(1, false)
|
321
|
+
assert_equal(src_pixbuf.pixels, pixbuf.pixels)
|
322
|
+
end
|
323
|
+
|
324
|
+
test "normal usage" do
|
325
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
|
326
|
+
pixbuf = src_pixbuf.saturate_and_pixelate(0, true)
|
327
|
+
ref = saturate_and_pixelate_pixels(src_pixbuf, 0, true)
|
328
|
+
assert_equal(ref, pixbuf.pixels, ref.size)
|
329
|
+
pixbuf = src_pixbuf.saturate_and_pixelate(0.5, true)
|
330
|
+
ref = saturate_and_pixelate_pixels(src_pixbuf, 0.5, true)
|
331
|
+
assert_equal(ref, pixbuf.pixels)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -75,7 +75,7 @@
|
|
75
75
|
</tr>
|
76
76
|
<tr>
|
77
77
|
<td class="function_type">
|
78
|
-
<a href="
|
78
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
|
79
79
|
</td>
|
80
80
|
<td class="function_name">
|
81
81
|
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()">gdk_pixbuf_loader_write</a> <span class="c_punctuation">()</span>
|
@@ -83,7 +83,7 @@
|
|
83
83
|
</tr>
|
84
84
|
<tr>
|
85
85
|
<td class="function_type">
|
86
|
-
<a href="
|
86
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
|
87
87
|
</td>
|
88
88
|
<td class="function_name">
|
89
89
|
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write-bytes" title="gdk_pixbuf_loader_write_bytes ()">gdk_pixbuf_loader_write_bytes</a> <span class="c_punctuation">()</span>
|
@@ -115,7 +115,7 @@
|
|
115
115
|
</tr>
|
116
116
|
<tr>
|
117
117
|
<td class="function_type">
|
118
|
-
<a href="
|
118
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
|
119
119
|
</td>
|
120
120
|
<td class="function_name">
|
121
121
|
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-close" title="gdk_pixbuf_loader_close ()">gdk_pixbuf_loader_close</a> <span class="c_punctuation">()</span>
|
@@ -136,22 +136,22 @@
|
|
136
136
|
<tr>
|
137
137
|
<td class="signal_type"><span class="returnvalue">void</span></td>
|
138
138
|
<td class="signal_name"><a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-prepared" title="The “area-prepared” signal">area-prepared</a></td>
|
139
|
-
<td class="signal_flags"><a href="
|
139
|
+
<td class="signal_flags"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
|
140
140
|
</tr>
|
141
141
|
<tr>
|
142
142
|
<td class="signal_type"><span class="returnvalue">void</span></td>
|
143
143
|
<td class="signal_name"><a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-updated" title="The “area-updated” signal">area-updated</a></td>
|
144
|
-
<td class="signal_flags"><a href="
|
144
|
+
<td class="signal_flags"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
|
145
145
|
</tr>
|
146
146
|
<tr>
|
147
147
|
<td class="signal_type"><span class="returnvalue">void</span></td>
|
148
148
|
<td class="signal_name"><a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-closed" title="The “closed” signal">closed</a></td>
|
149
|
-
<td class="signal_flags"><a href="
|
149
|
+
<td class="signal_flags"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
|
150
150
|
</tr>
|
151
151
|
<tr>
|
152
152
|
<td class="signal_type"><span class="returnvalue">void</span></td>
|
153
153
|
<td class="signal_name"><a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-size-prepared" title="The “size-prepared” signal">size-prepared</a></td>
|
154
|
-
<td class="signal_flags"><a href="
|
154
|
+
<td class="signal_flags"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
|
155
155
|
</tr>
|
156
156
|
</tbody>
|
157
157
|
</table></div>
|
@@ -171,7 +171,7 @@
|
|
171
171
|
</div>
|
172
172
|
<div class="refsect1">
|
173
173
|
<a name="GdkPixbufLoader.object-hierarchy"></a><h2>Object Hierarchy</h2>
|
174
|
-
<pre class="screen"> <a href="
|
174
|
+
<pre class="screen"> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
|
175
175
|
<span class="lineart">╰──</span> GdkPixbufLoader
|
176
176
|
</pre>
|
177
177
|
</div>
|
@@ -236,7 +236,7 @@ gdk_pixbuf_loader_new (<em class="parameter"><code><span class="type">void</span
|
|
236
236
|
<a name="gdk-pixbuf-loader-new-with-type"></a><h3>gdk_pixbuf_loader_new_with_type ()</h3>
|
237
237
|
<pre class="programlisting"><a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="returnvalue">GdkPixbufLoader</span></a> *
|
238
238
|
gdk_pixbuf_loader_new_with_type (<em class="parameter"><code>const <span class="type">char</span> *image_type</code></em>,
|
239
|
-
<em class="parameter"><code><a href="
|
239
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
|
240
240
|
<p>Creates a new pixbuf loader object that always attempts to parse
|
241
241
|
image data as if it were an image of type <em class="parameter"><code>image_type</code></em>
|
242
242
|
, instead of
|
@@ -265,7 +265,7 @@ of the <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" t
|
|
265
265
|
</tr>
|
266
266
|
<tr>
|
267
267
|
<td class="parameter_name"><p>error</p></td>
|
268
|
-
<td class="parameter_description"><p> return location for an allocated <a href="
|
268
|
+
<td class="parameter_description"><p> return location for an allocated <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors. </p></td>
|
269
269
|
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
|
270
270
|
</tr>
|
271
271
|
</tbody>
|
@@ -281,7 +281,7 @@ of the <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" t
|
|
281
281
|
<a name="gdk-pixbuf-loader-new-with-mime-type"></a><h3>gdk_pixbuf_loader_new_with_mime_type ()</h3>
|
282
282
|
<pre class="programlisting"><a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="returnvalue">GdkPixbufLoader</span></a> *
|
283
283
|
gdk_pixbuf_loader_new_with_mime_type (<em class="parameter"><code>const <span class="type">char</span> *mime_type</code></em>,
|
284
|
-
<em class="parameter"><code><a href="
|
284
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
|
285
285
|
<p>Creates a new pixbuf loader object that always attempts to parse
|
286
286
|
image data as if it were an image of mime type <em class="parameter"><code>mime_type</code></em>
|
287
287
|
, instead of
|
@@ -311,7 +311,7 @@ structs returned by <a class="link" href="gdk-pixbuf-Module-Interface.html#gdk-p
|
|
311
311
|
</tr>
|
312
312
|
<tr>
|
313
313
|
<td class="parameter_name"><p>error</p></td>
|
314
|
-
<td class="parameter_description"><p> return location for an allocated <a href="
|
314
|
+
<td class="parameter_description"><p> return location for an allocated <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors. </p></td>
|
315
315
|
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
|
316
316
|
</tr>
|
317
317
|
</tbody>
|
@@ -348,7 +348,7 @@ currently loading image file.</p>
|
|
348
348
|
<div class="refsect3">
|
349
349
|
<a name="gdk-pixbuf-loader-get-format.returns"></a><h4>Returns</h4>
|
350
350
|
<p> A <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="type">GdkPixbufFormat</span></a> or
|
351
|
-
<a href="
|
351
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. The return value is owned by GdkPixbuf and should not be
|
352
352
|
freed. </p>
|
353
353
|
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
|
354
354
|
</div>
|
@@ -357,19 +357,19 @@ freed. </p>
|
|
357
357
|
<hr>
|
358
358
|
<div class="refsect2">
|
359
359
|
<a name="gdk-pixbuf-loader-write"></a><h3>gdk_pixbuf_loader_write ()</h3>
|
360
|
-
<pre class="programlisting"><a href="
|
360
|
+
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
|
361
361
|
gdk_pixbuf_loader_write (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
|
362
|
-
<em class="parameter"><code>const <a href="
|
363
|
-
<em class="parameter"><code><a href="
|
364
|
-
<em class="parameter"><code><a href="
|
362
|
+
<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guchar"><span class="type">guchar</span></a> *buf</code></em>,
|
363
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> count</code></em>,
|
364
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
|
365
365
|
<p>This will cause a pixbuf loader to parse the next <em class="parameter"><code>count</code></em>
|
366
366
|
bytes of
|
367
|
-
an image. It will return <a href="
|
368
|
-
and <a href="
|
369
|
-
will be closed, and will not accept further writes. If <a href="
|
367
|
+
an image. It will return <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the data was loaded successfully,
|
368
|
+
and <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred. In the latter case, the loader
|
369
|
+
will be closed, and will not accept further writes. If <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is
|
370
370
|
returned, <em class="parameter"><code>error</code></em>
|
371
371
|
will be set to an error from the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a>
|
372
|
-
or <a href="
|
372
|
+
or <a href="https://developer.gnome.org/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.</p>
|
373
373
|
<div class="refsect3">
|
374
374
|
<a name="gdk-pixbuf-loader-write.parameters"></a><h4>Parameters</h4>
|
375
375
|
<div class="informaltable"><table width="100%" border="0">
|
@@ -405,24 +405,24 @@ buffer in bytes.</p></td>
|
|
405
405
|
</div>
|
406
406
|
<div class="refsect3">
|
407
407
|
<a name="gdk-pixbuf-loader-write.returns"></a><h4>Returns</h4>
|
408
|
-
<p> <a href="
|
408
|
+
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the write was successful, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the loader
|
409
409
|
cannot parse the buffer.</p>
|
410
410
|
</div>
|
411
411
|
</div>
|
412
412
|
<hr>
|
413
413
|
<div class="refsect2">
|
414
414
|
<a name="gdk-pixbuf-loader-write-bytes"></a><h3>gdk_pixbuf_loader_write_bytes ()</h3>
|
415
|
-
<pre class="programlisting"><a href="
|
415
|
+
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
|
416
416
|
gdk_pixbuf_loader_write_bytes (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
|
417
|
-
<em class="parameter"><code><a href="
|
418
|
-
<em class="parameter"><code><a href="
|
419
|
-
<p>This will cause a pixbuf loader to parse a buffer inside a <a href="
|
420
|
-
for an image. It will return <a href="
|
421
|
-
and <a href="
|
422
|
-
will be closed, and will not accept further writes. If <a href="
|
417
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> *buffer</code></em>,
|
418
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
|
419
|
+
<p>This will cause a pixbuf loader to parse a buffer inside a <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a>
|
420
|
+
for an image. It will return <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the data was loaded successfully,
|
421
|
+
and <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred. In the latter case, the loader
|
422
|
+
will be closed, and will not accept further writes. If <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is
|
423
423
|
returned, <em class="parameter"><code>error</code></em>
|
424
424
|
will be set to an error from the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a>
|
425
|
-
or <a href="
|
425
|
+
or <a href="https://developer.gnome.org/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.</p>
|
426
426
|
<p>See also: <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a></p>
|
427
427
|
<div class="refsect3">
|
428
428
|
<a name="gdk-pixbuf-loader-write-bytes.parameters"></a><h4>Parameters</h4>
|
@@ -440,7 +440,7 @@ or <a href="/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/share/gtk-doc/htm
|
|
440
440
|
</tr>
|
441
441
|
<tr>
|
442
442
|
<td class="parameter_name"><p>buffer</p></td>
|
443
|
-
<td class="parameter_description"><p>The image data as a <a href="
|
443
|
+
<td class="parameter_description"><p>The image data as a <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a></p></td>
|
444
444
|
<td class="parameter_annotations"> </td>
|
445
445
|
</tr>
|
446
446
|
<tr>
|
@@ -453,7 +453,7 @@ or <a href="/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/share/gtk-doc/htm
|
|
453
453
|
</div>
|
454
454
|
<div class="refsect3">
|
455
455
|
<a name="gdk-pixbuf-loader-write-bytes.returns"></a><h4>Returns</h4>
|
456
|
-
<p> <a href="
|
456
|
+
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the write was successful, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the loader
|
457
457
|
cannot parse the buffer.</p>
|
458
458
|
</div>
|
459
459
|
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
|
@@ -510,9 +510,9 @@ In general it only makes sense to call this function after the
|
|
510
510
|
"area-prepared" signal has been emitted by the loader; this means
|
511
511
|
that enough data has been read to know the size of the image that
|
512
512
|
will be allocated. If the loader has not received enough data via
|
513
|
-
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a>, then this function returns <a href="
|
513
|
+
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a>, then this function returns <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. The
|
514
514
|
returned pixbuf will be the same in all future calls to the loader,
|
515
|
-
so simply calling <a href="
|
515
|
+
so simply calling <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-ref"><code class="function">g_object_ref()</code></a> should be sufficient to continue
|
516
516
|
using it. Additionally, if the loader is an animation, it will
|
517
517
|
return the "static image" of the animation
|
518
518
|
(see <a class="link" href="gdk-pixbuf-Animations.html#gdk-pixbuf-animation-get-static-image" title="gdk_pixbuf_animation_get_static_image ()"><code class="function">gdk_pixbuf_animation_get_static_image()</code></a>).</p>
|
@@ -533,7 +533,7 @@ return the "static image" of the animation
|
|
533
533
|
</div>
|
534
534
|
<div class="refsect3">
|
535
535
|
<a name="gdk-pixbuf-loader-get-pixbuf.returns"></a><h4>Returns</h4>
|
536
|
-
<p> The <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> that the loader is creating, or <a href="
|
536
|
+
<p> The <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> that the loader is creating, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not
|
537
537
|
enough data has been read to determine how to create the image buffer. </p>
|
538
538
|
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
|
539
539
|
</div>
|
@@ -547,7 +547,7 @@ gdk_pixbuf_loader_get_animation (<em class="parameter"><code><a class="link" hre
|
|
547
547
|
In general it only makes sense to call this function after the "area-prepared"
|
548
548
|
signal has been emitted by the loader. If the loader doesn't have enough
|
549
549
|
bytes yet (hasn't emitted the "area-prepared" signal) this function will
|
550
|
-
return <a href="
|
550
|
+
return <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p>
|
551
551
|
<div class="refsect3">
|
552
552
|
<a name="gdk-pixbuf-loader-get-animation.parameters"></a><h4>Parameters</h4>
|
553
553
|
<div class="informaltable"><table width="100%" border="0">
|
@@ -565,7 +565,7 @@ return <a href="/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/share/gtk-doc
|
|
565
565
|
</div>
|
566
566
|
<div class="refsect3">
|
567
567
|
<a name="gdk-pixbuf-loader-get-animation.returns"></a><h4>Returns</h4>
|
568
|
-
<p> The <a class="link" href="gdk-pixbuf-Animations.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a> that the loader is loading, or <a href="
|
568
|
+
<p> The <a class="link" href="gdk-pixbuf-Animations.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a> that the loader is loading, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if
|
569
569
|
not enough data has been read to determine the information. </p>
|
570
570
|
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
|
571
571
|
</div>
|
@@ -573,22 +573,22 @@ not enough data has been read to determine the information. </p>
|
|
573
573
|
<hr>
|
574
574
|
<div class="refsect2">
|
575
575
|
<a name="gdk-pixbuf-loader-close"></a><h3>gdk_pixbuf_loader_close ()</h3>
|
576
|
-
<pre class="programlisting"><a href="
|
576
|
+
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
|
577
577
|
gdk_pixbuf_loader_close (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
|
578
|
-
<em class="parameter"><code><a href="
|
578
|
+
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
|
579
579
|
<p>Informs a pixbuf loader that no further writes with
|
580
580
|
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a> will occur, so that it can free its
|
581
581
|
internal loading structures. Also, tries to parse any data that
|
582
582
|
hasn't yet been parsed; if the remaining data is partial or
|
583
|
-
corrupt, an error will be returned. If <a href="
|
583
|
+
corrupt, an error will be returned. If <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is returned, <em class="parameter"><code>error</code></em>
|
584
584
|
|
585
|
-
will be set to an error from the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> or <a href="
|
585
|
+
will be set to an error from the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a>
|
586
586
|
domains. If you're just cancelling a load rather than expecting it
|
587
|
-
to be finished, passing <a href="
|
587
|
+
to be finished, passing <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for <em class="parameter"><code>error</code></em>
|
588
588
|
to ignore it is
|
589
589
|
reasonable.</p>
|
590
590
|
<p>Remember that this does not unref the loader, so if you plan not to
|
591
|
-
use it anymore, please <a href="
|
591
|
+
use it anymore, please <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> it.</p>
|
592
592
|
<div class="refsect3">
|
593
593
|
<a name="gdk-pixbuf-loader-close.parameters"></a><h4>Parameters</h4>
|
594
594
|
<div class="informaltable"><table width="100%" border="0">
|
@@ -605,7 +605,7 @@ use it anymore, please <a href="/home/vagrant/ruby-gnome2.win64/glib2/vendor/loc
|
|
605
605
|
</tr>
|
606
606
|
<tr>
|
607
607
|
<td class="parameter_name"><p>error</p></td>
|
608
|
-
<td class="parameter_description"><p> return location for a <a href="
|
608
|
+
<td class="parameter_description"><p> return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors. </p></td>
|
609
609
|
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
|
610
610
|
</tr>
|
611
611
|
</tbody>
|
@@ -613,7 +613,7 @@ use it anymore, please <a href="/home/vagrant/ruby-gnome2.win64/glib2/vendor/loc
|
|
613
613
|
</div>
|
614
614
|
<div class="refsect3">
|
615
615
|
<a name="gdk-pixbuf-loader-close.returns"></a><h4>Returns</h4>
|
616
|
-
<p> <a href="
|
616
|
+
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if all image data written so far was successfully
|
617
617
|
passed out via the update_area signal</p>
|
618
618
|
</div>
|
619
619
|
</div>
|
@@ -633,7 +633,7 @@ fields.</p>
|
|
633
633
|
<a name="GdkPixbufLoader-area-prepared"></a><h3>The <code class="literal">“area-prepared”</code> signal</h3>
|
634
634
|
<pre class="programlisting"><span class="returnvalue">void</span>
|
635
635
|
user_function (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader,
|
636
|
-
<a href="
|
636
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
|
637
637
|
<p>This signal is emitted when the pixbuf loader has allocated the
|
638
638
|
|
639
639
|
pixbuf in the desired size. After this signal is emitted,
|
@@ -663,18 +663,18 @@ the partially-loaded pixbuf.</p>
|
|
663
663
|
</tbody>
|
664
664
|
</table></div>
|
665
665
|
</div>
|
666
|
-
<p>Flags: <a href="
|
666
|
+
<p>Flags: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
|
667
667
|
</div>
|
668
668
|
<hr>
|
669
669
|
<div class="refsect2">
|
670
670
|
<a name="GdkPixbufLoader-area-updated"></a><h3>The <code class="literal">“area-updated”</code> signal</h3>
|
671
671
|
<pre class="programlisting"><span class="returnvalue">void</span>
|
672
672
|
user_function (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader,
|
673
|
-
<a href="
|
674
|
-
<a href="
|
675
|
-
<a href="
|
676
|
-
<a href="
|
677
|
-
<a href="
|
673
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x,
|
674
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y,
|
675
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width,
|
676
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height,
|
677
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
|
678
678
|
<p>This signal is emitted when a significant area of the image being
|
679
679
|
loaded has been updated. Normally it means that a complete
|
680
680
|
scanline has been read in, but it could be a different area as
|
@@ -722,14 +722,14 @@ areas of an image that is being loaded.</p>
|
|
722
722
|
</tbody>
|
723
723
|
</table></div>
|
724
724
|
</div>
|
725
|
-
<p>Flags: <a href="
|
725
|
+
<p>Flags: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
|
726
726
|
</div>
|
727
727
|
<hr>
|
728
728
|
<div class="refsect2">
|
729
729
|
<a name="GdkPixbufLoader-closed"></a><h3>The <code class="literal">“closed”</code> signal</h3>
|
730
730
|
<pre class="programlisting"><span class="returnvalue">void</span>
|
731
731
|
user_function (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader,
|
732
|
-
<a href="
|
732
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
|
733
733
|
<p>This signal is emitted when <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-close" title="gdk_pixbuf_loader_close ()"><code class="function">gdk_pixbuf_loader_close()</code></a> is called.
|
734
734
|
It can be used by different parts of an application to receive
|
735
735
|
notification when an image loader is closed by the code that
|
@@ -756,16 +756,16 @@ drives it.</p>
|
|
756
756
|
</tbody>
|
757
757
|
</table></div>
|
758
758
|
</div>
|
759
|
-
<p>Flags: <a href="
|
759
|
+
<p>Flags: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
|
760
760
|
</div>
|
761
761
|
<hr>
|
762
762
|
<div class="refsect2">
|
763
763
|
<a name="GdkPixbufLoader-size-prepared"></a><h3>The <code class="literal">“size-prepared”</code> signal</h3>
|
764
764
|
<pre class="programlisting"><span class="returnvalue">void</span>
|
765
765
|
user_function (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> *loader,
|
766
|
-
<a href="
|
767
|
-
<a href="
|
768
|
-
<a href="
|
766
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width,
|
767
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height,
|
768
|
+
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
|
769
769
|
<p>This signal is emitted when the pixbuf loader has been fed the
|
770
770
|
initial amount of data that is required to figure out the size
|
771
771
|
of the image that it will create. Applications can call
|
@@ -804,7 +804,7 @@ the desired size to which the image should be scaled.</p>
|
|
804
804
|
</tbody>
|
805
805
|
</table></div>
|
806
806
|
</div>
|
807
|
-
<p>Flags: <a href="
|
807
|
+
<p>Flags: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
|
808
808
|
</div>
|
809
809
|
</div>
|
810
810
|
<div class="refsect1">
|