gdk_pixbuf2 3.0.8-x64-mingw32 → 3.0.9-x64-mingw32
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.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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dddcd4aec62a5028fefe4704e15771b52f4ee4f
|
4
|
+
data.tar.gz: d49df43d873fad244b108cf2ceea5a4015cea293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ccf457226a9758adf73908df5aba024c6cfad271178bbbd6e77011a00d5ec205adc6146309b70a16504f39fad7b2581651bab649eaf784eb32835c2d18f1c1
|
7
|
+
data.tar.gz: d3002616069bcf3039d414b7bbc0e247e9d0128fd41b6b9537b5a1c7f55a5353e1a252afe097015e0739a9cf34e34ef78108fd0375d9ee109749e189db398459
|
data/Rakefile
CHANGED
data/lib/gdk_pixbuf2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2016 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
|
@@ -14,80 +14,22 @@
|
|
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 "
|
17
|
+
require "gobject-introspection"
|
18
|
+
require "gio2"
|
18
19
|
|
19
20
|
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
|
20
21
|
vendor_dir = base_dir + "vendor" + "local"
|
21
22
|
vendor_bin_dir = vendor_dir + "bin"
|
22
23
|
GLib.prepend_dll_path(vendor_bin_dir)
|
24
|
+
vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
|
25
|
+
GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
|
23
26
|
|
24
|
-
|
25
|
-
require "cairo"
|
26
|
-
end
|
27
|
+
require "gdk_pixbuf2/loader"
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
rescue LoadError
|
32
|
-
require "gdk_pixbuf2.so"
|
33
|
-
end
|
29
|
+
module GdkPixbuf
|
30
|
+
LOG_DOMAIN = "GdkPixbuf"
|
31
|
+
GLib::Log.set_log_domain(LOG_DOMAIN)
|
34
32
|
|
35
|
-
|
36
|
-
|
37
|
-
require "gobject-introspection"
|
38
|
-
vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
|
39
|
-
GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
|
40
|
-
rescue LoadError
|
41
|
-
end
|
33
|
+
loader = Loader.new(self)
|
34
|
+
loader.load("GdkPixbuf")
|
42
35
|
end
|
43
|
-
|
44
|
-
module Gdk
|
45
|
-
class PixbufLoader
|
46
|
-
def self.open(type = nil, mime_type = false)
|
47
|
-
loader = Gdk::PixbufLoader.new(type, mime_type)
|
48
|
-
if block_given?
|
49
|
-
begin
|
50
|
-
yield(loader)
|
51
|
-
ensure
|
52
|
-
loader.close
|
53
|
-
end
|
54
|
-
end
|
55
|
-
loader
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Pixbuf
|
60
|
-
LOG_DOMAIN = "GdkPixbuf"
|
61
|
-
|
62
|
-
class << self
|
63
|
-
def cairo_available?
|
64
|
-
if Gdk.respond_to?(:cairo_available?)
|
65
|
-
Gdk.cairo_available?
|
66
|
-
else
|
67
|
-
false
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
module Version
|
73
|
-
MAJOR = Gdk::Pixbuf::MAJOR
|
74
|
-
MINOR = Gdk::Pixbuf::MINOR
|
75
|
-
MICRO = Gdk::Pixbuf::MICRO
|
76
|
-
STRING = "#{MAJOR}.#{MINOR}.#{MICRO}"
|
77
|
-
|
78
|
-
class << self
|
79
|
-
def or_later?(major, minor, micro=nil)
|
80
|
-
micro ||= 0
|
81
|
-
version = [
|
82
|
-
MAJOR,
|
83
|
-
MINOR,
|
84
|
-
MICRO,
|
85
|
-
]
|
86
|
-
(version <=> [major, minor, micro]) >= 0
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
GLib::Log.set_log_domain(Gdk::Pixbuf::LOG_DOMAIN)
|
@@ -0,0 +1,160 @@
|
|
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
|
+
module GdkPixbuf
|
18
|
+
class Pixbuf
|
19
|
+
extend GLib::Deprecatable
|
20
|
+
|
21
|
+
define_deprecated_enums "Colorspace", "COLORSPACE"
|
22
|
+
define_deprecated_enums "InterpType", "INTERP"
|
23
|
+
define_deprecated_enums "PixbufRotation", "ROTATE"
|
24
|
+
|
25
|
+
class << self
|
26
|
+
def new(*args, &block)
|
27
|
+
if args[0].is_a?(Pixbuf)
|
28
|
+
message = "#{caller[0]}: #{self}.new(pixbuf, ...) is deprecated. "
|
29
|
+
message << "Use pixbuf.new_subpixbuf(...) instead."
|
30
|
+
warn(message)
|
31
|
+
args[0].new_subpixbuf(*args[1..-1])
|
32
|
+
elsif args.size == 1 and args[0].is_a?(Hash)
|
33
|
+
options = args[0]
|
34
|
+
src_pixbuf = options[:src_pixbuf]
|
35
|
+
if src_pixbuf
|
36
|
+
message = "#{caller[0]}: "
|
37
|
+
message << "#{self}.new(:src_pixbuf => pixbuf, ...) is deprecated. "
|
38
|
+
message << "Use pixbuf.new_subpixbuf(...) instead."
|
39
|
+
warn(message)
|
40
|
+
src_pixbuf.new_subpixbuf(options[:src_x],
|
41
|
+
options[:src_y],
|
42
|
+
options[:width],
|
43
|
+
options[:height])
|
44
|
+
else
|
45
|
+
super
|
46
|
+
end
|
47
|
+
else
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
define_deprecated_method_by_hash_args :composite,
|
54
|
+
"dest_width, " +
|
55
|
+
"dest_height, " +
|
56
|
+
"interpolation_type, " +
|
57
|
+
"overall_alpha, " +
|
58
|
+
"check_size, " +
|
59
|
+
"color1, " +
|
60
|
+
"color2",
|
61
|
+
":dest_width => dest_width, " +
|
62
|
+
":dest_height => dest_height, " +
|
63
|
+
":interpolation_type => interpolation_type, " +
|
64
|
+
":overall_alpha => overall_alpha, " +
|
65
|
+
":check_size => check_size, " +
|
66
|
+
":color1 => color1, " +
|
67
|
+
":color2 => color2" do |*args|
|
68
|
+
[
|
69
|
+
:dest_width => args[1],
|
70
|
+
:dest_height => args[2],
|
71
|
+
:interpolation_type => args[3],
|
72
|
+
:overall_alpha => args[4],
|
73
|
+
:check_size => args[5],
|
74
|
+
:color1 => args[6],
|
75
|
+
:color2 => args[7],
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
define_deprecated_method_by_hash_args :composite!,
|
80
|
+
"source, " +
|
81
|
+
"dest_x, " +
|
82
|
+
"dest_y, " +
|
83
|
+
"dest_width, " +
|
84
|
+
"dest_height, " +
|
85
|
+
"offset_x, " +
|
86
|
+
"offset_y, " +
|
87
|
+
"scale_x, " +
|
88
|
+
"scale_y, " +
|
89
|
+
"interpolation_type, " +
|
90
|
+
"overall_alpha, " +
|
91
|
+
"check_x=0, " +
|
92
|
+
"check_y=0, " +
|
93
|
+
"check_size=nil, " +
|
94
|
+
"color1=0x999999, " +
|
95
|
+
"color2=0xdddddd",
|
96
|
+
"source, " +
|
97
|
+
":dest_x => dest_x, " +
|
98
|
+
":dest_y => dest_y, " +
|
99
|
+
":dest_width => dest_width, " +
|
100
|
+
":dest_height => dest_height, " +
|
101
|
+
":offset_x => offset_x, " +
|
102
|
+
":offset_y => offset_y, " +
|
103
|
+
":scale_x => scale_x, " +
|
104
|
+
":scale_y => scale_y, " +
|
105
|
+
":interpolation_type => interpolation_type, " +
|
106
|
+
":overall_alpha => overall_alpha, " +
|
107
|
+
":check_x => check_x, " +
|
108
|
+
":check_y => check_y, " +
|
109
|
+
":check_size => check_size, " +
|
110
|
+
":color1 => color1, " +
|
111
|
+
":color2 => color2",
|
112
|
+
1 do |*args|
|
113
|
+
[
|
114
|
+
args[1],
|
115
|
+
:dest_x => args[2],
|
116
|
+
:dest_y => args[3],
|
117
|
+
:dest_width => args[4],
|
118
|
+
:dest_height => args[5],
|
119
|
+
:offset_x => args[6],
|
120
|
+
:offset_y => args[7],
|
121
|
+
:scale_x => args[8],
|
122
|
+
:scale_y => args[9],
|
123
|
+
:interpolation_type => args[10],
|
124
|
+
:overall_alpha => args[11],
|
125
|
+
:check_x => args[12],
|
126
|
+
:check_y => args[13],
|
127
|
+
:check_size => args[14],
|
128
|
+
:color1 => args[15],
|
129
|
+
:color2 => args[16],
|
130
|
+
]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
class PixbufFormat
|
135
|
+
extend GLib::Deprecatable
|
136
|
+
|
137
|
+
define_deprecated_method "domain", :raise => "Don't use this method anymore."
|
138
|
+
define_deprecated_method "signature", :raise => "Don't use this method anymore."
|
139
|
+
end
|
140
|
+
|
141
|
+
class Pixdata
|
142
|
+
extend GLib::Deprecatable
|
143
|
+
|
144
|
+
unless respond_to?(:from_pixbuf)
|
145
|
+
define_deprecated_singleton_method :from_pixbuf,
|
146
|
+
:raise => "Use Gio::Resource instead"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
module Gdk
|
152
|
+
extend GLib::Deprecatable
|
153
|
+
|
154
|
+
define_deprecated_const :Pixbuf, "GdkPixbuf::Pixbuf"
|
155
|
+
define_deprecated_const :PixbufAnimation, "GdkPixbuf::PixbufAnimation"
|
156
|
+
define_deprecated_const :PixbufLoader, "GdkPixbuf::PixbufLoader"
|
157
|
+
define_deprecated_const :PixbufSimpleAnim, "GdkPixbuf::PixbufSimpleAnim"
|
158
|
+
define_deprecated_const :Pixdata, "GdkPixbuf::Pixdata"
|
159
|
+
define_deprecated_const :PixbufError, "GdkPixbuf::PixbufError"
|
160
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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
|
+
require "English"
|
18
|
+
|
19
|
+
module GdkPixbuf
|
20
|
+
class Loader < GObjectIntrospection::Loader
|
21
|
+
private
|
22
|
+
def pre_load(repository, namespace)
|
23
|
+
end
|
24
|
+
|
25
|
+
def post_load(repository, namespace)
|
26
|
+
require_libraries
|
27
|
+
end
|
28
|
+
|
29
|
+
def require_libraries
|
30
|
+
require "gdk_pixbuf2/pixbuf"
|
31
|
+
require "gdk_pixbuf2/pixbuf-loader"
|
32
|
+
|
33
|
+
require "gdk_pixbuf2/deprecated"
|
34
|
+
|
35
|
+
require "gdk_pixbuf2/version"
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize_post(object)
|
39
|
+
super
|
40
|
+
return unless object.is_a?(GLib::Object)
|
41
|
+
self.class.reference_gobject(object, :sink => true)
|
42
|
+
end
|
43
|
+
|
44
|
+
def define_constant(name, info)
|
45
|
+
if /PIXBUF_/ =~ name
|
46
|
+
name = $POSTMATCH
|
47
|
+
end
|
48
|
+
super(name, info)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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
|
+
module GdkPixbuf
|
18
|
+
class PixbufLoader
|
19
|
+
def last_write(data)
|
20
|
+
write(data)
|
21
|
+
close
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,282 @@
|
|
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
|
+
module GdkPixbuf
|
18
|
+
class Pixbuf
|
19
|
+
alias_method :initialize_raw, :initialize
|
20
|
+
|
21
|
+
def initialize(*args)
|
22
|
+
case args.size
|
23
|
+
when 1
|
24
|
+
case args[0]
|
25
|
+
when Hash
|
26
|
+
initialize_with_hash(args[0])
|
27
|
+
when String
|
28
|
+
message = "#{caller[0]}: #{self.class}.new(path) is deprecated. "
|
29
|
+
message << "Use #{self.class}.new(:file => path) instead."
|
30
|
+
warn message
|
31
|
+
initialize_raw(args[0])
|
32
|
+
when Array
|
33
|
+
message = "#{caller[0]}: #{self.class}.new(xpm) is deprecated. "
|
34
|
+
message << "Use #{self.class}.new(:xpm => xpm) instead."
|
35
|
+
warn message
|
36
|
+
initialize_new_from_xpm_data(args[0])
|
37
|
+
else
|
38
|
+
raise ArgumentError, "must be options: #{args[0].inspect}"
|
39
|
+
end
|
40
|
+
when 2
|
41
|
+
message = "#{caller[0]}: "
|
42
|
+
message << "#{self.class}.new(data, copy_pixels) is deprecated. "
|
43
|
+
message << "Use Gio::Resource instead."
|
44
|
+
warn message
|
45
|
+
initialize_from_inline(*args)
|
46
|
+
when 3
|
47
|
+
message = "#{caller[0]}: "
|
48
|
+
message << "#{self.class}.new(path, width, height) is deprecated. "
|
49
|
+
message << "Use #{self.class}.new(:file => path, :width => width, "
|
50
|
+
message << ":height => height) instead."
|
51
|
+
warn message
|
52
|
+
initialize_new_from_file_at_size(*args)
|
53
|
+
when 4
|
54
|
+
message = "#{caller[0]}: "
|
55
|
+
message << "#{self.class}.new(path, width, height, "
|
56
|
+
message << "preserve_aspect_ratio) is deprecated. "
|
57
|
+
message << "Use #{self.class}.new(:file => path, :width => width, "
|
58
|
+
message << ":height => height, "
|
59
|
+
message << ":preserve_aspect_ratio => preserve_aspect_ratio) instead."
|
60
|
+
warn message
|
61
|
+
initialize_new_from_file_at_scale(*args)
|
62
|
+
when 5
|
63
|
+
message = "#{caller[0]}: "
|
64
|
+
message << "#{self.class}.new(colorspace, has_alpha, bits_per_sample, "
|
65
|
+
message << "width, height) is deprecated."
|
66
|
+
message << "Use #{self.class}.new(:colorspace => colorspace, "
|
67
|
+
message << ":has_alpha => has_alpha, "
|
68
|
+
message << ":bits_per_sample => bits_per_sample, "
|
69
|
+
message << ":width => width, "
|
70
|
+
message << ":height => height) instead."
|
71
|
+
warn message
|
72
|
+
initialize_new(*args)
|
73
|
+
when 7
|
74
|
+
message = "#{caller[0]}: "
|
75
|
+
message << "#{self.class}.new(data, colorspace, has_alpha, "
|
76
|
+
message << "bits_per_sample, width, height) is deprecated."
|
77
|
+
message << "Use #{self.class}.new(:data => data, "
|
78
|
+
message << ":colorspace => colorspace, "
|
79
|
+
message << ":has_alpha => has_alpha, "
|
80
|
+
message << ":bits_per_sample => bits_per_sample, "
|
81
|
+
message << ":width => width, "
|
82
|
+
message << ":height => height) instead."
|
83
|
+
warn message
|
84
|
+
initialize_new_from_data(*args)
|
85
|
+
else
|
86
|
+
super
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def initialize_with_hash(options)
|
91
|
+
colorspace = options[:colorspace] || GdkPixbuf::Colorspace::RGB
|
92
|
+
has_alpha = options[:has_alpha]
|
93
|
+
has_alpha = false if has_alpha.nil?
|
94
|
+
bits_per_sample = options[:bits_per_sample] || 8
|
95
|
+
row_stride = options[:row_stride] || 0
|
96
|
+
data = options[:data] || nil
|
97
|
+
bytes = options[:bytes] || nil
|
98
|
+
xpm = options[:xpm] || nil
|
99
|
+
file = options[:file] || nil
|
100
|
+
# stream = options[:stream] || nil
|
101
|
+
resource = options[:resource] || nil
|
102
|
+
width = options[:width] || nil
|
103
|
+
height = options[:height] || nil
|
104
|
+
size = true if width && height
|
105
|
+
scale = options[:scale] || nil
|
106
|
+
preserve_aspect_ratio = options[:preserve_aspect_ratio]
|
107
|
+
preserve_aspect_ratio = true if preserve_aspect_ratio.nil?
|
108
|
+
|
109
|
+
if file && size && scale
|
110
|
+
initialize_new_from_file_at_scale(file, width, height,
|
111
|
+
preserve_aspect_ratio)
|
112
|
+
elsif file && size && !scale
|
113
|
+
initialize_new_from_file_at_size(file, width, height)
|
114
|
+
elsif file && !size
|
115
|
+
initialize_new_from_file(file)
|
116
|
+
elsif resource && size && scale
|
117
|
+
initialize_new_from_resource_at_scale(resource, width, height,
|
118
|
+
preserve_aspect_ratio)
|
119
|
+
elsif resource && !scale
|
120
|
+
initialize_new_from_resource(resource)
|
121
|
+
elsif data && size
|
122
|
+
initialize_new_from_data(data, colorspace, has_alpha, bits_per_sample,
|
123
|
+
width, height, row_stride)
|
124
|
+
elsif bytes && size
|
125
|
+
initialize_new_from_bytes(bytes, colorspace, has_alpha, bits_per_sample,
|
126
|
+
width, height, row_stride)
|
127
|
+
|
128
|
+
elsif xpm
|
129
|
+
initialize_new_from_xpm_data(xpm)
|
130
|
+
elsif size
|
131
|
+
initialize_raw(colorspace, has_alpha, bits_per_sample, width, height)
|
132
|
+
else
|
133
|
+
message =
|
134
|
+
"must specify :file, :resource, :data, :bytes, :xpm, :width or :height"
|
135
|
+
raise ArgumentError, message
|
136
|
+
end
|
137
|
+
# https://developer.gnome.org/gdk-pixbuf/2.33/gdk-pixbuf-Image-Data-in-Memory.html
|
138
|
+
# gdk_pixbuf_new done
|
139
|
+
# gdk_pixbuf_new_from_bytes done
|
140
|
+
# gdk_pixbuf_new_from_data done
|
141
|
+
# gdk_pixbuf_new_from_xpm_data done
|
142
|
+
# gdk_pixbuf_new_subpixbuf
|
143
|
+
# https://developer.gnome.org/gdk-pixbuf/2.33/gdk-pixbuf-File-Loading.html
|
144
|
+
# gdk_pixbuf_new_from_file done
|
145
|
+
# gdk_pixbuf_new_from_file_at_size done
|
146
|
+
# gdk_pixbuf_new_from_file_at_scale done
|
147
|
+
# gdk_pixbuf_get_file_info
|
148
|
+
# gdk_pixbuf_get_file_info_async
|
149
|
+
# gdk_pixbuf_get_file_info_finish
|
150
|
+
# gdk_pixbuf_new_from_resource done
|
151
|
+
# gdk_pixbuf_new_from_resource_at_scale done
|
152
|
+
# gdk_pixbuf_new_from_stream
|
153
|
+
# gdk_pixbuf_new_from_stream_async
|
154
|
+
# gdk_pixbuf_new_from_stream_finish
|
155
|
+
# gdk_pixbuf_new_from_stream_at_scale
|
156
|
+
# gdk_pixbuf_new_from_stream_at_scale_async
|
157
|
+
end
|
158
|
+
private :initialize_with_hash
|
159
|
+
|
160
|
+
def dup
|
161
|
+
copy
|
162
|
+
end
|
163
|
+
|
164
|
+
def fill!(pixel)
|
165
|
+
fill(pixel)
|
166
|
+
end
|
167
|
+
|
168
|
+
def rotate(angle)
|
169
|
+
rotate_simple(angle)
|
170
|
+
end
|
171
|
+
|
172
|
+
alias_method :saturate_and_pixelate_raw, :saturate_and_pixelate
|
173
|
+
def saturate_and_pixelate(saturation, pixelate)
|
174
|
+
dest = dup
|
175
|
+
saturate_and_pixelate_raw(dest, saturation, pixelate)
|
176
|
+
dest
|
177
|
+
end
|
178
|
+
|
179
|
+
# TODO: test
|
180
|
+
# TODO: Improve API by Hash
|
181
|
+
def save(filename, type, options={})
|
182
|
+
keys = []
|
183
|
+
values = []
|
184
|
+
options.each do |key, value|
|
185
|
+
keys << key
|
186
|
+
values << value
|
187
|
+
end
|
188
|
+
savev(filename, type, keys, values)
|
189
|
+
end
|
190
|
+
|
191
|
+
alias_method :scale_raw, :scale
|
192
|
+
# TODO: test
|
193
|
+
# TODO: Improve API by Hash
|
194
|
+
def scale(*args)
|
195
|
+
case args.size
|
196
|
+
when 2, 3
|
197
|
+
width, height, interp_type = args
|
198
|
+
interp_type ||= :bilinear
|
199
|
+
scale_simple(width, height, interp_type)
|
200
|
+
else
|
201
|
+
scale_raw(*args)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# TODO: test
|
206
|
+
# TODO: Improve API by Hash
|
207
|
+
def scale!(source, *args)
|
208
|
+
if args.size == 8
|
209
|
+
args << :bilinear
|
210
|
+
end
|
211
|
+
source.scale_raw(self, *args)
|
212
|
+
end
|
213
|
+
|
214
|
+
alias_method :composite_raw, :composite
|
215
|
+
def composite(options)
|
216
|
+
destination = options[:destination] || options[:dest]
|
217
|
+
dest_x = options[:destination_x] || options[:dest_x] || 0
|
218
|
+
dest_y = options[:destination_y] || options[:dest_y] || 0
|
219
|
+
dest_width = options[:destination_width] || options[:dest_width]
|
220
|
+
dest_height = options[:destination_height] || options[:dest_height]
|
221
|
+
|
222
|
+
destination ||= Pixbuf.new(colorspace,
|
223
|
+
has_alpha?,
|
224
|
+
bits_per_sample,
|
225
|
+
dest_x + dest_width,
|
226
|
+
dest_y + dest_height)
|
227
|
+
destination.composite!(self, options)
|
228
|
+
destination
|
229
|
+
end
|
230
|
+
|
231
|
+
def composite!(source, options)
|
232
|
+
dest_x = options[:destination_x] || options[:dest_x] || 0
|
233
|
+
dest_y = options[:destination_y] || options[:dest_y] || 0
|
234
|
+
dest_width = options[:destination_width] || options[:dest_width]
|
235
|
+
dest_height = options[:destination_height] || options[:dest_height]
|
236
|
+
offset_x = options[:offset_x] || 0.0
|
237
|
+
offset_y = options[:offset_y] || 0.0
|
238
|
+
scale_x = options[:scale_x] || (dest_width / source.width.to_f)
|
239
|
+
scale_y = options[:scale_y] || (dest_height / source.height.to_f)
|
240
|
+
interpolation_type = options[:interpolation_type] ||
|
241
|
+
options[:interp_type] ||
|
242
|
+
:bilinear
|
243
|
+
overall_alpha = options[:overall_alpha] || 255
|
244
|
+
check_x = options[:check_x] || 0
|
245
|
+
check_y = options[:check_y] || 0
|
246
|
+
check_size = options[:check_size]
|
247
|
+
color1 = options[:color1] || 0x999999
|
248
|
+
color2 = options[:color2] || 0xdddddd
|
249
|
+
|
250
|
+
if check_size
|
251
|
+
source.composite_color(self,
|
252
|
+
dest_x,
|
253
|
+
dest_y,
|
254
|
+
dest_width,
|
255
|
+
dest_height,
|
256
|
+
offset_x,
|
257
|
+
offset_y,
|
258
|
+
scale_x,
|
259
|
+
scale_y,
|
260
|
+
interpolation_type,
|
261
|
+
overall_alpha,
|
262
|
+
check_x,
|
263
|
+
check_y,
|
264
|
+
check_size,
|
265
|
+
color1,
|
266
|
+
color2)
|
267
|
+
else
|
268
|
+
source.composite_raw(self,
|
269
|
+
dest_x,
|
270
|
+
dest_y,
|
271
|
+
dest_width,
|
272
|
+
dest_height,
|
273
|
+
offset_x,
|
274
|
+
offset_y,
|
275
|
+
scale_x,
|
276
|
+
scale_y,
|
277
|
+
interpolation_type,
|
278
|
+
overall_alpha)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|