rmagick 7.2.0 → 7.3.0
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/CHANGELOG.md +124 -0
- data/README.md +2 -1
- data/ext/RMagick/extconf.rb +5 -2
- data/ext/RMagick/rmagick.cpp +55 -58
- data/ext/RMagick/rmagick.h +97 -55
- data/ext/RMagick/rmagick_gvl.cpp +553 -375
- data/ext/RMagick/rmagick_gvl.hpp +15 -10
- data/ext/RMagick/rmdraw.cpp +654 -277
- data/ext/RMagick/rmenum.cpp +59 -19
- data/ext/RMagick/rmfill.cpp +131 -40
- data/ext/RMagick/rmilist.cpp +316 -166
- data/ext/RMagick/rmimage.cpp +2519 -1051
- data/ext/RMagick/rminfo.cpp +250 -107
- data/ext/RMagick/rmkinfo.cpp +87 -29
- data/ext/RMagick/rmmain.cpp +742 -571
- data/ext/RMagick/rmmontage.cpp +121 -46
- data/ext/RMagick/rmpixel.cpp +108 -108
- data/ext/RMagick/rmstruct.cpp +147 -98
- data/ext/RMagick/rmutil.cpp +386 -95
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +69 -19
- data/sig/rmagick/_image_common_methods.rbs +1 -1
- data/sig/rmagick/enum.rbs +2 -0
- data/sig/rmagick/image.rbs +1 -0
- data/sig/rmagick/image_list.rbs +1 -0
- data/sig/rmagick/optional_method_arguments.rbs +1 -1
- metadata +2 -2
data/lib/rmagick/version.rb
CHANGED
data/lib/rmagick_internal.rb
CHANGED
|
@@ -53,6 +53,41 @@ module Magick
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
class Enum
|
|
57
|
+
def dup
|
|
58
|
+
self
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def clone(freeze: nil)
|
|
62
|
+
raise ArgumentError, "unexpected value for freeze: #{freeze.class}" unless [nil, true, false].include?(freeze)
|
|
63
|
+
raise ArgumentError, "can't unfreeze #{self.class}" if freeze == false
|
|
64
|
+
|
|
65
|
+
self
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Info and Montage cannot be frozen, as their #freeze raises TypeError, so
|
|
70
|
+
# clone(freeze: true) must not make a frozen copy of them either.
|
|
71
|
+
class Image
|
|
72
|
+
class Info
|
|
73
|
+
def clone(freeze: nil)
|
|
74
|
+
raise TypeError, "can't freeze #{self.class}" if freeze == true
|
|
75
|
+
|
|
76
|
+
super
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class ImageList
|
|
82
|
+
class Montage
|
|
83
|
+
def clone(freeze: nil)
|
|
84
|
+
raise TypeError, "can't freeze #{self.class}" if freeze == true
|
|
85
|
+
|
|
86
|
+
super
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
56
91
|
# Geometry class and related enum constants
|
|
57
92
|
class GeometryValue < Enum
|
|
58
93
|
# no methods
|
|
@@ -215,15 +250,22 @@ module Magick
|
|
|
215
250
|
|
|
216
251
|
private
|
|
217
252
|
|
|
218
|
-
|
|
219
|
-
|
|
253
|
+
# Escape backslashes and return the value as bytes, plus its original
|
|
254
|
+
# encoding. ImageMagick's MVG tokenizer reads the value byte by byte, so in
|
|
255
|
+
# Shift_JIS, Big5 and similar encodings a trail byte equal to a delimiter
|
|
256
|
+
# would slip past a per-character escape and close the token.
|
|
257
|
+
def escape_mvg_bytes(str)
|
|
220
258
|
# escape existing backslashes, so that they cannot escape the delimiter
|
|
221
|
-
# added
|
|
222
|
-
str
|
|
259
|
+
# added by the caller and let the rest of the string be parsed as MVG
|
|
260
|
+
[str.b.gsub('\\') { |b| '\\' + b }, str.encoding]
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def enquote(str)
|
|
264
|
+
str, encoding = escape_mvg_bytes(to_string(str))
|
|
223
265
|
if str.length > 2 && /\A(?:"[^"\\]+"|'[^'\\]+'|\{[^}\\]+\})\z/.match(str)
|
|
224
|
-
str
|
|
266
|
+
str.force_encoding(encoding)
|
|
225
267
|
else
|
|
226
|
-
'"' + str.gsub('"') { |c| '\\' + c } + '"'
|
|
268
|
+
('"' + str.gsub('"') { |c| '\\' + c } + '"').force_encoding(encoding)
|
|
227
269
|
end
|
|
228
270
|
end
|
|
229
271
|
|
|
@@ -627,9 +669,7 @@ module Magick
|
|
|
627
669
|
def text(x, y, text)
|
|
628
670
|
text = to_string(text)
|
|
629
671
|
Kernel.raise ArgumentError, 'missing text argument' if text.empty?
|
|
630
|
-
|
|
631
|
-
# added below and let the rest of the string be parsed as MVG
|
|
632
|
-
text = text.gsub('\\') { |b| '\\' + b }
|
|
672
|
+
text, encoding = escape_mvg_bytes(text)
|
|
633
673
|
if text.length > 2 && /\A(?:"[^"\\]+"|'[^'\\]+'|\{[^}\\]+\})\z/.match(text)
|
|
634
674
|
# text already quoted
|
|
635
675
|
elsif !text['\'']
|
|
@@ -642,7 +682,7 @@ module Magick
|
|
|
642
682
|
# escape existing braces, surround with braces
|
|
643
683
|
text = '{' + text.gsub(/[}]/) { |b| '\\' + b } + '}'
|
|
644
684
|
end
|
|
645
|
-
primitive 'text ' + sprintf('%g,%g %s', x, y, text)
|
|
685
|
+
primitive 'text ' + sprintf('%g,%g %s', x, y, text.force_encoding(encoding))
|
|
646
686
|
end
|
|
647
687
|
|
|
648
688
|
# Specify text alignment relative to a given point
|
|
@@ -871,9 +911,13 @@ module Magick
|
|
|
871
911
|
hash[tag] = value
|
|
872
912
|
end
|
|
873
913
|
else
|
|
874
|
-
|
|
914
|
+
values = {}
|
|
915
|
+
self['EXIF:!']&.split("\n")&.each do |exif|
|
|
916
|
+
name, value = exif.split('=', 2)
|
|
917
|
+
values[name.downcase] = value
|
|
918
|
+
end
|
|
875
919
|
tag.each do |num|
|
|
876
|
-
rval =
|
|
920
|
+
rval = values[sprintf('#%04x', num.to_i)]
|
|
877
921
|
hash[num] = rval == 'unknown' ? nil : rval
|
|
878
922
|
end
|
|
879
923
|
end
|
|
@@ -1606,9 +1650,9 @@ module Magick
|
|
|
1606
1650
|
end
|
|
1607
1651
|
|
|
1608
1652
|
def marshal_load(ary)
|
|
1609
|
-
|
|
1610
|
-
@
|
|
1611
|
-
|
|
1653
|
+
images = ary.drop(1).map! { |a| Marshal.load(a) } # rubocop:disable Security/MarshalLoad
|
|
1654
|
+
@scene = ary.first
|
|
1655
|
+
@images = images
|
|
1612
1656
|
end
|
|
1613
1657
|
|
|
1614
1658
|
# The ImageList class supports the Magick::Image class methods by simply sending
|
|
@@ -1831,16 +1875,22 @@ module Magick
|
|
|
1831
1875
|
class OptionalMethodArguments
|
|
1832
1876
|
def initialize(img)
|
|
1833
1877
|
@img = img
|
|
1878
|
+
@artifacts = {}
|
|
1834
1879
|
end
|
|
1835
1880
|
|
|
1836
1881
|
# miscellaneous options like -verbose
|
|
1837
1882
|
def method_missing(mth, val)
|
|
1838
|
-
|
|
1883
|
+
define(mth.to_s.tr('_', '-'), val)
|
|
1839
1884
|
end
|
|
1840
1885
|
|
|
1841
1886
|
# set(key, val) corresponds to -set option:key val
|
|
1842
1887
|
def define(key, val = nil)
|
|
1843
|
-
|
|
1888
|
+
key = -String(key)
|
|
1889
|
+
val = -String(val) unless val.nil?
|
|
1890
|
+
raise ArgumentError, 'string contains null byte' if key.include?("\0") || val&.include?("\0")
|
|
1891
|
+
|
|
1892
|
+
@artifacts[key] = val
|
|
1893
|
+
val
|
|
1844
1894
|
end
|
|
1845
1895
|
|
|
1846
1896
|
# accepts Pixel object or color name
|
|
@@ -1861,9 +1911,9 @@ module Magick
|
|
|
1861
1911
|
else
|
|
1862
1912
|
String.try_convert(color) || raise(TypeError, "argument must be color name or pixel (#{color.class} given)")
|
|
1863
1913
|
end
|
|
1864
|
-
|
|
1914
|
+
define("compare:#{name}", color)
|
|
1865
1915
|
# ImageMagick 6.9.6-0 and older read the name without the "compare:" prefix.
|
|
1866
|
-
|
|
1916
|
+
define(name, color)
|
|
1867
1917
|
end
|
|
1868
1918
|
end
|
|
1869
1919
|
|
|
@@ -225,7 +225,7 @@ module Magick
|
|
|
225
225
|
def cycle_colormap: (int amount) -> Image
|
|
226
226
|
def decipher: (string passphrase) -> Image
|
|
227
227
|
def define: (interned artifact, (string | Numeric)? value) -> String?
|
|
228
|
-
def deskew: (?magick_percentage threshold, ?int auto_crop_width) -> Image
|
|
228
|
+
def deskew: (?magick_percentage threshold, ?(int | bool | nil) auto_crop_width) -> Image
|
|
229
229
|
def delete_compose_mask: () -> self
|
|
230
230
|
def delete_profile: (string name) -> self
|
|
231
231
|
def despeckle: () -> Image
|
data/sig/rmagick/enum.rbs
CHANGED
data/sig/rmagick/image.rbs
CHANGED
|
@@ -92,6 +92,7 @@ module Magick
|
|
|
92
92
|
|
|
93
93
|
class Info
|
|
94
94
|
def initialize: () -> void
|
|
95
|
+
def clone: (?freeze: bool?) -> Info
|
|
95
96
|
def channel: (*ChannelType channel) -> self
|
|
96
97
|
def define: (string format, string key, ?string value) -> self?
|
|
97
98
|
def []=: (string format, string key, string value) -> self?
|
data/sig/rmagick/image_list.rbs
CHANGED
|
@@ -6,7 +6,7 @@ module Magick
|
|
|
6
6
|
attr_writer lowlight_color: magick_color
|
|
7
7
|
|
|
8
8
|
def initialize: (magick_image img) -> void
|
|
9
|
-
def define: (
|
|
9
|
+
def define: (interned key, ?(string | Numeric)? value) -> String?
|
|
10
10
|
def method_missing: (untyped mth, untyped val) ?{ (*untyped, **untyped) -> untyped } -> untyped
|
|
11
11
|
end
|
|
12
12
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rmagick
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Hunter
|
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
145
145
|
version: '0'
|
|
146
146
|
requirements:
|
|
147
147
|
- ImageMagick 6.9.0+ (for ImageMagick 6) or 7.1.0+ (for ImageMagick 7)
|
|
148
|
-
rubygems_version: 4.0.
|
|
148
|
+
rubygems_version: 4.0.24
|
|
149
149
|
specification_version: 4
|
|
150
150
|
summary: Ruby binding to ImageMagick
|
|
151
151
|
test_files: []
|