rmagick 5.4.4 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +15 -0
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +16 -8
- data/CHANGELOG.md +43 -0
- data/Gemfile +20 -0
- data/Rakefile +11 -0
- data/before_install_osx.sh +1 -1
- data/ext/RMagick/extconf.rb +24 -6
- data/ext/RMagick/rmagick.h +3 -1
- data/ext/RMagick/rmdraw.cpp +10 -10
- data/ext/RMagick/rmfill.cpp +4 -4
- data/ext/RMagick/rmilist.cpp +10 -2
- data/ext/RMagick/rmimage.cpp +321 -294
- data/ext/RMagick/rminfo.cpp +22 -21
- data/ext/RMagick/rmkinfo.cpp +5 -18
- data/ext/RMagick/rmmain.cpp +30 -64
- data/ext/RMagick/rmmontage.cpp +5 -5
- data/ext/RMagick/rmpixel.cpp +1 -1
- data/ext/RMagick/rmutil.cpp +31 -71
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +67 -65
- data/lib/rvg/embellishable.rb +6 -2
- data/lib/rvg/misc.rb +7 -7
- data/lib/rvg/rvg.rb +2 -0
- data/lib/rvg/stretchable.rb +2 -2
- data/lib/rvg/transformable.rb +1 -1
- data/rmagick.gemspec +1 -13
- data/sig/rmagick/_draw_common_methods.rbs +64 -0
- data/sig/rmagick/_image_common_methods.rbs +389 -0
- data/sig/rmagick/draw.rbs +38 -0
- data/sig/rmagick/draw_attribute.rbs +28 -0
- data/sig/rmagick/enum.rbs +814 -0
- data/sig/rmagick/error.rbs +11 -0
- data/sig/rmagick/fill.rbs +21 -0
- data/sig/rmagick/geometry.rbs +14 -0
- data/sig/rmagick/image.rbs +194 -0
- data/sig/rmagick/image_list.rbs +181 -0
- data/sig/rmagick/iptc.rbs +101 -0
- data/sig/rmagick/kernel_info.rbs +12 -0
- data/sig/rmagick/optional_method_arguments.rbs +10 -0
- data/sig/rmagick/pixel.rbs +46 -0
- data/sig/rmagick/struct.rbs +90 -0
- data/sig/rmagick.rbs +43 -0
- data/sig/rvg/clippath.rbs +34 -0
- data/sig/rvg/container.rbs +78 -0
- data/sig/rvg/deep_equal.rbs +48 -0
- data/sig/rvg/describable.rbs +30 -0
- data/sig/rvg/embellishable.rbs +226 -0
- data/sig/rvg/misc.rbs +145 -0
- data/sig/rvg/paint.rbs +55 -0
- data/sig/rvg/pathdata.rbs +77 -0
- data/sig/rvg/rvg.rbs +125 -0
- data/sig/rvg/stretchable.rbs +56 -0
- data/sig/rvg/stylable.rbs +66 -0
- data/sig/rvg/text.rbs +118 -0
- data/sig/rvg/transformable.rbs +59 -0
- data/sig/rvg/units.rbs +33 -0
- metadata +32 -128
data/lib/rmagick_internal.rb
CHANGED
@@ -226,6 +226,7 @@ module Magick
|
|
226
226
|
private
|
227
227
|
|
228
228
|
def enquote(str)
|
229
|
+
str = to_string(str)
|
229
230
|
if str.length > 2 && /\A(?:\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})\z/.match(str)
|
230
231
|
str
|
231
232
|
else
|
@@ -233,11 +234,21 @@ module Magick
|
|
233
234
|
end
|
234
235
|
end
|
235
236
|
|
236
|
-
def
|
237
|
-
return if opacity.is_a?(String) && opacity
|
237
|
+
def to_opacity(opacity)
|
238
|
+
return opacity if opacity.is_a?(String) && opacity.end_with?('%')
|
238
239
|
|
239
240
|
value = Float(opacity)
|
240
241
|
Kernel.raise ArgumentError, 'opacity must be >= 0 and <= 1.0' if value < 0 || value > 1.0
|
242
|
+
|
243
|
+
value
|
244
|
+
end
|
245
|
+
|
246
|
+
def to_string(obj)
|
247
|
+
return obj if obj.is_a?(String)
|
248
|
+
return obj.to_s if obj.is_a?(Symbol)
|
249
|
+
return obj.to_str if obj.respond_to?(:to_str)
|
250
|
+
|
251
|
+
Kernel.raise TypeError, "no implicit conversion of #{obj.class} into String"
|
241
252
|
end
|
242
253
|
|
243
254
|
public
|
@@ -281,17 +292,19 @@ module Magick
|
|
281
292
|
|
282
293
|
# Invoke a clip-path defined by def_clip_path.
|
283
294
|
def clip_path(name)
|
284
|
-
primitive "clip-path #{name}"
|
295
|
+
primitive "clip-path #{to_string(name)}"
|
285
296
|
end
|
286
297
|
|
287
298
|
# Define the clipping rule.
|
288
299
|
def clip_rule(rule)
|
300
|
+
rule = to_string(rule)
|
289
301
|
Kernel.raise ArgumentError, "Unknown clipping rule #{rule}" unless %w[evenodd nonzero].include?(rule.downcase)
|
290
302
|
primitive "clip-rule #{rule}"
|
291
303
|
end
|
292
304
|
|
293
305
|
# Define the clip units
|
294
306
|
def clip_units(unit)
|
307
|
+
unit = to_string(unit)
|
295
308
|
Kernel.raise ArgumentError, "Unknown clip unit #{unit}" unless %w[userspace userspaceonuse objectboundingbox].include?(unit.downcase)
|
296
309
|
primitive "clip-units #{unit}"
|
297
310
|
end
|
@@ -320,7 +333,7 @@ module Magick
|
|
320
333
|
# (pop) graphic-context".
|
321
334
|
def define_clip_path(name)
|
322
335
|
push('defs')
|
323
|
-
push("clip-path
|
336
|
+
push("clip-path #{enquote(name)}")
|
324
337
|
push('graphic-context')
|
325
338
|
yield
|
326
339
|
ensure
|
@@ -340,7 +353,7 @@ module Magick
|
|
340
353
|
# Let anything through, but the only defined argument
|
341
354
|
# is "UTF-8". All others are apparently ignored.
|
342
355
|
def encoding(encoding)
|
343
|
-
primitive "encoding #{encoding}"
|
356
|
+
primitive "encoding #{to_string(encoding)}"
|
344
357
|
end
|
345
358
|
|
346
359
|
# Specify object fill, a color name or pattern name
|
@@ -352,22 +365,23 @@ module Magick
|
|
352
365
|
|
353
366
|
# Specify fill opacity (use "xx%" to indicate percentage)
|
354
367
|
def fill_opacity(opacity)
|
355
|
-
|
368
|
+
opacity = to_opacity(opacity)
|
356
369
|
primitive "fill-opacity #{opacity}"
|
357
370
|
end
|
358
371
|
|
359
372
|
def fill_rule(rule)
|
373
|
+
rule = to_string(rule)
|
360
374
|
Kernel.raise ArgumentError, "Unknown fill rule #{rule}" unless %w[evenodd nonzero].include?(rule.downcase)
|
361
375
|
primitive "fill-rule #{rule}"
|
362
376
|
end
|
363
377
|
|
364
378
|
# Specify text drawing font
|
365
379
|
def font(name)
|
366
|
-
primitive "font
|
380
|
+
primitive "font #{enquote(name)}"
|
367
381
|
end
|
368
382
|
|
369
383
|
def font_family(name)
|
370
|
-
primitive "font-family
|
384
|
+
primitive "font-family #{enquote(name)}"
|
371
385
|
end
|
372
386
|
|
373
387
|
def font_stretch(stretch)
|
@@ -405,38 +419,17 @@ module Magick
|
|
405
419
|
|
406
420
|
# IM 6.5.5-8 and later
|
407
421
|
def interline_spacing(space)
|
408
|
-
|
409
|
-
Float(space)
|
410
|
-
rescue ArgumentError
|
411
|
-
Kernel.raise ArgumentError, 'invalid value for interline_spacing'
|
412
|
-
rescue TypeError
|
413
|
-
Kernel.raise TypeError, "can't convert #{space.class} into Float"
|
414
|
-
end
|
415
|
-
primitive "interline-spacing #{space}"
|
422
|
+
primitive "interline-spacing #{Float(space)}"
|
416
423
|
end
|
417
424
|
|
418
425
|
# IM 6.4.8-3 and later
|
419
426
|
def interword_spacing(space)
|
420
|
-
|
421
|
-
Float(space)
|
422
|
-
rescue ArgumentError
|
423
|
-
Kernel.raise ArgumentError, 'invalid value for interword_spacing'
|
424
|
-
rescue TypeError
|
425
|
-
Kernel.raise TypeError, "can't convert #{space.class} into Float"
|
426
|
-
end
|
427
|
-
primitive "interword-spacing #{space}"
|
427
|
+
primitive "interword-spacing #{Float(space)}"
|
428
428
|
end
|
429
429
|
|
430
430
|
# IM 6.4.8-3 and later
|
431
431
|
def kerning(space)
|
432
|
-
|
433
|
-
Float(space)
|
434
|
-
rescue ArgumentError
|
435
|
-
Kernel.raise ArgumentError, 'invalid value for kerning'
|
436
|
-
rescue TypeError
|
437
|
-
Kernel.raise TypeError, "can't convert #{space.class} into Float"
|
438
|
-
end
|
439
|
-
primitive "kerning #{space}"
|
432
|
+
primitive "kerning #{Float(space)}"
|
440
433
|
end
|
441
434
|
|
442
435
|
# Draw a line
|
@@ -447,7 +440,7 @@ module Magick
|
|
447
440
|
# Specify drawing fill and stroke opacities. If the value is a string
|
448
441
|
# ending with a %, the number will be multiplied by 0.01.
|
449
442
|
def opacity(opacity)
|
450
|
-
|
443
|
+
opacity = to_opacity(opacity)
|
451
444
|
primitive "opacity #{opacity}"
|
452
445
|
end
|
453
446
|
|
@@ -455,7 +448,7 @@ module Magick
|
|
455
448
|
# primitive requires that the commands be surrounded by quotes or
|
456
449
|
# apostrophes. Here we simply use apostrophes.
|
457
450
|
def path(cmds)
|
458
|
-
primitive "path
|
451
|
+
primitive "path #{enquote(cmds)}"
|
459
452
|
end
|
460
453
|
|
461
454
|
# Define a pattern. In the block, call primitive methods to
|
@@ -463,7 +456,7 @@ module Magick
|
|
463
456
|
# as the argument to the 'fill' or 'stroke' methods
|
464
457
|
def pattern(name, x, y, width, height)
|
465
458
|
push('defs')
|
466
|
-
push("pattern #{name} " + sprintf('%g %g %g %g', x, y, width, height))
|
459
|
+
push("pattern #{to_string(name)} " + sprintf('%g %g %g %g', x, y, width, height))
|
467
460
|
push('graphic-context')
|
468
461
|
yield
|
469
462
|
ensure
|
@@ -514,8 +507,7 @@ module Magick
|
|
514
507
|
if what.length.zero?
|
515
508
|
primitive 'pop graphic-context'
|
516
509
|
else
|
517
|
-
|
518
|
-
primitive 'pop ' + what.map(&:to_s).join(' ')
|
510
|
+
primitive 'pop ' + what.map { |x| to_string(x) }.join(' ')
|
519
511
|
end
|
520
512
|
end
|
521
513
|
|
@@ -528,8 +520,7 @@ module Magick
|
|
528
520
|
if what.length.zero?
|
529
521
|
primitive 'push graphic-context'
|
530
522
|
else
|
531
|
-
|
532
|
-
primitive 'push ' + what.map(&:to_s).join(' ')
|
523
|
+
primitive 'push ' + what.map { |x| to_string(x) }.join(' ')
|
533
524
|
end
|
534
525
|
end
|
535
526
|
|
@@ -585,7 +576,7 @@ module Magick
|
|
585
576
|
if list.length.zero?
|
586
577
|
primitive 'stroke-dasharray none'
|
587
578
|
else
|
588
|
-
list.each do |x|
|
579
|
+
list.map! { |x| Float(x) }.each do |x|
|
589
580
|
Kernel.raise ArgumentError, "dash array elements must be > 0 (#{x} given)" if x <= 0
|
590
581
|
end
|
591
582
|
primitive "stroke-dasharray #{list.join(',')}"
|
@@ -598,16 +589,19 @@ module Magick
|
|
598
589
|
end
|
599
590
|
|
600
591
|
def stroke_linecap(value)
|
592
|
+
value = to_string(value)
|
601
593
|
Kernel.raise ArgumentError, "Unknown linecap type: #{value}" unless %w[butt round square].include?(value.downcase)
|
602
594
|
primitive "stroke-linecap #{value}"
|
603
595
|
end
|
604
596
|
|
605
597
|
def stroke_linejoin(value)
|
598
|
+
value = to_string(value)
|
606
599
|
Kernel.raise ArgumentError, "Unknown linejoin type: #{value}" unless %w[round miter bevel].include?(value.downcase)
|
607
600
|
primitive "stroke-linejoin #{value}"
|
608
601
|
end
|
609
602
|
|
610
603
|
def stroke_miterlimit(value)
|
604
|
+
value = Float(value)
|
611
605
|
Kernel.raise ArgumentError, 'miterlimit must be >= 1' if value < 1
|
612
606
|
primitive "stroke-miterlimit #{value}"
|
613
607
|
end
|
@@ -615,7 +609,7 @@ module Magick
|
|
615
609
|
# Specify opacity of stroke drawing color
|
616
610
|
# (use "xx%" to indicate percentage)
|
617
611
|
def stroke_opacity(opacity)
|
618
|
-
|
612
|
+
opacity = to_opacity(opacity)
|
619
613
|
primitive "stroke-opacity #{opacity}"
|
620
614
|
end
|
621
615
|
|
@@ -626,7 +620,8 @@ module Magick
|
|
626
620
|
|
627
621
|
# Draw text at position x,y. Add quotes to text that is not already quoted.
|
628
622
|
def text(x, y, text)
|
629
|
-
|
623
|
+
text = to_string(text)
|
624
|
+
Kernel.raise ArgumentError, 'missing text argument' if text.empty?
|
630
625
|
if text.length > 2 && /\A(?:\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})\z/.match(text)
|
631
626
|
# text already quoted
|
632
627
|
elsif !text['\'']
|
@@ -1080,13 +1075,13 @@ module Magick
|
|
1080
1075
|
%i[red green blue opacity].each do |c|
|
1081
1076
|
module_eval <<-END_EVAL, __FILE__, __LINE__ + 1
|
1082
1077
|
def #{c}
|
1083
|
-
|
1078
|
+
return collect { |p| p.#{c} }
|
1084
1079
|
end
|
1085
1080
|
def #{c}=(v)
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1081
|
+
each { |p| p.#{c} = v }
|
1082
|
+
changed
|
1083
|
+
notify_observers(self)
|
1084
|
+
v
|
1090
1085
|
end
|
1091
1086
|
END_EVAL
|
1092
1087
|
end
|
@@ -1310,17 +1305,11 @@ module Magick
|
|
1310
1305
|
%w[& + - |].each do |op|
|
1311
1306
|
module_eval <<-END_BINOPS, __FILE__, __LINE__ + 1
|
1312
1307
|
def #{op}(other)
|
1308
|
+
assert_image_array(other)
|
1313
1309
|
ilist = self.class.new
|
1314
|
-
|
1315
|
-
a = other #{op} @images
|
1316
|
-
rescue TypeError
|
1317
|
-
Kernel.raise ArgumentError, "Magick::ImageList expected, got " + other.class.to_s
|
1318
|
-
end
|
1310
|
+
a = other #{op} @images
|
1319
1311
|
current = get_current()
|
1320
|
-
a.each
|
1321
|
-
assert_image image
|
1322
|
-
ilist << image
|
1323
|
-
end
|
1312
|
+
a.each { |image| ilist << image }
|
1324
1313
|
ilist.set_current current
|
1325
1314
|
return ilist
|
1326
1315
|
end
|
@@ -1349,16 +1338,18 @@ module Magick
|
|
1349
1338
|
# return if A.scene != B.scene
|
1350
1339
|
# return A.length <=> B.length
|
1351
1340
|
def <=>(other)
|
1352
|
-
|
1341
|
+
return unless other.is_a? self.class
|
1342
|
+
|
1353
1343
|
size = [length, other.length].min
|
1354
1344
|
size.times do |x|
|
1355
1345
|
r = self[x] <=> other[x]
|
1356
1346
|
return r unless r.zero?
|
1357
1347
|
end
|
1348
|
+
|
1358
1349
|
return 0 if @scene.nil? && other.scene.nil?
|
1350
|
+
return if @scene.nil? && !other.scene.nil?
|
1351
|
+
return if !@scene.nil? && other.scene.nil?
|
1359
1352
|
|
1360
|
-
Kernel.raise TypeError, "cannot convert nil into #{other.scene.class}" if @scene.nil? && !other.scene.nil?
|
1361
|
-
Kernel.raise TypeError, "cannot convert nil into #{scene.class}" if !@scene.nil? && other.scene.nil?
|
1362
1353
|
r = scene <=> other.scene
|
1363
1354
|
return r unless r.zero?
|
1364
1355
|
|
@@ -1390,7 +1381,7 @@ module Magick
|
|
1390
1381
|
|
1391
1382
|
%i[
|
1392
1383
|
at each each_index empty? fetch
|
1393
|
-
first hash include? index length rindex
|
1384
|
+
first hash include? index length rindex
|
1394
1385
|
].each do |mth|
|
1395
1386
|
module_eval <<-END_SIMPLE_DELEGATES, __FILE__, __LINE__ + 1
|
1396
1387
|
def #{mth}(*args, &block)
|
@@ -1400,6 +1391,11 @@ module Magick
|
|
1400
1391
|
end
|
1401
1392
|
alias size length
|
1402
1393
|
|
1394
|
+
def sort!(*args, &block)
|
1395
|
+
@images.sort!(*args, &block)
|
1396
|
+
self
|
1397
|
+
end
|
1398
|
+
|
1403
1399
|
def clear
|
1404
1400
|
@scene = nil
|
1405
1401
|
@images.clear
|
@@ -1447,7 +1443,7 @@ module Magick
|
|
1447
1443
|
alias map! collect!
|
1448
1444
|
alias __map__! collect!
|
1449
1445
|
|
1450
|
-
#
|
1446
|
+
# ImageMagick used affinity in 6.4.3, switch to remap in 6.4.4.
|
1451
1447
|
alias affinity remap
|
1452
1448
|
|
1453
1449
|
def compact
|
@@ -1510,7 +1506,12 @@ module Magick
|
|
1510
1506
|
end
|
1511
1507
|
|
1512
1508
|
def eql?(other)
|
1513
|
-
|
1509
|
+
begin
|
1510
|
+
assert_image_array other
|
1511
|
+
rescue ArgumentError
|
1512
|
+
return false
|
1513
|
+
end
|
1514
|
+
|
1514
1515
|
eql = other.eql?(@images)
|
1515
1516
|
begin # "other" is another ImageList
|
1516
1517
|
eql &&= @scene == other.scene
|
@@ -1614,7 +1615,9 @@ module Magick
|
|
1614
1615
|
# it up the line. Catch a NameError and emit a useful message.
|
1615
1616
|
def method_missing(meth_id, *args, &block)
|
1616
1617
|
if @scene
|
1617
|
-
@images[@scene]
|
1618
|
+
img = @images[@scene]
|
1619
|
+
new_img = img.send(meth_id, *args, &block)
|
1620
|
+
img.object_id == new_img.object_id ? self : new_img
|
1618
1621
|
else
|
1619
1622
|
super
|
1620
1623
|
end
|
@@ -1801,7 +1804,6 @@ module Magick
|
|
1801
1804
|
end
|
1802
1805
|
|
1803
1806
|
def values_at(*args)
|
1804
|
-
a = @images.values_at(*args)
|
1805
1807
|
a = self.class.new
|
1806
1808
|
@images.values_at(*args).each { |image| a << image }
|
1807
1809
|
a.scene = a.length - 1
|
@@ -1852,7 +1854,7 @@ module Magick
|
|
1852
1854
|
class HatchFill
|
1853
1855
|
def initialize(bgcolor, hatchcolor = 'white', dist = 10)
|
1854
1856
|
@bgcolor = bgcolor
|
1855
|
-
@hatchpixel = Pixel.from_color(hatchcolor)
|
1857
|
+
@hatchpixel = hatchcolor.is_a?(Pixel) ? hatchcolor : Pixel.from_color(hatchcolor)
|
1856
1858
|
@dist = dist
|
1857
1859
|
end
|
1858
1860
|
|
data/lib/rvg/embellishable.rb
CHANGED
@@ -162,6 +162,8 @@ module Magick
|
|
162
162
|
(@width - @image.columns * scale) / 2.0
|
163
163
|
when /\AxMax/
|
164
164
|
@width - @image.columns * scale
|
165
|
+
else
|
166
|
+
0
|
165
167
|
end
|
166
168
|
|
167
169
|
ty = case @align
|
@@ -171,6 +173,8 @@ module Magick
|
|
171
173
|
(@height - @image.rows * scale) / 2.0
|
172
174
|
when /YMax\z/
|
173
175
|
@height - @image.rows * scale
|
176
|
+
else
|
177
|
+
0
|
174
178
|
end
|
175
179
|
[tx, ty]
|
176
180
|
end
|
@@ -182,7 +186,7 @@ module Magick
|
|
182
186
|
width = @width
|
183
187
|
height = @height
|
184
188
|
elsif @meet_or_slice == 'meet'
|
185
|
-
scale = [@width / @image.columns, @height / @image.rows].min
|
189
|
+
scale = [@width / @image.columns, @height / @image.rows].min || 1.0
|
186
190
|
width = @image.columns
|
187
191
|
height = @image.rows
|
188
192
|
else
|
@@ -193,7 +197,7 @@ module Magick
|
|
193
197
|
end
|
194
198
|
|
195
199
|
gc.clip_path(name)
|
196
|
-
scale = [@width / @image.columns, @height / @image.rows].max
|
200
|
+
scale = [@width / @image.columns, @height / @image.rows].max || 1.0
|
197
201
|
width = @image.columns
|
198
202
|
height = @image.rows
|
199
203
|
end
|
data/lib/rvg/misc.rb
CHANGED
@@ -452,10 +452,10 @@ module Magick
|
|
452
452
|
}
|
453
453
|
|
454
454
|
FONT_WEIGHT = {
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
455
|
+
normal: Magick::NormalWeight,
|
456
|
+
bold: Magick::BoldWeight,
|
457
|
+
bolder: Magick::BolderWeight,
|
458
|
+
lighter: Magick::LighterWeight
|
459
459
|
}
|
460
460
|
|
461
461
|
TEXT_ANCHOR = {
|
@@ -579,7 +579,7 @@ module Magick
|
|
579
579
|
|
580
580
|
def font_weight(weight)
|
581
581
|
# If the arg is not in the hash use it directly. Handles numeric values.
|
582
|
-
weight =
|
582
|
+
weight = weight.is_a?(Numeric) ? weight : FONT_WEIGHT.fetch(weight.to_sym, Magick::NormalWeight)
|
583
583
|
@gc.font_weight(weight)
|
584
584
|
@shadow[-1].font_weight = weight
|
585
585
|
nil
|
@@ -646,7 +646,7 @@ module Magick
|
|
646
646
|
|
647
647
|
def skewX(degrees)
|
648
648
|
degrees = Magick::RVG.convert_one_to_float(degrees)
|
649
|
-
@gc.
|
649
|
+
@gc.skewx(degrees)
|
650
650
|
@ry = Math.tan(GraphicContext.degrees_to_radians(degrees))
|
651
651
|
concat_matrix
|
652
652
|
nil
|
@@ -654,7 +654,7 @@ module Magick
|
|
654
654
|
|
655
655
|
def skewY(degrees)
|
656
656
|
degrees = Magick::RVG.convert_one_to_float(degrees)
|
657
|
-
@gc.
|
657
|
+
@gc.skewy(degrees)
|
658
658
|
@rx = Math.tan(GraphicContext.degrees_to_radians(degrees))
|
659
659
|
concat_matrix
|
660
660
|
nil
|
data/lib/rvg/rvg.rb
CHANGED
data/lib/rvg/stretchable.rb
CHANGED
@@ -137,8 +137,8 @@ module Magick
|
|
137
137
|
rescue ArgumentError
|
138
138
|
raise ArgumentError, "arguments must be convertable to float (got #{x.class}, #{y.class}, #{width.class}, #{height.class})"
|
139
139
|
end
|
140
|
-
raise(ArgumentError, "viewbox width must be > 0 (#{
|
141
|
-
raise(ArgumentError, "viewbox height must be > 0 (#{
|
140
|
+
raise(ArgumentError, "viewbox width must be > 0 (#{@vbx_width} given)") unless @vbx_width >= 0
|
141
|
+
raise(ArgumentError, "viewbox height must be > 0 (#{@vbx_height} given)") unless @vbx_height >= 0
|
142
142
|
|
143
143
|
# return the user-coordinate space attributes if defined
|
144
144
|
class << self
|
data/lib/rvg/transformable.rb
CHANGED
@@ -89,7 +89,7 @@ module Magick
|
|
89
89
|
cx = Float(args[0])
|
90
90
|
cy = Float(args[1])
|
91
91
|
@transforms << [:translate, [cx, cy]]
|
92
|
-
@transforms << [:rotate, [angle]]
|
92
|
+
@transforms << [:rotate, [Float(angle)]]
|
93
93
|
@transforms << [:translate, [-cx, -cy]]
|
94
94
|
else
|
95
95
|
raise ArgumentError, "wrong number of arguments (#{args.length} for 1 or 3)"
|
data/rmagick.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.license = 'MIT'
|
15
15
|
|
16
16
|
tracked_files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
17
|
-
file_exclusion_regex =
|
17
|
+
file_exclusion_regex = /\A(doc|benchmarks|examples|spec|Steepfile)/
|
18
18
|
files = tracked_files.reject { |file| file[file_exclusion_regex] }
|
19
19
|
|
20
20
|
s.files = files
|
@@ -26,16 +26,4 @@ Gem::Specification.new do |s|
|
|
26
26
|
|
27
27
|
s.add_runtime_dependency 'pkg-config', '~> 1.4'
|
28
28
|
s.add_runtime_dependency 'observer', '~> 0.1'
|
29
|
-
|
30
|
-
s.add_development_dependency 'pry', '~> 0.14'
|
31
|
-
s.add_development_dependency 'rake-compiler', '~> 1.0'
|
32
|
-
s.add_development_dependency 'rspec', '~> 3.8'
|
33
|
-
s.add_development_dependency 'rspec_junit_formatter', '~> 0.6.0'
|
34
|
-
if RUBY_PLATFORM !~ /mswin|mingw/
|
35
|
-
s.add_development_dependency 'rubocop', '~> 0.81.0'
|
36
|
-
s.add_development_dependency 'rubocop-rspec', '~> 1.38.1'
|
37
|
-
s.add_development_dependency 'rubocop-performance', '~> 1.5.2'
|
38
|
-
end
|
39
|
-
s.add_development_dependency 'simplecov', '~> 0.16.1'
|
40
|
-
s.add_development_dependency 'yard', '~> 0.9.24'
|
41
29
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Magick
|
2
|
+
interface _DrawCommonMethods
|
3
|
+
def affine: (magick_real sx, magick_real rx, magick_real ry, magick_real sy, magick_real tx, magick_real ty) -> self
|
4
|
+
def alpha: (magick_real x, magick_real y, PaintMethod method) -> self
|
5
|
+
def arc: (magick_real start_x, magick_real start_y, magick_real end_x, magick_real end_y, magick_real start_degrees, magick_real end_degrees) -> self
|
6
|
+
def bezier: (*magick_real points) -> self
|
7
|
+
def circle: (magick_real origin_x, magick_real origin_y, magick_real perim_x, magick_real perim_y) -> self
|
8
|
+
def clip_path: (interned name) -> self
|
9
|
+
def clip_rule: (interned rule) -> self
|
10
|
+
def clip_units: (interned unit) -> self
|
11
|
+
def color: (magick_real x, magick_real y, PaintMethod method) -> self
|
12
|
+
def decorate: (DecorationType decoration) -> self
|
13
|
+
def define_clip_path: (interned name) { () -> void } -> void
|
14
|
+
def ellipse: (magick_real origin_x, magick_real origin_y, magick_real width, magick_real height, magick_real arc_start, magick_real arc_end) -> self
|
15
|
+
def encoding: (interned encoding) -> self
|
16
|
+
def fill: (interned colorspec) -> self
|
17
|
+
alias fill_color fill
|
18
|
+
alias fill_pattern fill
|
19
|
+
def fill_opacity: (magick_percentage opacity) -> self
|
20
|
+
def fill_rule: (interned rule) -> self
|
21
|
+
def gravity: (GravityType grav) -> self
|
22
|
+
def image: (CompositeOperator composite, magick_real x, magick_real y, magick_real width, magick_real height, String image_file_path) -> self
|
23
|
+
def interline_spacing: (magick_real space) -> self
|
24
|
+
def interword_spacing: (magick_real space) -> self
|
25
|
+
def kerning: (magick_real space) -> self
|
26
|
+
def line: (magick_real start_x, magick_real start_y, magick_real end_x, magick_real end_y) -> self
|
27
|
+
def opacity: (magick_percentage opacity) -> self
|
28
|
+
def path: (interned cmds) -> self
|
29
|
+
def pattern: (interned name, magick_real x, magick_real y, magick_real width, magick_real height) { () -> void } -> void
|
30
|
+
def point: (magick_real x, magick_real y) -> self
|
31
|
+
def pointsize: (magick_real points) -> self
|
32
|
+
def polygon: (*magick_real points) -> self
|
33
|
+
def polyline: (*magick_real points) -> self
|
34
|
+
def rectangle: (magick_real upper_left_x, magick_real upper_left_y, magick_real lower_right_x, magick_real lower_right_y) -> self
|
35
|
+
def roundrectangle: (magick_real center_x, magick_real center_y, magick_real width, magick_real height, magick_real corner_width, magick_real corner_height) -> self
|
36
|
+
def skewx: (magick_real angle) -> self
|
37
|
+
def skewy: (magick_real angle) -> self
|
38
|
+
def stroke: (interned colorspec) -> self
|
39
|
+
alias stroke_color stroke
|
40
|
+
alias stroke_pattern stroke
|
41
|
+
def stroke_antialias: (bool `bool`) -> self
|
42
|
+
def stroke_dasharray: (*magick_real list) -> self
|
43
|
+
def stroke_dashoffset: (?magick_real value) -> self
|
44
|
+
def stroke_linecap: (interned value) -> self
|
45
|
+
def stroke_linejoin: (interned value) -> self
|
46
|
+
def stroke_miterlimit: (magick_real value) -> self
|
47
|
+
def stroke_opacity: (magick_percentage opacity) -> self
|
48
|
+
def text_align: (AlignType alignment) -> self
|
49
|
+
def text_antialias: (bool boolean) -> self
|
50
|
+
def text_undercolor: (String color) -> self
|
51
|
+
|
52
|
+
def annotate: (magick_image image_arg, int width_arg, int height_arg, int x_arg, int y_arg, string text) -> self
|
53
|
+
| (magick_image image_arg, int width_arg, int height_arg, int x_arg, int y_arg, string text) { (self) -> void } -> self
|
54
|
+
def composite: (magick_real x, magick_real y, magick_real width, magick_real height, magick_image image, ?CompositeOperator composite_op) -> self
|
55
|
+
def draw: (magick_image image_arg) -> self
|
56
|
+
def get_type_metrics: (magick_image image, string text) -> TypeMetric
|
57
|
+
| (string text) -> TypeMetric
|
58
|
+
def get_multiline_type_metrics: (magick_image image, string text) -> TypeMetric
|
59
|
+
| (string text) -> TypeMetric
|
60
|
+
def marshal_dump: () -> Hash[Symbol, untyped]
|
61
|
+
def marshal_load: (Hash[Symbol, untyped] ddraw) -> self
|
62
|
+
def primitive: (string primitive) -> self
|
63
|
+
end
|
64
|
+
end
|