rmagick 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.appveyor.yml +4 -4
- data/.circleci/config.yml +1 -1
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +6 -0
- data/.travis.yml +26 -8
- data/CHANGELOG.md +104 -0
- data/before_install_linux.sh +19 -10
- data/benchmarks/memory/README.md +50 -0
- data/benchmarks/memory/image_new.rb +8 -0
- data/benchmarks/memory/rmagick.gnuplot +16 -0
- data/doc/ex/coalesce.rb +2 -2
- data/doc/ex/drawcomp.rb +3 -3
- data/doc/ex/get_pixels.rb +1 -1
- data/doc/ex/images/Coffee.png +0 -0
- data/doc/ex/images/No.png +0 -0
- data/doc/ex/images/Snake.png +0 -0
- data/doc/ex/implode.rb +2 -2
- data/doc/ex/mask.rb +1 -1
- data/doc/ex/matte_fill_to_border.rb +1 -1
- data/doc/ex/matte_floodfill.rb +1 -1
- data/doc/ex/matte_replace.rb +1 -1
- data/doc/ex/stegano.rb +1 -1
- data/examples/constitute.rb +1 -1
- data/examples/crop_with_gravity.rb +1 -1
- data/examples/demo.rb +4 -4
- data/examples/find_similar_region.rb +1 -1
- data/examples/histogram.rb +3 -3
- data/examples/identify.rb +46 -46
- data/examples/image_opacity.rb +2 -2
- data/examples/vignette.rb +3 -3
- data/ext/RMagick/extconf.rb +19 -15
- data/ext/RMagick/rmagick.c +1 -2
- data/ext/RMagick/rmagick.h +59 -30
- data/ext/RMagick/rmdraw.c +62 -274
- data/ext/RMagick/rmenum.c +121 -665
- data/ext/RMagick/rmfill.c +7 -7
- data/ext/RMagick/rmilist.c +91 -7
- data/ext/RMagick/rmimage.c +568 -379
- data/ext/RMagick/rminfo.c +152 -110
- data/ext/RMagick/rmkinfo.c +17 -1
- data/ext/RMagick/rmmain.c +75 -74
- data/ext/RMagick/rmmontage.c +33 -33
- data/ext/RMagick/rmpixel.c +75 -14
- data/ext/RMagick/rmstruct.c +5 -5
- data/ext/RMagick/rmutil.c +3 -13
- data/lib/obsolete.rb +66 -0
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +54 -41
- data/spec/rmagick/image/composite_spec.rb +5 -76
- data/spec/rmagick/image/properties_spec.rb +1 -1
- data/test/Draw.rb +52 -115
- data/test/Enum.rb +153 -1
- data/test/Fill.rb +1 -1
- data/test/Image1.rb +97 -43
- data/test/Image2.rb +140 -36
- data/test/Image3.rb +110 -120
- data/test/ImageList1.rb +46 -11
- data/test/ImageList2.rb +11 -21
- data/test/Image_attributes.rb +81 -127
- data/test/Import_Export.rb +2 -2
- data/test/Info.rb +5 -1
- data/test/KernelInfo.rb +67 -0
- data/test/Magick.rb +17 -35
- data/test/Pixel.rb +193 -24
- data/test/PolaroidOptions.rb +1 -1
- data/test/Preview.rb +3 -35
- data/test/Struct.rb +45 -0
- data/test/appearance/Montage.rb +26 -0
- data/test/appearance/appearance_assertion.rb +13 -0
- data/test/appearance/expected/montage_border_color.jpg +0 -0
- data/test/lib/Obsolete.rb +30 -0
- data/test/lib/internal/Draw.rb +823 -0
- data/test/lib/internal/Geometry.rb +98 -0
- data/test/lib/internal/Magick.rb +40 -0
- data/test/test_all_basic.rb +16 -17
- metadata +27 -5
- data/doc/ex/images/Coffee.wmf +0 -0
- data/doc/ex/images/No.wmf +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
data/ext/RMagick/rmdraw.c
CHANGED
@@ -30,7 +30,7 @@ static VALUE get_type_metrics(int, VALUE *, VALUE, get_type_metrics_func_t);
|
|
30
30
|
*
|
31
31
|
* @param self this object
|
32
32
|
* @param matrix the affine matrix to set
|
33
|
-
* @return
|
33
|
+
* @return matrix
|
34
34
|
*/
|
35
35
|
VALUE
|
36
36
|
Draw_affine_eq(VALUE self, VALUE matrix)
|
@@ -40,7 +40,7 @@ Draw_affine_eq(VALUE self, VALUE matrix)
|
|
40
40
|
rb_check_frozen(self);
|
41
41
|
Data_Get_Struct(self, Draw, draw);
|
42
42
|
Export_AffineMatrix(&draw->info->affine, matrix);
|
43
|
-
return
|
43
|
+
return matrix;
|
44
44
|
}
|
45
45
|
|
46
46
|
|
@@ -52,7 +52,7 @@ Draw_affine_eq(VALUE self, VALUE matrix)
|
|
52
52
|
*
|
53
53
|
* @param self this object
|
54
54
|
* @param align the alignment
|
55
|
-
* @return
|
55
|
+
* @return align
|
56
56
|
*/
|
57
57
|
VALUE
|
58
58
|
Draw_align_eq(VALUE self, VALUE align)
|
@@ -62,7 +62,7 @@ Draw_align_eq(VALUE self, VALUE align)
|
|
62
62
|
rb_check_frozen(self);
|
63
63
|
Data_Get_Struct(self, Draw, draw);
|
64
64
|
VALUE_TO_ENUM(align, draw->info->align, AlignType);
|
65
|
-
return
|
65
|
+
return align;
|
66
66
|
}
|
67
67
|
|
68
68
|
|
@@ -74,7 +74,7 @@ Draw_align_eq(VALUE self, VALUE align)
|
|
74
74
|
*
|
75
75
|
* @param self this object
|
76
76
|
* @param decorate the decorate
|
77
|
-
* @return
|
77
|
+
* @return decorate
|
78
78
|
*/
|
79
79
|
VALUE
|
80
80
|
Draw_decorate_eq(VALUE self, VALUE decorate)
|
@@ -84,7 +84,7 @@ Draw_decorate_eq(VALUE self, VALUE decorate)
|
|
84
84
|
rb_check_frozen(self);
|
85
85
|
Data_Get_Struct(self, Draw, draw);
|
86
86
|
VALUE_TO_ENUM(decorate, draw->info->decorate, DecorationType);
|
87
|
-
return
|
87
|
+
return decorate;
|
88
88
|
}
|
89
89
|
|
90
90
|
|
@@ -96,7 +96,7 @@ Draw_decorate_eq(VALUE self, VALUE decorate)
|
|
96
96
|
*
|
97
97
|
* @param self this object
|
98
98
|
* @param density the density
|
99
|
-
* @return
|
99
|
+
* @return density
|
100
100
|
*/
|
101
101
|
VALUE
|
102
102
|
Draw_density_eq(VALUE self, VALUE density)
|
@@ -107,7 +107,7 @@ Draw_density_eq(VALUE self, VALUE density)
|
|
107
107
|
Data_Get_Struct(self, Draw, draw);
|
108
108
|
magick_clone_string(&draw->info->density, StringValuePtr(density));
|
109
109
|
|
110
|
-
return
|
110
|
+
return density;
|
111
111
|
}
|
112
112
|
|
113
113
|
|
@@ -119,7 +119,7 @@ Draw_density_eq(VALUE self, VALUE density)
|
|
119
119
|
*
|
120
120
|
* @param self this object
|
121
121
|
* @param encoding the encoding
|
122
|
-
* @return
|
122
|
+
* @return encoding
|
123
123
|
*/
|
124
124
|
VALUE
|
125
125
|
Draw_encoding_eq(VALUE self, VALUE encoding)
|
@@ -130,7 +130,7 @@ Draw_encoding_eq(VALUE self, VALUE encoding)
|
|
130
130
|
Data_Get_Struct(self, Draw, draw);
|
131
131
|
magick_clone_string(&draw->info->encoding, StringValuePtr(encoding));
|
132
132
|
|
133
|
-
return
|
133
|
+
return encoding;
|
134
134
|
}
|
135
135
|
|
136
136
|
|
@@ -142,7 +142,7 @@ Draw_encoding_eq(VALUE self, VALUE encoding)
|
|
142
142
|
*
|
143
143
|
* @param self this object
|
144
144
|
* @param fill the fill
|
145
|
-
* @return
|
145
|
+
* @return fill
|
146
146
|
*/
|
147
147
|
VALUE
|
148
148
|
Draw_fill_eq(VALUE self, VALUE fill)
|
@@ -152,7 +152,7 @@ Draw_fill_eq(VALUE self, VALUE fill)
|
|
152
152
|
rb_check_frozen(self);
|
153
153
|
Data_Get_Struct(self, Draw, draw);
|
154
154
|
Color_to_PixelColor(&draw->info->fill, fill);
|
155
|
-
return
|
155
|
+
return fill;
|
156
156
|
}
|
157
157
|
|
158
158
|
|
@@ -164,7 +164,7 @@ Draw_fill_eq(VALUE self, VALUE fill)
|
|
164
164
|
*
|
165
165
|
* @param self this object
|
166
166
|
* @param pattern the fill pattern
|
167
|
-
* @return
|
167
|
+
* @return pattern
|
168
168
|
* @see Draw_stroke_pattern_eq
|
169
169
|
* @see Draw_tile_eq
|
170
170
|
*/
|
@@ -192,7 +192,7 @@ Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
|
192
192
|
draw->info->fill_pattern = rm_clone_image(image);
|
193
193
|
}
|
194
194
|
|
195
|
-
return
|
195
|
+
return pattern;
|
196
196
|
}
|
197
197
|
|
198
198
|
|
@@ -204,7 +204,7 @@ Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
|
204
204
|
*
|
205
205
|
* @param self this object
|
206
206
|
* @param font the font
|
207
|
-
* @return
|
207
|
+
* @return font
|
208
208
|
*/
|
209
209
|
VALUE
|
210
210
|
Draw_font_eq(VALUE self, VALUE font)
|
@@ -215,7 +215,7 @@ Draw_font_eq(VALUE self, VALUE font)
|
|
215
215
|
Data_Get_Struct(self, Draw, draw);
|
216
216
|
magick_clone_string(&draw->info->font, StringValuePtr(font));
|
217
217
|
|
218
|
-
return
|
218
|
+
return font;
|
219
219
|
}
|
220
220
|
|
221
221
|
|
@@ -227,7 +227,7 @@ Draw_font_eq(VALUE self, VALUE font)
|
|
227
227
|
*
|
228
228
|
* @param self this object
|
229
229
|
* @param family the family
|
230
|
-
* @return
|
230
|
+
* @return family
|
231
231
|
*/
|
232
232
|
VALUE
|
233
233
|
Draw_font_family_eq(VALUE self, VALUE family)
|
@@ -238,7 +238,7 @@ Draw_font_family_eq(VALUE self, VALUE family)
|
|
238
238
|
Data_Get_Struct(self, Draw, draw);
|
239
239
|
magick_clone_string(&draw->info->family, StringValuePtr(family));
|
240
240
|
|
241
|
-
return
|
241
|
+
return family;
|
242
242
|
}
|
243
243
|
|
244
244
|
|
@@ -250,7 +250,7 @@ Draw_font_family_eq(VALUE self, VALUE family)
|
|
250
250
|
*
|
251
251
|
* @param self this object
|
252
252
|
* @param stretch the font_stretch
|
253
|
-
* @return
|
253
|
+
* @return stretch
|
254
254
|
*/
|
255
255
|
VALUE
|
256
256
|
Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
@@ -260,7 +260,7 @@ Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
|
260
260
|
rb_check_frozen(self);
|
261
261
|
Data_Get_Struct(self, Draw, draw);
|
262
262
|
VALUE_TO_ENUM(stretch, draw->info->stretch, StretchType);
|
263
|
-
return
|
263
|
+
return stretch;
|
264
264
|
}
|
265
265
|
|
266
266
|
|
@@ -272,7 +272,7 @@ Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
|
272
272
|
*
|
273
273
|
* @param self this object
|
274
274
|
* @param style the font_style
|
275
|
-
* @return
|
275
|
+
* @return style
|
276
276
|
*/
|
277
277
|
VALUE
|
278
278
|
Draw_font_style_eq(VALUE self, VALUE style)
|
@@ -282,7 +282,7 @@ Draw_font_style_eq(VALUE self, VALUE style)
|
|
282
282
|
rb_check_frozen(self);
|
283
283
|
Data_Get_Struct(self, Draw, draw);
|
284
284
|
VALUE_TO_ENUM(style, draw->info->style, StyleType);
|
285
|
-
return
|
285
|
+
return style;
|
286
286
|
}
|
287
287
|
|
288
288
|
|
@@ -298,7 +298,7 @@ Draw_font_style_eq(VALUE self, VALUE style)
|
|
298
298
|
*
|
299
299
|
* @param self this object
|
300
300
|
* @param weight the font_weight
|
301
|
-
* @return
|
301
|
+
* @return weight
|
302
302
|
*/
|
303
303
|
VALUE
|
304
304
|
Draw_font_weight_eq(VALUE self, VALUE weight)
|
@@ -346,7 +346,7 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
346
346
|
}
|
347
347
|
}
|
348
348
|
|
349
|
-
return
|
349
|
+
return weight;
|
350
350
|
}
|
351
351
|
|
352
352
|
|
@@ -371,7 +371,7 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
371
371
|
*
|
372
372
|
* @param self this object
|
373
373
|
* @param grav the gravity
|
374
|
-
* @return
|
374
|
+
* @return grav
|
375
375
|
*/
|
376
376
|
VALUE
|
377
377
|
Draw_gravity_eq(VALUE self, VALUE grav)
|
@@ -382,7 +382,7 @@ Draw_gravity_eq(VALUE self, VALUE grav)
|
|
382
382
|
Data_Get_Struct(self, Draw, draw);
|
383
383
|
VALUE_TO_ENUM(grav, draw->info->gravity, GravityType);
|
384
384
|
|
385
|
-
return
|
385
|
+
return grav;
|
386
386
|
}
|
387
387
|
|
388
388
|
|
@@ -397,7 +397,7 @@ Draw_gravity_eq(VALUE self, VALUE grav)
|
|
397
397
|
*
|
398
398
|
* @param self this object
|
399
399
|
* @param kerning the kerning
|
400
|
-
* @return
|
400
|
+
* @return kerning
|
401
401
|
*/
|
402
402
|
VALUE
|
403
403
|
Draw_kerning_eq(VALUE self, VALUE kerning)
|
@@ -407,7 +407,7 @@ Draw_kerning_eq(VALUE self, VALUE kerning)
|
|
407
407
|
rb_check_frozen(self);
|
408
408
|
Data_Get_Struct(self, Draw, draw);
|
409
409
|
draw->info->kerning = NUM2DBL(kerning);
|
410
|
-
return
|
410
|
+
return kerning;
|
411
411
|
}
|
412
412
|
|
413
413
|
|
@@ -422,7 +422,7 @@ Draw_kerning_eq(VALUE self, VALUE kerning)
|
|
422
422
|
*
|
423
423
|
* @param self this object
|
424
424
|
* @param spacing the spacing
|
425
|
-
* @return
|
425
|
+
* @return spacing
|
426
426
|
*/
|
427
427
|
VALUE
|
428
428
|
Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
@@ -432,7 +432,7 @@ Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
|
432
432
|
rb_check_frozen(self);
|
433
433
|
Data_Get_Struct(self, Draw, draw);
|
434
434
|
draw->info->interline_spacing = NUM2DBL(spacing);
|
435
|
-
return
|
435
|
+
return spacing;
|
436
436
|
}
|
437
437
|
|
438
438
|
|
@@ -447,7 +447,7 @@ Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
|
447
447
|
*
|
448
448
|
* @param self this object
|
449
449
|
* @param spacing the spacing
|
450
|
-
* @return
|
450
|
+
* @return spacing
|
451
451
|
*/
|
452
452
|
VALUE
|
453
453
|
Draw_interword_spacing_eq(VALUE self, VALUE spacing)
|
@@ -457,7 +457,7 @@ Draw_interword_spacing_eq(VALUE self, VALUE spacing)
|
|
457
457
|
rb_check_frozen(self);
|
458
458
|
Data_Get_Struct(self, Draw, draw);
|
459
459
|
draw->info->interword_spacing = NUM2DBL(spacing);
|
460
|
-
return
|
460
|
+
return spacing;
|
461
461
|
}
|
462
462
|
|
463
463
|
|
@@ -701,7 +701,7 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
701
701
|
*
|
702
702
|
* @param self this object
|
703
703
|
* @param pointsize the pointsize
|
704
|
-
* @return
|
704
|
+
* @return pointsize
|
705
705
|
*/
|
706
706
|
VALUE
|
707
707
|
Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
@@ -711,7 +711,7 @@ Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
|
711
711
|
rb_check_frozen(self);
|
712
712
|
Data_Get_Struct(self, Draw, draw);
|
713
713
|
draw->info->pointsize = NUM2DBL(pointsize);
|
714
|
-
return
|
714
|
+
return pointsize;
|
715
715
|
}
|
716
716
|
|
717
717
|
|
@@ -728,7 +728,7 @@ Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
|
728
728
|
*
|
729
729
|
* @param self this object
|
730
730
|
* @param deg the number of degrees
|
731
|
-
* @return
|
731
|
+
* @return deg
|
732
732
|
*/
|
733
733
|
VALUE
|
734
734
|
Draw_rotation_eq(VALUE self, VALUE deg)
|
@@ -763,7 +763,7 @@ Draw_rotation_eq(VALUE self, VALUE deg)
|
|
763
763
|
draw->info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
|
764
764
|
}
|
765
765
|
|
766
|
-
return
|
766
|
+
return deg;
|
767
767
|
}
|
768
768
|
|
769
769
|
|
@@ -775,7 +775,7 @@ Draw_rotation_eq(VALUE self, VALUE deg)
|
|
775
775
|
*
|
776
776
|
* @param self this object
|
777
777
|
* @param stroke the stroke
|
778
|
-
* @return
|
778
|
+
* @return stroke
|
779
779
|
*/
|
780
780
|
VALUE
|
781
781
|
Draw_stroke_eq(VALUE self, VALUE stroke)
|
@@ -785,7 +785,7 @@ Draw_stroke_eq(VALUE self, VALUE stroke)
|
|
785
785
|
rb_check_frozen(self);
|
786
786
|
Data_Get_Struct(self, Draw, draw);
|
787
787
|
Color_to_PixelColor(&draw->info->stroke, stroke);
|
788
|
-
return
|
788
|
+
return stroke;
|
789
789
|
}
|
790
790
|
|
791
791
|
|
@@ -797,7 +797,7 @@ Draw_stroke_eq(VALUE self, VALUE stroke)
|
|
797
797
|
*
|
798
798
|
* @param self this object
|
799
799
|
* @param pattern the pattern
|
800
|
-
* @return
|
800
|
+
* @return pattern
|
801
801
|
* @see Draw_fill_pattern_eq
|
802
802
|
*/
|
803
803
|
VALUE
|
@@ -825,7 +825,7 @@ Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
|
825
825
|
draw->info->stroke_pattern = rm_clone_image(image);
|
826
826
|
}
|
827
827
|
|
828
|
-
return
|
828
|
+
return pattern;
|
829
829
|
}
|
830
830
|
|
831
831
|
|
@@ -837,7 +837,7 @@ Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
|
837
837
|
*
|
838
838
|
* @param self this object
|
839
839
|
* @param stroke_width the stroke_width
|
840
|
-
* @return
|
840
|
+
* @return stroke_width
|
841
841
|
*/
|
842
842
|
VALUE
|
843
843
|
Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
@@ -847,7 +847,7 @@ Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
|
847
847
|
rb_check_frozen(self);
|
848
848
|
Data_Get_Struct(self, Draw, draw);
|
849
849
|
draw->info->stroke_width = NUM2DBL(stroke_width);
|
850
|
-
return
|
850
|
+
return stroke_width;
|
851
851
|
}
|
852
852
|
|
853
853
|
|
@@ -859,7 +859,7 @@ Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
|
859
859
|
*
|
860
860
|
* @param self this object
|
861
861
|
* @param text_antialias the text_antialias
|
862
|
-
* @return
|
862
|
+
* @return text_antialias
|
863
863
|
*/
|
864
864
|
VALUE
|
865
865
|
Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
@@ -869,7 +869,7 @@ Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
|
869
869
|
rb_check_frozen(self);
|
870
870
|
Data_Get_Struct(self, Draw, draw);
|
871
871
|
draw->info->text_antialias = (MagickBooleanType) RTEST(text_antialias);
|
872
|
-
return
|
872
|
+
return text_antialias;
|
873
873
|
}
|
874
874
|
|
875
875
|
|
@@ -881,7 +881,7 @@ Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
|
881
881
|
*
|
882
882
|
* @param self this object
|
883
883
|
* @param image the image to tile
|
884
|
-
* @return
|
884
|
+
* @return image
|
885
885
|
*/
|
886
886
|
VALUE
|
887
887
|
Draw_tile_eq(VALUE self, VALUE image)
|
@@ -898,7 +898,7 @@ Draw_tile_eq(VALUE self, VALUE image)
|
|
898
898
|
*
|
899
899
|
* @param self this object
|
900
900
|
* @param undercolor the undercolor
|
901
|
-
* @return
|
901
|
+
* @return undercolor
|
902
902
|
*/
|
903
903
|
VALUE
|
904
904
|
Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
@@ -908,7 +908,7 @@ Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
|
908
908
|
rb_check_frozen(self);
|
909
909
|
Data_Get_Struct(self, Draw, draw);
|
910
910
|
Color_to_PixelColor(&draw->info->undercolor, undercolor);
|
911
|
-
return
|
911
|
+
return undercolor;
|
912
912
|
}
|
913
913
|
|
914
914
|
|
@@ -945,7 +945,7 @@ VALUE Draw_annotate(
|
|
945
945
|
unsigned long width, height;
|
946
946
|
long x, y;
|
947
947
|
AffineMatrix keep;
|
948
|
-
char geometry_str[
|
948
|
+
char geometry_str[100];
|
949
949
|
|
950
950
|
// Save the affine matrix in case it is modified by
|
951
951
|
// Draw#rotation=
|
@@ -1050,9 +1050,9 @@ VALUE
|
|
1050
1050
|
Draw_composite(int argc, VALUE *argv, VALUE self)
|
1051
1051
|
{
|
1052
1052
|
Draw *draw;
|
1053
|
-
const char *op
|
1053
|
+
const char *op;
|
1054
1054
|
double x, y, width, height;
|
1055
|
-
CompositeOperator cop
|
1055
|
+
CompositeOperator cop;
|
1056
1056
|
VALUE image;
|
1057
1057
|
Image *comp_img;
|
1058
1058
|
struct TmpFile_Name *tmpfile_name;
|
@@ -1067,239 +1067,28 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1067
1067
|
|
1068
1068
|
// Retrieve the image to composite
|
1069
1069
|
image = rm_cur_image(argv[4]);
|
1070
|
-
|
1070
|
+
comp_img = rm_check_destroyed(image);
|
1071
1071
|
|
1072
1072
|
x = NUM2DBL(argv[0]);
|
1073
1073
|
y = NUM2DBL(argv[1]);
|
1074
1074
|
width = NUM2DBL(argv[2]);
|
1075
1075
|
height = NUM2DBL(argv[3]);
|
1076
1076
|
|
1077
|
-
|
1077
|
+
cop = OverCompositeOp;
|
1078
1078
|
if (argc == 6)
|
1079
1079
|
{
|
1080
1080
|
VALUE_TO_ENUM(argv[5], cop, CompositeOperator);
|
1081
|
+
}
|
1081
1082
|
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
break;
|
1087
|
-
case AtopCompositeOp:
|
1088
|
-
op = "Atop";
|
1089
|
-
break;
|
1090
|
-
case BlendCompositeOp:
|
1091
|
-
op = "Blend";
|
1092
|
-
break;
|
1093
|
-
case BlurCompositeOp:
|
1094
|
-
op = "Blur";
|
1095
|
-
break;
|
1096
|
-
case BumpmapCompositeOp:
|
1097
|
-
op = "Bumpmap";
|
1098
|
-
break;
|
1099
|
-
case ChangeMaskCompositeOp:
|
1100
|
-
op = "ChangeMask";
|
1101
|
-
break;
|
1102
|
-
case ClearCompositeOp:
|
1103
|
-
op = "Clear";
|
1104
|
-
break;
|
1105
|
-
case ColorBurnCompositeOp:
|
1106
|
-
op = "ColorBurn";
|
1107
|
-
break;
|
1108
|
-
case ColorDodgeCompositeOp:
|
1109
|
-
op = "ColorDodge";
|
1110
|
-
break;
|
1111
|
-
case ColorizeCompositeOp:
|
1112
|
-
op = "Colorize";
|
1113
|
-
break;
|
1114
|
-
case CopyBlackCompositeOp:
|
1115
|
-
op = "CopyBlack";
|
1116
|
-
break;
|
1117
|
-
case CopyBlueCompositeOp:
|
1118
|
-
op = "CopyBlue";
|
1119
|
-
break;
|
1120
|
-
case CopyCompositeOp:
|
1121
|
-
op = "Copy";
|
1122
|
-
break;
|
1123
|
-
case CopyCyanCompositeOp:
|
1124
|
-
op = "CopyCyan";
|
1125
|
-
break;
|
1126
|
-
case CopyGreenCompositeOp:
|
1127
|
-
op = "CopyGreen";
|
1128
|
-
break;
|
1129
|
-
case CopyMagentaCompositeOp:
|
1130
|
-
op = "CopyMagenta";
|
1131
|
-
break;
|
1132
|
-
case CopyOpacityCompositeOp:
|
1133
|
-
op = "CopyOpacity";
|
1134
|
-
break;
|
1135
|
-
case CopyRedCompositeOp:
|
1136
|
-
op = "CopyRed";
|
1137
|
-
break;
|
1138
|
-
case CopyYellowCompositeOp:
|
1139
|
-
op = "CopyYellow";
|
1140
|
-
break;
|
1141
|
-
case DarkenCompositeOp:
|
1142
|
-
op = "Darken";
|
1143
|
-
break;
|
1144
|
-
case DarkenIntensityCompositeOp:
|
1145
|
-
op = "DarkenIntensity";
|
1146
|
-
break;
|
1147
|
-
case DistortCompositeOp:
|
1148
|
-
op = "Distort";
|
1149
|
-
break;
|
1150
|
-
case DivideCompositeOp:
|
1151
|
-
op = "Divide";
|
1152
|
-
break;
|
1153
|
-
case DivideSrcCompositeOp:
|
1154
|
-
op = "DivideSrc";
|
1155
|
-
break;
|
1156
|
-
case DstCompositeOp:
|
1157
|
-
op = "Dst";
|
1158
|
-
break;
|
1159
|
-
case DstAtopCompositeOp:
|
1160
|
-
op = "DstAtop";
|
1161
|
-
break;
|
1162
|
-
case DstInCompositeOp:
|
1163
|
-
op = "DstIn";
|
1164
|
-
break;
|
1165
|
-
case DstOutCompositeOp:
|
1166
|
-
op = "DstOut";
|
1167
|
-
break;
|
1168
|
-
case DstOverCompositeOp:
|
1169
|
-
op = "DstOver";
|
1170
|
-
break;
|
1171
|
-
case DifferenceCompositeOp:
|
1172
|
-
op = "Difference";
|
1173
|
-
break;
|
1174
|
-
case DisplaceCompositeOp:
|
1175
|
-
op = "Displace";
|
1176
|
-
break;
|
1177
|
-
case DissolveCompositeOp:
|
1178
|
-
op = "Dissolve";
|
1179
|
-
break;
|
1180
|
-
case ExclusionCompositeOp:
|
1181
|
-
op = "Exclusion";
|
1182
|
-
break;
|
1183
|
-
case HardLightCompositeOp:
|
1184
|
-
op = "HardLight";
|
1185
|
-
break;
|
1186
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1187
|
-
case HardMixCompositeOp:
|
1188
|
-
op = "HardMix";
|
1189
|
-
break;
|
1190
|
-
#endif
|
1191
|
-
case HueCompositeOp:
|
1192
|
-
op = "Hue";
|
1193
|
-
break;
|
1194
|
-
case InCompositeOp:
|
1195
|
-
op = "In";
|
1196
|
-
break;
|
1197
|
-
case LightenCompositeOp:
|
1198
|
-
op = "Lighten";
|
1199
|
-
break;
|
1200
|
-
case LightenIntensityCompositeOp:
|
1201
|
-
op = "LightenIntensity";
|
1202
|
-
break;
|
1203
|
-
case LinearBurnCompositeOp:
|
1204
|
-
op = "LinearBurn";
|
1205
|
-
break;
|
1206
|
-
case LinearDodgeCompositeOp:
|
1207
|
-
op = "LinearDodge";
|
1208
|
-
break;
|
1209
|
-
case LinearLightCompositeOp:
|
1210
|
-
op = "LinearLight";
|
1211
|
-
break;
|
1212
|
-
case LuminizeCompositeOp:
|
1213
|
-
op = "Luminize";
|
1214
|
-
break;
|
1215
|
-
case MathematicsCompositeOp:
|
1216
|
-
op = "Mathematics";
|
1217
|
-
break;
|
1218
|
-
case MinusCompositeOp:
|
1219
|
-
op = "Minus";
|
1220
|
-
break;
|
1221
|
-
case MinusSrcCompositeOp:
|
1222
|
-
op = "MinusSrc";
|
1223
|
-
break;
|
1224
|
-
case ModulateCompositeOp:
|
1225
|
-
op = "Modulate";
|
1226
|
-
break;
|
1227
|
-
case MultiplyCompositeOp:
|
1228
|
-
op = "Multiply";
|
1229
|
-
break;
|
1230
|
-
case NoCompositeOp:
|
1231
|
-
op = "No";
|
1232
|
-
break;
|
1233
|
-
case OutCompositeOp:
|
1234
|
-
op = "Out";
|
1235
|
-
break;
|
1236
|
-
case OverCompositeOp:
|
1237
|
-
op = "Over";
|
1238
|
-
break;
|
1239
|
-
case OverlayCompositeOp:
|
1240
|
-
op = "Overlay";
|
1241
|
-
break;
|
1242
|
-
case PegtopLightCompositeOp:
|
1243
|
-
op = "PegtopLight";
|
1244
|
-
break;
|
1245
|
-
case PinLightCompositeOp:
|
1246
|
-
op = "PinLight";
|
1247
|
-
break;
|
1248
|
-
case PlusCompositeOp:
|
1249
|
-
op = "Plus";
|
1250
|
-
break;
|
1251
|
-
case ReplaceCompositeOp:
|
1252
|
-
op = "Replace";
|
1253
|
-
break;
|
1254
|
-
case SaturateCompositeOp:
|
1255
|
-
op = "Saturate";
|
1256
|
-
break;
|
1257
|
-
case ScreenCompositeOp:
|
1258
|
-
op = "Screen";
|
1259
|
-
break;
|
1260
|
-
case SoftLightCompositeOp:
|
1261
|
-
op = "SoftLight";
|
1262
|
-
break;
|
1263
|
-
case SrcCompositeOp:
|
1264
|
-
op = "Src";
|
1265
|
-
break;
|
1266
|
-
case SrcAtopCompositeOp:
|
1267
|
-
op = "SrcAtop";
|
1268
|
-
break;
|
1269
|
-
case SrcInCompositeOp:
|
1270
|
-
op = "SrcIn";
|
1271
|
-
break;
|
1272
|
-
case SrcOutCompositeOp:
|
1273
|
-
op = "SrcOut";
|
1274
|
-
break;
|
1275
|
-
case SrcOverCompositeOp:
|
1276
|
-
op = "SrcOver";
|
1277
|
-
break;
|
1278
|
-
case SubtractCompositeOp:
|
1279
|
-
op = "Subtract";
|
1280
|
-
break;
|
1281
|
-
case ThresholdCompositeOp:
|
1282
|
-
op = "Threshold";
|
1283
|
-
break;
|
1284
|
-
case UndefinedCompositeOp:
|
1285
|
-
op = "Undefined";
|
1286
|
-
break;
|
1287
|
-
case VividLightCompositeOp:
|
1288
|
-
op = "VividLight";
|
1289
|
-
break;
|
1290
|
-
case XorCompositeOp:
|
1291
|
-
op = "Xor";
|
1292
|
-
break;
|
1293
|
-
default:
|
1294
|
-
rb_raise(rb_eArgError, "unknown composite operator (%d)", cop);
|
1295
|
-
break;
|
1296
|
-
}
|
1083
|
+
op = CommandOptionToMnemonic(MagickComposeOptions, cop);
|
1084
|
+
if (rm_strcasecmp("Unrecognized", op) == 0)
|
1085
|
+
{
|
1086
|
+
rb_raise(rb_eArgError, "unknown composite operator (%d)", cop);
|
1297
1087
|
}
|
1298
1088
|
|
1299
1089
|
Data_Get_Struct(self, Draw, draw);
|
1300
1090
|
|
1301
1091
|
// Create a temp copy of the composite image
|
1302
|
-
Data_Get_Struct(image, Image, comp_img);
|
1303
1092
|
rm_write_temp_image(comp_img, name);
|
1304
1093
|
|
1305
1094
|
// Add the temp filename to the filename array.
|
@@ -1311,7 +1100,7 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1311
1100
|
draw->tmpfile_ary = tmpfile_name;
|
1312
1101
|
|
1313
1102
|
// Form the drawing primitive
|
1314
|
-
(void)
|
1103
|
+
(void) snprintf(primitive, sizeof(primitive), "image %s %g,%g,%g,%g '%s'", op, x, y, width, height, name);
|
1315
1104
|
|
1316
1105
|
|
1317
1106
|
// Send "primitive" to self.
|
@@ -1810,7 +1599,7 @@ rm_polaroid_new(void)
|
|
1810
1599
|
*
|
1811
1600
|
* @param self this object
|
1812
1601
|
* @param shadow the shadow color
|
1813
|
-
* @return
|
1602
|
+
* @return shadow
|
1814
1603
|
*/
|
1815
1604
|
VALUE
|
1816
1605
|
PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
@@ -1820,7 +1609,7 @@ PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
|
1820
1609
|
rb_check_frozen(self);
|
1821
1610
|
Data_Get_Struct(self, Draw, draw);
|
1822
1611
|
Color_to_PixelColor(&draw->shadow_color, shadow);
|
1823
|
-
return
|
1612
|
+
return shadow;
|
1824
1613
|
}
|
1825
1614
|
|
1826
1615
|
|
@@ -1832,7 +1621,7 @@ PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
|
1832
1621
|
*
|
1833
1622
|
* @param self this object
|
1834
1623
|
* @param border the border color
|
1835
|
-
* @return
|
1624
|
+
* @return border
|
1836
1625
|
*/
|
1837
1626
|
VALUE
|
1838
1627
|
PolaroidOptions_border_color_eq(VALUE self, VALUE border)
|
@@ -1842,7 +1631,7 @@ PolaroidOptions_border_color_eq(VALUE self, VALUE border)
|
|
1842
1631
|
rb_check_frozen(self);
|
1843
1632
|
Data_Get_Struct(self, Draw, draw);
|
1844
1633
|
Color_to_PixelColor(&draw->info->border_color, border);
|
1845
|
-
return
|
1634
|
+
return border;
|
1846
1635
|
}
|
1847
1636
|
|
1848
1637
|
|
@@ -1918,7 +1707,6 @@ get_type_metrics(
|
|
1918
1707
|
TypeMetric metrics;
|
1919
1708
|
char *text = NULL;
|
1920
1709
|
long text_l;
|
1921
|
-
long x;
|
1922
1710
|
unsigned int okay;
|
1923
1711
|
|
1924
1712
|
switch (argc)
|