rmagick 4.2.6 → 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/.devcontainer/ImageMagick6/devcontainer.json +1 -1
- data/.devcontainer/{ImageMagick7/devcontainer.json → devcontainer.json} +2 -2
- data/.devcontainer/setup-user.sh +1 -1
- data/.editorconfig +1 -1
- data/.github/workflows/ci.yml +87 -9
- data/.gitignore +4 -0
- data/.rubocop_todo.yml +16 -9
- data/.yardopts +1 -1
- data/CHANGELOG.md +130 -0
- data/Gemfile +20 -0
- data/README.md +10 -17
- data/Rakefile +63 -80
- data/before_install_linux.sh +3 -3
- data/before_install_osx.sh +6 -5
- data/ext/RMagick/extconf.rb +112 -52
- data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
- data/ext/RMagick/rmagick.h +88 -59
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +170 -159
- data/ext/RMagick/{rmenum.c → rmenum.cpp} +69 -50
- data/ext/RMagick/{rmfill.c → rmfill.cpp} +85 -24
- data/ext/RMagick/{rmilist.c → rmilist.cpp} +191 -93
- data/ext/RMagick/{rmimage.c → rmimage.cpp} +1543 -989
- data/ext/RMagick/{rminfo.c → rminfo.cpp} +140 -152
- data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +46 -34
- data/ext/RMagick/rmmain.cpp +1923 -0
- data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +50 -29
- data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +108 -83
- data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +6 -6
- data/ext/RMagick/{rmutil.c → rmutil.cpp} +62 -161
- data/lib/rmagick/version.rb +3 -1
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +76 -110
- 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 +4 -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 +59 -129
- data/.codeclimate.yml +0 -63
- data/deprecated/RMagick.rb +0 -6
- data/ext/RMagick/rmmain.c +0 -1951
@@ -5,8 +5,8 @@
|
|
5
5
|
*
|
6
6
|
* Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
|
7
7
|
*
|
8
|
-
* @file rmenum.
|
9
|
-
* @version $Id: rmenum.
|
8
|
+
* @file rmenum.cpp
|
9
|
+
* @version $Id: rmenum.cpp,v 1.9 2009/12/20 02:33:33 baror Exp $
|
10
10
|
* @author Tim Hunter
|
11
11
|
******************************************************************************/
|
12
12
|
|
@@ -18,9 +18,15 @@
|
|
18
18
|
|
19
19
|
static VALUE Enum_type_values(VALUE);
|
20
20
|
static VALUE Enum_type_inspect(VALUE);
|
21
|
+
static void rm_enum_free(void *magick_enum);
|
22
|
+
static size_t rm_enum_memsize(const void *magick_enum);
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
+
const rb_data_type_t rm_enum_data_type = {
|
25
|
+
"Magick::Enum",
|
26
|
+
{ NULL, rm_enum_free, rm_enum_memsize, },
|
27
|
+
0, 0,
|
28
|
+
RUBY_TYPED_FROZEN_SHAREABLE,
|
29
|
+
};
|
24
30
|
|
25
31
|
|
26
32
|
/**
|
@@ -34,14 +40,14 @@ static VALUE Enum_type_inspect(VALUE);
|
|
34
40
|
VALUE
|
35
41
|
rm_define_enum_type(const char *tag)
|
36
42
|
{
|
37
|
-
VALUE
|
43
|
+
VALUE klass;
|
38
44
|
|
39
|
-
|
45
|
+
klass = rb_define_class_under(Module_Magick, tag, Class_Enum);\
|
40
46
|
|
41
|
-
rb_define_singleton_method(
|
42
|
-
rb_define_method(
|
43
|
-
rb_define_method(
|
44
|
-
return
|
47
|
+
rb_define_singleton_method(klass, "values", RUBY_METHOD_FUNC(Enum_type_values), 0);
|
48
|
+
rb_define_method(klass, "initialize", RUBY_METHOD_FUNC(Enum_type_initialize), 2);
|
49
|
+
rb_define_method(klass, "inspect", RUBY_METHOD_FUNC(Enum_type_inspect), 0);
|
50
|
+
return klass;
|
45
51
|
}
|
46
52
|
|
47
53
|
|
@@ -50,19 +56,19 @@ rm_define_enum_type(const char *tag)
|
|
50
56
|
*
|
51
57
|
* No Ruby usage (internal function)
|
52
58
|
*
|
53
|
-
* @param
|
59
|
+
* @param klass the subclass
|
54
60
|
* @param sym the symbol
|
55
61
|
* @param val the value for the symbol
|
56
62
|
* @return a new instance of class
|
57
63
|
*/
|
58
64
|
VALUE
|
59
|
-
rm_enum_new(VALUE
|
65
|
+
rm_enum_new(VALUE klass, VALUE sym, VALUE val)
|
60
66
|
{
|
61
67
|
VALUE argv[2];
|
62
68
|
|
63
69
|
argv[0] = sym;
|
64
70
|
argv[1] = val;
|
65
|
-
return rb_obj_freeze(rb_class_new_instance(2, argv,
|
71
|
+
return rb_obj_freeze(rb_class_new_instance(2, argv, klass));
|
66
72
|
}
|
67
73
|
|
68
74
|
/**
|
@@ -78,7 +84,7 @@ rm_enum_to_cstr(VALUE enum_type)
|
|
78
84
|
{
|
79
85
|
MagickEnum *magick_enum;
|
80
86
|
|
81
|
-
|
87
|
+
TypedData_Get_Struct(enum_type, MagickEnum, &rm_enum_data_type, magick_enum);
|
82
88
|
return rb_id2name(magick_enum->id);
|
83
89
|
}
|
84
90
|
|
@@ -93,18 +99,31 @@ static void rm_enum_free(void *magick_enum)
|
|
93
99
|
{
|
94
100
|
xfree(magick_enum);
|
95
101
|
}
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Get Enum object size.
|
105
|
+
*
|
106
|
+
* No Ruby usage (internal function)
|
107
|
+
*
|
108
|
+
* @param magick_enum the enum
|
109
|
+
*/
|
110
|
+
static size_t rm_enum_memsize(const void *magick_enum)
|
111
|
+
{
|
112
|
+
return sizeof(MagickEnum);
|
113
|
+
}
|
114
|
+
|
96
115
|
/**
|
97
116
|
* Enum class alloc function.
|
98
117
|
*
|
99
118
|
* @return [Magick::Enum] a new enumerator
|
100
119
|
*/
|
101
120
|
VALUE
|
102
|
-
Enum_alloc(VALUE
|
121
|
+
Enum_alloc(VALUE klass)
|
103
122
|
{
|
104
123
|
MagickEnum *magick_enum;
|
105
124
|
VALUE enumr;
|
106
125
|
|
107
|
-
enumr =
|
126
|
+
enumr = TypedData_Make_Struct(klass, MagickEnum, &rm_enum_data_type, magick_enum);
|
108
127
|
rb_obj_freeze(enumr);
|
109
128
|
|
110
129
|
return enumr;
|
@@ -122,11 +141,11 @@ Enum_case_eq(VALUE self, VALUE other)
|
|
122
141
|
{
|
123
142
|
if (CLASS_OF(self) == CLASS_OF(other))
|
124
143
|
{
|
125
|
-
MagickEnum *
|
144
|
+
MagickEnum *self_enum, *other_enum;
|
126
145
|
|
127
|
-
|
128
|
-
|
129
|
-
return
|
146
|
+
TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, self_enum);
|
147
|
+
TypedData_Get_Struct(other, MagickEnum, &rm_enum_data_type, other_enum);
|
148
|
+
return self_enum->val == other_enum->val ? Qtrue : Qfalse;
|
130
149
|
}
|
131
150
|
|
132
151
|
return Qfalse;
|
@@ -145,7 +164,7 @@ Enum_initialize(VALUE self, VALUE sym, VALUE val)
|
|
145
164
|
{
|
146
165
|
MagickEnum *magick_enum;
|
147
166
|
|
148
|
-
|
167
|
+
TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, magick_enum);
|
149
168
|
magick_enum->id = rb_to_id(sym); /* convert symbol to ID */
|
150
169
|
magick_enum->val = NUM2INT(val);
|
151
170
|
|
@@ -163,7 +182,7 @@ Enum_to_i(VALUE self)
|
|
163
182
|
{
|
164
183
|
MagickEnum *magick_enum;
|
165
184
|
|
166
|
-
|
185
|
+
TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, magick_enum);
|
167
186
|
return INT2NUM(magick_enum->val);
|
168
187
|
}
|
169
188
|
|
@@ -177,20 +196,20 @@ Enum_to_i(VALUE self)
|
|
177
196
|
VALUE
|
178
197
|
Enum_spaceship(VALUE self, VALUE other)
|
179
198
|
{
|
180
|
-
MagickEnum *
|
199
|
+
MagickEnum *self_enum, *other_enum;
|
181
200
|
|
182
201
|
if(CLASS_OF(self) != CLASS_OF(other)) {
|
183
202
|
return Qnil;
|
184
203
|
}
|
185
204
|
|
186
|
-
|
187
|
-
|
205
|
+
TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, self_enum);
|
206
|
+
TypedData_Get_Struct(other, MagickEnum, &rm_enum_data_type, other_enum);
|
188
207
|
|
189
|
-
if (
|
208
|
+
if (self_enum->val > other_enum->val)
|
190
209
|
{
|
191
210
|
return INT2FIX(1);
|
192
211
|
}
|
193
|
-
else if (
|
212
|
+
else if (self_enum->val < other_enum->val)
|
194
213
|
{
|
195
214
|
return INT2FIX(-1);
|
196
215
|
}
|
@@ -205,25 +224,25 @@ Enum_spaceship(VALUE self, VALUE other)
|
|
205
224
|
* @return [Magick::Enum] new Enum instance
|
206
225
|
*/
|
207
226
|
VALUE
|
208
|
-
Enum_bitwise_or(VALUE self, VALUE
|
227
|
+
Enum_bitwise_or(VALUE self, VALUE other)
|
209
228
|
{
|
210
|
-
VALUE new_enum,
|
211
|
-
MagickEnum *
|
229
|
+
VALUE new_enum, klass;
|
230
|
+
MagickEnum *self_enum, *other_enum, *new_enum_data;
|
212
231
|
|
213
|
-
|
214
|
-
if (CLASS_OF(
|
232
|
+
klass = CLASS_OF(self);
|
233
|
+
if (CLASS_OF(other) != klass)
|
215
234
|
{
|
216
|
-
rb_raise(rb_eArgError, "Expected class %s but got %s", rb_class2name(
|
235
|
+
rb_raise(rb_eArgError, "Expected class %s but got %s", rb_class2name(klass), rb_class2name(CLASS_OF(other)));
|
217
236
|
}
|
218
237
|
|
219
|
-
new_enum = Enum_alloc(
|
238
|
+
new_enum = Enum_alloc(klass);
|
220
239
|
|
221
|
-
|
222
|
-
|
223
|
-
|
240
|
+
TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, self_enum);
|
241
|
+
TypedData_Get_Struct(other, MagickEnum, &rm_enum_data_type, other_enum);
|
242
|
+
TypedData_Get_Struct(new_enum, MagickEnum, &rm_enum_data_type, new_enum_data);
|
224
243
|
|
225
|
-
new_enum_data->id = rb_to_id(rb_sprintf("%s|%s", rb_id2name(
|
226
|
-
new_enum_data->val =
|
244
|
+
new_enum_data->id = rb_to_id(rb_sprintf("%s|%s", rb_id2name(self_enum->id), rb_id2name(other_enum->id)));
|
245
|
+
new_enum_data->val = self_enum->val | other_enum->val;
|
227
246
|
|
228
247
|
return new_enum;
|
229
248
|
}
|
@@ -282,7 +301,7 @@ Enum_type_inspect(VALUE self)
|
|
282
301
|
char str[100];
|
283
302
|
MagickEnum *magick_enum;
|
284
303
|
|
285
|
-
|
304
|
+
TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, magick_enum);
|
286
305
|
snprintf(str, sizeof(str), "%.48s=%d", rb_id2name(magick_enum->id), magick_enum->val);
|
287
306
|
|
288
307
|
return rb_str_new2(str);
|
@@ -302,13 +321,13 @@ Enum_type_inspect(VALUE self)
|
|
302
321
|
* @return [Magick::Enum] self
|
303
322
|
*/
|
304
323
|
static VALUE
|
305
|
-
Enum_type_values(VALUE
|
324
|
+
Enum_type_values(VALUE klass)
|
306
325
|
{
|
307
326
|
VALUE enumerators, copy;
|
308
327
|
VALUE rv;
|
309
328
|
int x;
|
310
329
|
|
311
|
-
enumerators = rb_cv_get(
|
330
|
+
enumerators = rb_cv_get(klass, ENUMERATORS_CLASS_VAR);
|
312
331
|
|
313
332
|
if (rb_block_given_p())
|
314
333
|
{
|
@@ -316,7 +335,7 @@ Enum_type_values(VALUE class)
|
|
316
335
|
{
|
317
336
|
rb_yield(rb_ary_entry(enumerators, x));
|
318
337
|
}
|
319
|
-
rv =
|
338
|
+
rv = klass;
|
320
339
|
}
|
321
340
|
else
|
322
341
|
{
|
@@ -341,25 +360,25 @@ Enum_type_values(VALUE class)
|
|
341
360
|
*
|
342
361
|
* No Ruby usage (internal function)
|
343
362
|
*
|
344
|
-
* @param
|
363
|
+
* @param klass the class type
|
345
364
|
* @param value the value for enum
|
346
365
|
* @return a enumerator
|
347
366
|
*/
|
348
367
|
|
349
368
|
VALUE
|
350
|
-
Enum_find(VALUE
|
369
|
+
Enum_find(VALUE klass, int val)
|
351
370
|
{
|
352
371
|
VALUE enumerators;
|
353
372
|
MagickEnum *magick_enum;
|
354
373
|
int x;
|
355
374
|
|
356
|
-
enumerators = rb_cv_get(
|
375
|
+
enumerators = rb_cv_get(klass, ENUMERATORS_CLASS_VAR);
|
357
376
|
enumerators = rm_check_ary_type(enumerators);
|
358
377
|
|
359
378
|
for (x = 0; x < RARRAY_LEN(enumerators); x++)
|
360
379
|
{
|
361
380
|
VALUE enumerator = rb_ary_entry(enumerators, x);
|
362
|
-
|
381
|
+
TypedData_Get_Struct(enumerator, MagickEnum, &rm_enum_data_type, magick_enum);
|
363
382
|
if (magick_enum->val == val)
|
364
383
|
{
|
365
384
|
return enumerator;
|
@@ -379,9 +398,9 @@ Enum_find(VALUE class, int val)
|
|
379
398
|
* @return a new enumerator
|
380
399
|
*/
|
381
400
|
VALUE
|
382
|
-
ClassType_find(ClassType
|
401
|
+
ClassType_find(ClassType klass)
|
383
402
|
{
|
384
|
-
return Enum_find(Class_ClassType,
|
403
|
+
return Enum_find(Class_ClassType, klass);
|
385
404
|
}
|
386
405
|
|
387
406
|
|
@@ -466,7 +485,7 @@ ComplianceType_find(ComplianceType compliance)
|
|
466
485
|
if ((compliance & (SVGCompliance|X11Compliance|XPMCompliance))
|
467
486
|
== (SVGCompliance|X11Compliance|XPMCompliance))
|
468
487
|
{
|
469
|
-
c = SVGCompliance|X11Compliance|XPMCompliance;
|
488
|
+
c = (ComplianceType)(SVGCompliance|X11Compliance|XPMCompliance);
|
470
489
|
}
|
471
490
|
else if (compliance & SVGCompliance)
|
472
491
|
{
|
@@ -5,13 +5,18 @@
|
|
5
5
|
*
|
6
6
|
* Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
|
7
7
|
*
|
8
|
-
* @file rmfill.
|
9
|
-
* @version $Id: rmfill.
|
8
|
+
* @file rmfill.cpp
|
9
|
+
* @version $Id: rmfill.cpp,v 1.33 2009/12/20 02:33:33 baror Exp $
|
10
10
|
* @author Tim Hunter
|
11
11
|
******************************************************************************/
|
12
12
|
|
13
13
|
#include "rmagick.h"
|
14
14
|
|
15
|
+
static void GradientFill_free(void *fill);
|
16
|
+
static size_t GradientFill_memsize(const void *ptr);
|
17
|
+
static void TextureFill_free(void *fill_obj);
|
18
|
+
static size_t TextureFill_memsize(const void *ptr);
|
19
|
+
|
15
20
|
/** Data associated with a GradientFill */
|
16
21
|
typedef struct
|
17
22
|
{
|
@@ -29,29 +34,63 @@ typedef struct
|
|
29
34
|
Image *texture; /**< the texture */
|
30
35
|
} rm_TextureFill;
|
31
36
|
|
37
|
+
const rb_data_type_t rm_gradient_fill_data_type = {
|
38
|
+
"Magick::GradientFill",
|
39
|
+
{ NULL, GradientFill_free, GradientFill_memsize, },
|
40
|
+
0, 0,
|
41
|
+
RUBY_TYPED_FROZEN_SHAREABLE,
|
42
|
+
};
|
43
|
+
|
44
|
+
const rb_data_type_t rm_texture_fill_data_type = {
|
45
|
+
"Magick::TextureFill",
|
46
|
+
{ NULL, TextureFill_free, TextureFill_memsize, },
|
47
|
+
0, 0,
|
48
|
+
RUBY_TYPED_FROZEN_SHAREABLE,
|
49
|
+
};
|
50
|
+
|
51
|
+
|
52
|
+
DEFINE_GVL_STUB2(SyncAuthenticPixels, Image *, ExceptionInfo *);
|
53
|
+
|
54
|
+
|
32
55
|
/**
|
33
|
-
* Free
|
56
|
+
* Free GradientFill or GradientFill subclass object (except for TextureFill).
|
34
57
|
*
|
35
58
|
* No Ruby usage (internal function)
|
36
59
|
*
|
37
60
|
* @param fill the fill
|
38
61
|
*/
|
39
|
-
static void
|
62
|
+
static void
|
63
|
+
GradientFill_free(void *fill)
|
40
64
|
{
|
41
65
|
xfree(fill);
|
42
66
|
}
|
43
67
|
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Get GradientFill object size.
|
71
|
+
*
|
72
|
+
* No Ruby usage (internal function)
|
73
|
+
*
|
74
|
+
* @param ptr pointer to the GradientFill object
|
75
|
+
*/
|
76
|
+
static size_t
|
77
|
+
GradientFill_memsize(const void *ptr)
|
78
|
+
{
|
79
|
+
return sizeof(rm_GradientFill);
|
80
|
+
}
|
81
|
+
|
82
|
+
|
44
83
|
/**
|
45
84
|
* Create new GradientFill object.
|
46
85
|
*
|
47
86
|
* @return [Magick::GradientFill] a new GradientFill object
|
48
87
|
*/
|
49
88
|
VALUE
|
50
|
-
GradientFill_alloc(VALUE
|
89
|
+
GradientFill_alloc(VALUE klass)
|
51
90
|
{
|
52
91
|
rm_GradientFill *fill;
|
53
92
|
|
54
|
-
return
|
93
|
+
return TypedData_Make_Struct(klass, rm_GradientFill, &rm_gradient_fill_data_type, fill);
|
55
94
|
}
|
56
95
|
|
57
96
|
|
@@ -78,7 +117,7 @@ GradientFill_initialize(
|
|
78
117
|
{
|
79
118
|
rm_GradientFill *fill;
|
80
119
|
|
81
|
-
|
120
|
+
TypedData_Get_Struct(self, rm_GradientFill, &rm_gradient_fill_data_type, fill);
|
82
121
|
|
83
122
|
fill->x1 = NUM2DBL(x1);
|
84
123
|
fill->y1 = NUM2DBL(y1);
|
@@ -153,7 +192,8 @@ point_fill(
|
|
153
192
|
#endif
|
154
193
|
}
|
155
194
|
|
156
|
-
SyncAuthenticPixels
|
195
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
196
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
157
197
|
CHECK_EXCEPTION();
|
158
198
|
}
|
159
199
|
|
@@ -222,7 +262,8 @@ vertical_fill(
|
|
222
262
|
row_pixels += GetPixelChannels(image);
|
223
263
|
}
|
224
264
|
|
225
|
-
SyncAuthenticPixels
|
265
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
266
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
226
267
|
CHECK_EXCEPTION();
|
227
268
|
}
|
228
269
|
|
@@ -255,7 +296,8 @@ vertical_fill(
|
|
255
296
|
|
256
297
|
memcpy(row_pixels, master, image->columns * sizeof(PixelPacket));
|
257
298
|
|
258
|
-
SyncAuthenticPixels
|
299
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
300
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
259
301
|
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
260
302
|
{
|
261
303
|
xfree((void *)master);
|
@@ -328,7 +370,8 @@ horizontal_fill(
|
|
328
370
|
row_pixels += GetPixelChannels(image);
|
329
371
|
}
|
330
372
|
|
331
|
-
SyncAuthenticPixels
|
373
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
374
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
332
375
|
CHECK_EXCEPTION();
|
333
376
|
}
|
334
377
|
|
@@ -360,7 +403,8 @@ horizontal_fill(
|
|
360
403
|
|
361
404
|
memcpy(col_pixels, master, image->rows * sizeof(PixelPacket));
|
362
405
|
|
363
|
-
SyncAuthenticPixels
|
406
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
407
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
364
408
|
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
365
409
|
{
|
366
410
|
xfree((void *)master);
|
@@ -471,7 +515,8 @@ v_diagonal_fill(
|
|
471
515
|
#endif
|
472
516
|
}
|
473
517
|
|
474
|
-
SyncAuthenticPixels
|
518
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
519
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
475
520
|
CHECK_EXCEPTION();
|
476
521
|
}
|
477
522
|
|
@@ -577,7 +622,8 @@ h_diagonal_fill(
|
|
577
622
|
#endif
|
578
623
|
}
|
579
624
|
|
580
|
-
SyncAuthenticPixels
|
625
|
+
GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
|
626
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
|
581
627
|
CHECK_EXCEPTION();
|
582
628
|
}
|
583
629
|
|
@@ -588,7 +634,7 @@ h_diagonal_fill(
|
|
588
634
|
* Call GradientFill with the start and stop colors specified when this fill
|
589
635
|
* object was created.
|
590
636
|
*
|
591
|
-
* @param image_obj [Magick::Image] the image to fill
|
637
|
+
* @param image_obj [Magick::Image, Magick::ImageList] the image to fill
|
592
638
|
* @return [Magick::GradientFill] self
|
593
639
|
*/
|
594
640
|
VALUE
|
@@ -599,8 +645,8 @@ GradientFill_fill(VALUE self, VALUE image_obj)
|
|
599
645
|
PixelColor start_color, stop_color;
|
600
646
|
double x1, y1, x2, y2; // points on the line
|
601
647
|
|
602
|
-
|
603
|
-
image = rm_check_destroyed(image_obj);
|
648
|
+
TypedData_Get_Struct(self, rm_GradientFill, &rm_gradient_fill_data_type, fill);
|
649
|
+
image = rm_check_destroyed(rm_cur_image(image_obj));
|
604
650
|
|
605
651
|
x1 = fill->x1;
|
606
652
|
y1 = fill->y1;
|
@@ -662,7 +708,7 @@ GradientFill_fill(VALUE self, VALUE image_obj)
|
|
662
708
|
* @param fill_obj the TextureFill
|
663
709
|
*/
|
664
710
|
static void
|
665
|
-
|
711
|
+
TextureFill_free(void *fill_obj)
|
666
712
|
{
|
667
713
|
rm_TextureFill *fill = (rm_TextureFill *)fill_obj;
|
668
714
|
|
@@ -674,16 +720,31 @@ free_TextureFill(void *fill_obj)
|
|
674
720
|
xfree(fill);
|
675
721
|
}
|
676
722
|
|
723
|
+
|
724
|
+
/**
|
725
|
+
* Get TextureFill object size.
|
726
|
+
*
|
727
|
+
* No Ruby usage (internal function)
|
728
|
+
*
|
729
|
+
* @param ptr pointer to the TextureFill object
|
730
|
+
*/
|
731
|
+
static size_t
|
732
|
+
TextureFill_memsize(const void *ptr)
|
733
|
+
{
|
734
|
+
return sizeof(rm_TextureFill);
|
735
|
+
}
|
736
|
+
|
737
|
+
|
677
738
|
/**
|
678
739
|
* Create new TextureFill object.
|
679
740
|
*
|
680
741
|
* @return [Magick::TextureFill] a new TextureFill object
|
681
742
|
*/
|
682
743
|
VALUE
|
683
|
-
TextureFill_alloc(VALUE
|
744
|
+
TextureFill_alloc(VALUE klass)
|
684
745
|
{
|
685
746
|
rm_TextureFill *fill;
|
686
|
-
return
|
747
|
+
return TypedData_Make_Struct(klass, rm_TextureFill, &rm_texture_fill_data_type, fill);
|
687
748
|
}
|
688
749
|
|
689
750
|
/**
|
@@ -700,7 +761,7 @@ TextureFill_initialize(VALUE self, VALUE texture_arg)
|
|
700
761
|
Image *texture;
|
701
762
|
VALUE texture_image;
|
702
763
|
|
703
|
-
|
764
|
+
TypedData_Get_Struct(self, rm_TextureFill, &rm_texture_fill_data_type, fill);
|
704
765
|
|
705
766
|
texture_image = rm_cur_image(texture_arg);
|
706
767
|
|
@@ -719,7 +780,7 @@ TextureFill_initialize(VALUE self, VALUE texture_arg)
|
|
719
780
|
* Call TextureFill with the texture specified when this fill object was
|
720
781
|
* created.
|
721
782
|
*
|
722
|
-
* @param image_obj [Magick::Image] the image to fill
|
783
|
+
* @param image_obj [Magick::Image, Magick::ImageList] the image to fill
|
723
784
|
* @return [Magick::TextureFill] self
|
724
785
|
*/
|
725
786
|
VALUE
|
@@ -731,8 +792,8 @@ TextureFill_fill(VALUE self, VALUE image_obj)
|
|
731
792
|
ExceptionInfo *exception;
|
732
793
|
#endif
|
733
794
|
|
734
|
-
image = rm_check_destroyed(image_obj);
|
735
|
-
|
795
|
+
image = rm_check_destroyed(rm_cur_image(image_obj));
|
796
|
+
TypedData_Get_Struct(self, rm_TextureFill, &rm_texture_fill_data_type, fill);
|
736
797
|
|
737
798
|
#if defined(IMAGEMAGICK_7)
|
738
799
|
exception = AcquireExceptionInfo();
|