gdk_pixbuf2 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/gdk_pixbuf2/deprecated.rb +3 -1
- data/lib/gdk_pixbuf2/pixbuf.rb +59 -5
- data/test/gdk_pixbuf2-test-utils.rb +11 -0
- data/test/test-pixbuf.rb +61 -15
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 703907114f5eacaca3578ef3be917cddf90724bf
|
4
|
+
data.tar.gz: 754f7ee7196d109a88c78d546aee27e15554f806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d53df6a3f4ce451e0567e7abcd1eb1f173bd5d1198aeba98c29b5094c95b75048d6d958052d87448465f47e4856795376c3ecc680a7cac51e93e1090591f0e7
|
7
|
+
data.tar.gz: 74c95e217eb438f8ed94081d25b964f4c75a3dbd0d446a8f6fe7ae611c3bc09f8ef60c3cb3216bf2e9638bbc03d11ea07f04192e4fce5f339a24b22db6fd0127
|
data/Rakefile
CHANGED
@@ -36,7 +36,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
36
36
|
:name => "gdk-pixbuf",
|
37
37
|
:download_site => :gnome,
|
38
38
|
:label => "gdk-pixbuf",
|
39
|
-
:version => "2.36.
|
39
|
+
:version => "2.36.4",
|
40
40
|
:compression_method => "xz",
|
41
41
|
:windows => {
|
42
42
|
:configure_args => [
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2016-2017 Ruby-GNOME2 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
|
@@ -50,6 +50,8 @@ module GdkPixbuf
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
define_deprecated_method :save_to_buffer, :save
|
54
|
+
|
53
55
|
define_deprecated_method_by_hash_args :composite,
|
54
56
|
"dest_width, " +
|
55
57
|
"dest_height, " +
|
data/lib/gdk_pixbuf2/pixbuf.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2016-2017 Ruby-GNOME2 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
|
@@ -189,16 +189,70 @@ module GdkPixbuf
|
|
189
189
|
dest
|
190
190
|
end
|
191
191
|
|
192
|
-
#
|
193
|
-
#
|
194
|
-
|
192
|
+
# @overload save(type, options={})
|
193
|
+
#
|
194
|
+
# Save as `type` format.
|
195
|
+
#
|
196
|
+
# @param type [String] The format to be saved. `"jpeg"`,
|
197
|
+
# `"png"`, `"ico"` and `"bmp"` are available by default.
|
198
|
+
#
|
199
|
+
# @param options [Hash<Symbol, String>] The options for
|
200
|
+
# saving. Key-value pairs except `:filename` key are passed to
|
201
|
+
# save logic. Available keys are depended on format. For
|
202
|
+
# example, `:quality => "100"` is available in `"jpeg"`
|
203
|
+
# format.
|
204
|
+
# @option options [String] :filename The filename to be outputted.
|
205
|
+
#
|
206
|
+
# @return [String, void] The saved data. If you specify
|
207
|
+
# `:filename` option, it returns nothing.
|
208
|
+
#
|
209
|
+
# @overload save(filename, type, options={})
|
210
|
+
#
|
211
|
+
# Save to `filename` as `type` format.
|
212
|
+
#
|
213
|
+
# @return [void]
|
214
|
+
#
|
215
|
+
# @deprecated since 3.1.1. Use `save(type, :filename =>
|
216
|
+
# filename)` instead.
|
217
|
+
def save(*args)
|
218
|
+
case args.size
|
219
|
+
when 1
|
220
|
+
filename = nil
|
221
|
+
type, = args
|
222
|
+
options = {}
|
223
|
+
when 2
|
224
|
+
if args.last.is_a?(Hash)
|
225
|
+
type, options = args
|
226
|
+
if options.key?(:filename)
|
227
|
+
options = options.dup
|
228
|
+
filename = options.delete(:filename)
|
229
|
+
else
|
230
|
+
filename = nil
|
231
|
+
end
|
232
|
+
else
|
233
|
+
filename, type = args
|
234
|
+
options = {}
|
235
|
+
end
|
236
|
+
when 3
|
237
|
+
filename, type, options = args
|
238
|
+
else
|
239
|
+
message = "wrong number of arguments (given #{args.size}, expected 1..3)"
|
240
|
+
raise ArgumentError, message
|
241
|
+
end
|
242
|
+
|
195
243
|
keys = []
|
196
244
|
values = []
|
197
245
|
options.each do |key, value|
|
246
|
+
key = key.to_s if key.is_a?(Symbol)
|
198
247
|
keys << key
|
199
248
|
values << value
|
200
249
|
end
|
201
|
-
|
250
|
+
if filename
|
251
|
+
savev(filename, type, keys, values)
|
252
|
+
else
|
253
|
+
_, data = save_to_bufferv(type, keys, values)
|
254
|
+
data.pack("C*")
|
255
|
+
end
|
202
256
|
end
|
203
257
|
|
204
258
|
alias_method :scale_raw, :scale
|
@@ -14,6 +14,8 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
+
require "tempfile"
|
18
|
+
|
17
19
|
require "test-unit"
|
18
20
|
|
19
21
|
module GdkPixbufTestUtils
|
@@ -28,4 +30,13 @@ module GdkPixbufTestUtils
|
|
28
30
|
def fixture_path(*components)
|
29
31
|
File.join(File.dirname(__FILE__), "fixture", *components)
|
30
32
|
end
|
33
|
+
|
34
|
+
def suppress_warning
|
35
|
+
verbose, $VERBOSE = $VERBOSE, nil
|
36
|
+
begin
|
37
|
+
yield
|
38
|
+
ensure
|
39
|
+
$VERBOSE = verbose
|
40
|
+
end
|
41
|
+
end
|
31
42
|
end
|
data/test/test-pixbuf.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2016-2017 Ruby-GNOME2 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
|
@@ -38,6 +38,12 @@ class TestPixbuf < Test::Unit::TestCase
|
|
38
38
|
end
|
39
39
|
|
40
40
|
sub_test_case("legacy form") do
|
41
|
+
setup do |&block|
|
42
|
+
suppress_warning do
|
43
|
+
block.call
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
41
47
|
test "basic" do
|
42
48
|
colorspace = GdkPixbuf::Colorspace::RGB
|
43
49
|
width = 100
|
@@ -158,19 +164,23 @@ class TestPixbuf < Test::Unit::TestCase
|
|
158
164
|
end
|
159
165
|
|
160
166
|
test "subpixbuf" do
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
+
filename = fixture_path("gnome-logo-icon.png")
|
168
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
169
|
+
pixbuf = suppress_warning do
|
170
|
+
GdkPixbuf::Pixbuf.new(:src_pixbuf => src_pixbuf,
|
171
|
+
:src_x => 0,
|
172
|
+
:src_y => 0,
|
173
|
+
:width => 32,
|
174
|
+
:height => 32)
|
175
|
+
end
|
167
176
|
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
168
177
|
assert_equal(32, pixbuf.width)
|
169
178
|
assert_equal(32, pixbuf.height)
|
170
179
|
end
|
171
180
|
|
172
181
|
test "data" do
|
173
|
-
|
182
|
+
filename = fixture_path("gnome-logo-icon.png")
|
183
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
174
184
|
data = src_pixbuf.pixels.pack("C*")
|
175
185
|
pixbuf = GdkPixbuf::Pixbuf.new(:data => data,
|
176
186
|
:colorspace => src_pixbuf.colorspace,
|
@@ -185,7 +195,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
185
195
|
|
186
196
|
test "bytes" do
|
187
197
|
only_version(2, 32)
|
188
|
-
|
198
|
+
filename = fixture_path("gnome-logo-icon.png")
|
199
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
189
200
|
bytes = src_pixbuf.pixels.flatten.pack("C*")
|
190
201
|
pixbuf = GdkPixbuf::Pixbuf.new(:bytes => bytes,
|
191
202
|
:colorspace => src_pixbuf.colorspace,
|
@@ -199,7 +210,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
199
210
|
end
|
200
211
|
|
201
212
|
test "resource" do
|
202
|
-
|
213
|
+
filename = fixture_path("gnome-logo-icon.png")
|
214
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
203
215
|
resource = Gio::Resource.load(fixture_path("image.gresource"))
|
204
216
|
Gio::Resources.register(resource)
|
205
217
|
begin
|
@@ -238,7 +250,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
238
250
|
end
|
239
251
|
|
240
252
|
def test_new_subpixbuf
|
241
|
-
|
253
|
+
filename = fixture_path("gnome-logo-icon.png")
|
254
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
242
255
|
pixbuf = src_pixbuf.new_subpixbuf(0, 0, 32, 32)
|
243
256
|
assert_equal(GdkPixbuf::Colorspace::RGB, pixbuf.colorspace)
|
244
257
|
assert_equal(32, pixbuf.width)
|
@@ -247,7 +260,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
247
260
|
end
|
248
261
|
|
249
262
|
def test_dup
|
250
|
-
|
263
|
+
filename = fixture_path("gnome-logo-icon.png")
|
264
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
251
265
|
assert_equal(pixbuf.pixels, pixbuf.dup.pixels)
|
252
266
|
end
|
253
267
|
|
@@ -260,7 +274,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
260
274
|
end
|
261
275
|
|
262
276
|
def test_rotate
|
263
|
-
|
277
|
+
filename = fixture_path("gnome-logo-icon.png")
|
278
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
264
279
|
inverted_pixbuf = pixbuf.rotate(:upsidedown)
|
265
280
|
assert_not_equal(pixbuf.pixels, inverted_pixbuf.pixels)
|
266
281
|
inverted_twice_pixbuf = inverted_pixbuf.rotate(:upsidedown)
|
@@ -316,7 +331,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
316
331
|
end
|
317
332
|
|
318
333
|
test "no modifications" do
|
319
|
-
|
334
|
+
filename = fixture_path("gnome-logo-icon.png")
|
335
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
320
336
|
pixbuf = src_pixbuf.saturate_and_pixelate(1, false)
|
321
337
|
assert_equal(src_pixbuf.pixels, pixbuf.pixels)
|
322
338
|
end
|
@@ -325,7 +341,8 @@ class TestPixbuf < Test::Unit::TestCase
|
|
325
341
|
if /\Ai\d86-/ === RUBY_PLATFORM
|
326
342
|
omit("floating point calculation result is different on i386")
|
327
343
|
end
|
328
|
-
|
344
|
+
filename = fixture_path("gnome-logo-icon.png")
|
345
|
+
src_pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
|
329
346
|
pixbuf = src_pixbuf.saturate_and_pixelate(0, true)
|
330
347
|
ref = saturate_and_pixelate_pixels(src_pixbuf, 0, true)
|
331
348
|
assert_equal(ref, pixbuf.pixels, ref.size)
|
@@ -334,4 +351,33 @@ class TestPixbuf < Test::Unit::TestCase
|
|
334
351
|
assert_equal(ref, pixbuf.pixels)
|
335
352
|
end
|
336
353
|
end
|
354
|
+
|
355
|
+
sub_test_case("#save") do
|
356
|
+
test("no options") do
|
357
|
+
png_filename = fixture_path("gnome-logo-icon.png")
|
358
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => png_filename)
|
359
|
+
jpeg = pixbuf.save("jpeg")
|
360
|
+
assert_equal(["image/jpeg", false],
|
361
|
+
Gio::ContentType.guess(nil, jpeg))
|
362
|
+
end
|
363
|
+
|
364
|
+
test(":filename") do
|
365
|
+
png_filename = fixture_path("gnome-logo-icon.png")
|
366
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => png_filename)
|
367
|
+
output = Tempfile.new(["pixbuf", ".jpeg"])
|
368
|
+
pixbuf.save(output.path, "jpeg")
|
369
|
+
assert_equal(["image/jpeg", false],
|
370
|
+
Gio::ContentType.guess(nil, output.read))
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
test("#save_to_buffer") do
|
375
|
+
png_filename = fixture_path("gnome-logo-icon.png")
|
376
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => png_filename)
|
377
|
+
jpeg = suppress_warning do
|
378
|
+
pixbuf.save_to_buffer("jpeg")
|
379
|
+
end
|
380
|
+
assert_equal(["image/jpeg", false],
|
381
|
+
Gio::ContentType.guess(nil, jpeg))
|
382
|
+
end
|
337
383
|
end
|
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.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME2 Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-26 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.1.
|
19
|
+
version: 3.1.1
|
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.1.
|
26
|
+
version: 3.1.1
|
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: []
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.5.
|
82
|
+
rubygems_version: 2.5.2
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x.
|