rmagick 1.15.17 → 2.0.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.
- data/ChangeLog +78 -25
- data/README.html +117 -188
- data/README.txt +116 -181
- data/build_tarball.rake +205 -0
- data/doc/comtasks.html +2 -2
- data/doc/constants.html +118 -44
- data/doc/draw.html +57 -99
- data/doc/ex/adaptive_threshold.rb +1 -10
- data/doc/ex/add_noise.rb +4 -5
- data/doc/ex/axes.rb +1 -1
- data/doc/ex/bilevel_channel.rb +2 -13
- data/doc/ex/bounding_box.rb +3 -4
- data/doc/ex/channel.rb +6 -7
- data/doc/ex/clip_path.rb +11 -5
- data/doc/ex/color_histogram.rb +8 -20
- data/doc/ex/composite_layers.rb +53 -0
- data/doc/ex/fill_pattern.rb +26 -0
- data/doc/ex/get_multiline_type_metrics.rb +26 -37
- data/doc/ex/get_type_metrics.rb +25 -25
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/level.rb +1 -1
- data/doc/ex/matte_floodfill.rb +5 -6
- data/doc/ex/matte_replace.rb +5 -6
- data/doc/ex/negate_channel.rb +0 -10
- data/doc/ex/opacity.rb +3 -5
- data/doc/ex/polaroid.rb +4 -1
- data/doc/ex/posterize.rb +1 -12
- data/doc/ex/preview.rb +1 -8
- data/doc/ex/radial_blur.rb +1 -11
- data/doc/ex/raise.rb +1 -4
- data/doc/ex/random_threshold_channel.rb +4 -9
- data/doc/ex/sepiatone.rb +2 -9
- data/doc/ex/shadow.rb +12 -18
- data/doc/ex/sketch.rb +2 -9
- data/doc/ex/smile.rb +7 -7
- data/doc/ex/splice.rb +3 -10
- data/doc/ex/stegano.rb +5 -0
- data/doc/ex/threshold.rb +2 -2
- data/doc/ex/transpose.rb +1 -8
- data/doc/ex/transverse.rb +1 -8
- data/doc/ex/trim.rb +1 -2
- data/doc/ex/viewex.rb +4 -5
- data/doc/ex/vignette.rb +1 -8
- data/doc/ex/watermark.rb +1 -0
- data/doc/ex/wet_floor.rb +8 -14
- data/doc/ilist.html +301 -110
- data/doc/image1.html +362 -258
- data/doc/image2.html +429 -286
- data/doc/image3.html +418 -192
- data/doc/imageattrs.html +100 -39
- data/doc/imusage.html +26 -21
- data/doc/index.html +52 -93
- data/doc/info.html +160 -64
- data/doc/magick.html +37 -71
- data/doc/optequiv.html +155 -61
- data/doc/rvg.html +3 -3
- data/doc/rvgclip.html +2 -2
- data/doc/rvggroup.html +2 -2
- data/doc/rvgimage.html +3 -3
- data/doc/rvgpattern.html +3 -3
- data/doc/rvgshape.html +2 -2
- data/doc/rvgstyle.html +2 -2
- data/doc/rvgtext.html +2 -2
- data/doc/rvgtspan.html +4 -4
- data/doc/rvgtut.html +4 -4
- data/doc/rvguse.html +3 -3
- data/doc/rvgxform.html +2 -2
- data/doc/struct.html +26 -29
- data/doc/usage.html +99 -48
- data/examples/crop_with_gravity.rb +46 -0
- data/examples/demo.rb +2 -2
- data/examples/histogram.rb +11 -11
- data/examples/identify.rb +45 -45
- data/examples/spinner.rb +3 -2
- data/ext/RMagick/MANIFEST +7 -8
- data/ext/RMagick/extconf.rb +242 -0
- data/ext/RMagick/rmagick.h +136 -222
- data/ext/RMagick/rmdraw.c +226 -229
- data/ext/RMagick/rmfill.c +69 -118
- data/ext/RMagick/rmilist.c +234 -94
- data/ext/RMagick/rmimage.c +1719 -2564
- data/ext/RMagick/rminfo.c +433 -619
- data/ext/RMagick/rmmain.c +249 -487
- data/ext/RMagick/rmutil.c +344 -563
- data/lib/RMagick.rb +414 -358
- data/lib/rvg/clippath.rb +2 -2
- data/lib/rvg/container.rb +2 -2
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +2 -2
- data/lib/rvg/misc.rb +3 -3
- data/lib/rvg/paint.rb +2 -7
- data/lib/rvg/pathdata.rb +2 -2
- data/lib/rvg/rvg.rb +2 -2
- data/lib/rvg/stretchable.rb +2 -14
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/text.rb +2 -2
- data/lib/rvg/transformable.rb +2 -2
- data/lib/rvg/units.rb +2 -2
- data/{metaconfig.in → metaconfig} +0 -1
- data/post-setup.rb +1 -1
- data/rmagick.gemspec +6 -9
- metadata +41 -49
- data/Makefile.in +0 -42
- data/configure +0 -12358
- data/configure.ac +0 -791
- data/ext/RMagick/extconf.rb.in +0 -25
- data/ext/RMagick/rmagick_config.h.in +0 -285
- data/gem_extconf.rb +0 -42
data/ext/RMagick/rmutil.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
/* $Id: rmutil.c,v 1.
|
1
|
+
/* $Id: rmutil.c,v 1.138 2007/12/26 21:43:52 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
|
-
| Copyright (C)
|
3
|
+
| Copyright (C) 2007 by Timothy P. Hunter
|
4
4
|
| Name: rmutil.c
|
5
5
|
| Author: Tim Hunter
|
6
6
|
| Purpose: Utility functions for RMagick
|
@@ -16,58 +16,46 @@ static void Color_Name_to_PixelPacket(PixelPacket *, VALUE);
|
|
16
16
|
static VALUE Enum_type_values(VALUE);
|
17
17
|
static VALUE Enum_type_inspect(VALUE);
|
18
18
|
static void handle_exception(ExceptionInfo *, Image *, ErrorRetention);
|
19
|
-
#if defined(HAVE_NEW_COLORINFO)
|
20
19
|
static VALUE Pixel_from_MagickPixelPacket(MagickPixelPacket *);
|
21
|
-
#endif
|
22
20
|
|
23
|
-
|
21
|
+
|
24
22
|
/*
|
25
|
-
|
23
|
+
Extern: magick_safe_malloc, magick_malloc, magick_free, magick_realloc
|
24
|
+
Purpose: ImageMagick versions of standard memory routines.
|
25
|
+
Notes: use when managing memory that ImageMagick may have
|
26
|
+
allocated or may free.
|
27
|
+
|
28
|
+
If malloc fails, it raises an exception.
|
29
|
+
|
30
|
+
magick_safe_malloc and magick_safe_realloc prevent exceptions
|
31
|
+
caused by integer overflow. Added in 6.3.5-9 but backwards
|
32
|
+
compatible with prior releases.
|
26
33
|
*/
|
27
|
-
|
34
|
+
void *magick_safe_malloc(const size_t count, const size_t quantum)
|
28
35
|
{
|
29
|
-
|
30
|
-
|
31
|
-
}
|
36
|
+
#if defined(HAVE_ACQUIREQUANTUMMEMORY)
|
37
|
+
void *ptr;
|
32
38
|
|
33
|
-
|
34
|
-
|
35
|
-
if (memory)
|
39
|
+
ptr = AcquireQuantumMemory(count, quantum);
|
40
|
+
if (!ptr)
|
36
41
|
{
|
37
|
-
|
42
|
+
rb_raise(rb_eNoMemError, "not enough memory to continue");
|
38
43
|
}
|
39
|
-
return
|
40
|
-
|
44
|
+
return ptr;
|
45
|
+
#else
|
41
46
|
|
42
|
-
|
43
|
-
|
44
|
-
void *new;
|
47
|
+
// Provide an implementation of AcquireQuantumMemory in releases prior to 6.3.5-9.
|
48
|
+
size_t size = count * quantum;
|
45
49
|
|
46
|
-
if (
|
47
|
-
{
|
48
|
-
return malloc(size);
|
49
|
-
}
|
50
|
-
if (size == 0)
|
51
|
-
{
|
52
|
-
free(memory);
|
53
|
-
return NULL;
|
54
|
-
}
|
55
|
-
new = realloc(memory, size);
|
56
|
-
if (!new)
|
50
|
+
if (count == 0 || quantum != (size/count))
|
57
51
|
{
|
58
|
-
|
52
|
+
rb_raise(rb_eRuntimeError, "integer overflow detected in memory size computation. "
|
53
|
+
"Probable image corruption.");
|
59
54
|
}
|
60
|
-
return
|
61
|
-
}
|
55
|
+
return magick_malloc(size);
|
62
56
|
#endif
|
57
|
+
}
|
63
58
|
|
64
|
-
/*
|
65
|
-
Extern: magick_malloc, magick_free, magick_realloc
|
66
|
-
Purpose: ****Magick versions of standard memory routines.
|
67
|
-
Notes: use when managing memory that ****Magick may have
|
68
|
-
allocated or may free.
|
69
|
-
If malloc fails, it raises an exception
|
70
|
-
*/
|
71
59
|
void *magick_malloc(const size_t size)
|
72
60
|
{
|
73
61
|
void *ptr;
|
@@ -85,6 +73,28 @@ void magick_free(void *ptr)
|
|
85
73
|
(void) RelinquishMagickMemory(ptr);
|
86
74
|
}
|
87
75
|
|
76
|
+
void *magick_safe_realloc(void *memory, const size_t count, const size_t quantum)
|
77
|
+
{
|
78
|
+
#if defined(HAVE_RESIZEQUANTUMMEMORY)
|
79
|
+
void *v;
|
80
|
+
v = ResizeQuantumMemory(memory, count, quantum);
|
81
|
+
if (!v)
|
82
|
+
{
|
83
|
+
rb_raise(rb_eNoMemError, "not enough memory to continue");
|
84
|
+
}
|
85
|
+
return v;
|
86
|
+
#else
|
87
|
+
// Provide an implementation of ResizeQuantumMemory in releases prior to 6.3.5-9.
|
88
|
+
size_t size = count * quantum;
|
89
|
+
if (count == 0 || quantum != (size/count))
|
90
|
+
{
|
91
|
+
rb_raise(rb_eRuntimeError, "integer overflow detected in memory size computation. "
|
92
|
+
"Probable image corruption.");
|
93
|
+
}
|
94
|
+
return magick_realloc(memory, size);
|
95
|
+
#endif
|
96
|
+
}
|
97
|
+
|
88
98
|
void *magick_realloc(void *ptr, const size_t size)
|
89
99
|
{
|
90
100
|
void *v;
|
@@ -110,57 +120,6 @@ void magick_clone_string(char **new_str, const char *str)
|
|
110
120
|
}
|
111
121
|
|
112
122
|
|
113
|
-
|
114
|
-
/*
|
115
|
-
Extern: rm_string_value_ptr(VALUE*)
|
116
|
-
Purpose: emulate Ruby 1.8's rb_string_value_ptr
|
117
|
-
Notes: This is essentially 1.8's rb_string_value_ptr
|
118
|
-
with a few minor changes to make it work in 1.6.
|
119
|
-
Always called via STRING_PTR
|
120
|
-
*/
|
121
|
-
#if !defined StringValuePtr
|
122
|
-
char *
|
123
|
-
rm_string_value_ptr(volatile VALUE *ptr)
|
124
|
-
{
|
125
|
-
volatile VALUE s = *ptr;
|
126
|
-
|
127
|
-
// If VALUE is not a string, call to_str on it
|
128
|
-
if (TYPE(s) != T_STRING)
|
129
|
-
{
|
130
|
-
s = rb_str_to_str(s);
|
131
|
-
*ptr = s;
|
132
|
-
}
|
133
|
-
// If ptr == NULL, allocate a 1 char array
|
134
|
-
if (!RSTRING(s)->ptr)
|
135
|
-
{
|
136
|
-
RSTRING(s)->ptr = ALLOC_N(char, 1);
|
137
|
-
(RSTRING(s)->ptr)[0] = 0;
|
138
|
-
RSTRING(s)->orig = 0;
|
139
|
-
}
|
140
|
-
return RSTRING(s)->ptr;
|
141
|
-
}
|
142
|
-
#endif
|
143
|
-
|
144
|
-
/*
|
145
|
-
Extern: rm_string_value_ptr_len
|
146
|
-
Purpose: safe replacement for rb_str2cstr
|
147
|
-
Returns: stores string length in 2nd arg, returns ptr to C string
|
148
|
-
Notes: Uses rb/rm_string_value_ptr to ensure correct String
|
149
|
-
argument.
|
150
|
-
Always called via STRING_PTR_LEN
|
151
|
-
*/
|
152
|
-
char *rm_string_value_ptr_len(volatile VALUE *ptr, long *len)
|
153
|
-
{
|
154
|
-
volatile VALUE v = *ptr;
|
155
|
-
char *str;
|
156
|
-
|
157
|
-
str = STRING_PTR(v);
|
158
|
-
*ptr = v;
|
159
|
-
*len = RSTRING(v)->len;
|
160
|
-
return str;
|
161
|
-
}
|
162
|
-
|
163
|
-
|
164
123
|
/*
|
165
124
|
* Extern: rm_strcasecmp(s1, s2)
|
166
125
|
* Purpose: compare s1 and s2 ignoring case
|
@@ -182,6 +141,8 @@ rm_strcasecmp(const char *s1, const char *s2)
|
|
182
141
|
}
|
183
142
|
|
184
143
|
|
144
|
+
|
145
|
+
|
185
146
|
/*
|
186
147
|
* Extern: rm_strncasecmp(s1, s2, n)
|
187
148
|
* Purpose: compare s1 and s2 ignoring case
|
@@ -208,8 +169,6 @@ rm_strncasecmp(const char *s1, const char *s2, size_t n)
|
|
208
169
|
|
209
170
|
|
210
171
|
|
211
|
-
|
212
|
-
|
213
172
|
/*
|
214
173
|
* Extern: rm_check_ary_len(ary, len)
|
215
174
|
* Purpose: raise exception if array too short
|
@@ -220,21 +179,40 @@ rm_check_ary_len(VALUE ary, long len)
|
|
220
179
|
if (RARRAY(ary)->len < len)
|
221
180
|
{
|
222
181
|
rb_raise(rb_eIndexError, "not enough elements in array - expecting %ld, got %ld",
|
223
|
-
len, RARRAY(ary)->len);
|
182
|
+
len, (long)RARRAY(ary)->len);
|
224
183
|
}
|
225
184
|
}
|
226
185
|
|
186
|
+
|
227
187
|
/*
|
228
|
-
Extern:
|
229
|
-
Purpose:
|
188
|
+
Extern: rm_check_destroyed
|
189
|
+
Purpose: raise an error if the image has been destroyed
|
230
190
|
*/
|
231
|
-
|
232
|
-
|
191
|
+
Image *
|
192
|
+
rm_check_destroyed(VALUE obj)
|
233
193
|
{
|
234
|
-
|
194
|
+
Image *image;
|
195
|
+
|
196
|
+
Data_Get_Struct(obj, Image, image);
|
197
|
+
if (!image)
|
235
198
|
{
|
236
|
-
|
199
|
+
rb_raise(Class_DestroyedImageError, "destroyed image");
|
237
200
|
}
|
201
|
+
|
202
|
+
return image;
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
/*
|
207
|
+
Extern: rm_check_frozen_image
|
208
|
+
Purpose: raise an error if the image has been destroyed or is frozen
|
209
|
+
*/
|
210
|
+
Image *
|
211
|
+
rm_check_frozen_image(VALUE obj)
|
212
|
+
{
|
213
|
+
Image *image = rm_check_destroyed(obj);
|
214
|
+
rb_check_frozen(obj);
|
215
|
+
return image;
|
238
216
|
}
|
239
217
|
|
240
218
|
|
@@ -296,7 +274,7 @@ rm_percentage(VALUE arg)
|
|
296
274
|
if (not_num)
|
297
275
|
{
|
298
276
|
arg = rb_rescue(rb_str_to_str, arg, rescue_not_str, arg);
|
299
|
-
pct_str =
|
277
|
+
pct_str = StringValuePtr(arg);
|
300
278
|
errno = 0;
|
301
279
|
pct_long = strtol(pct_str, &end, 10);
|
302
280
|
if (errno == ERANGE)
|
@@ -353,7 +331,7 @@ check_num2dbl(VALUE obj)
|
|
353
331
|
static VALUE
|
354
332
|
rescue_not_dbl(VALUE ignored)
|
355
333
|
{
|
356
|
-
ignored = ignored;
|
334
|
+
ignored = ignored; // defeat gcc message
|
357
335
|
return INT2FIX(0);
|
358
336
|
}
|
359
337
|
|
@@ -379,7 +357,7 @@ double rm_str_to_pct(VALUE str)
|
|
379
357
|
char *pct_str, *end;
|
380
358
|
|
381
359
|
str = rb_rescue(rb_str_to_str, str, rescue_not_str, str);
|
382
|
-
pct_str =
|
360
|
+
pct_str = StringValuePtr(str);
|
383
361
|
errno = 0;
|
384
362
|
pct = strtol(pct_str, &end, 10);
|
385
363
|
|
@@ -404,7 +382,7 @@ double rm_str_to_pct(VALUE str)
|
|
404
382
|
* Extern: rm_fuzz_to_dbl(obj)
|
405
383
|
* Purpose: If the argument is a number, convert it to a double.
|
406
384
|
* Otherwise it's supposed to be a string in the form 'NN%'.
|
407
|
-
* Return a percentage of
|
385
|
+
* Return a percentage of QuantumRange.
|
408
386
|
* Notes: Called from Image#fuzz= and Info#fuzz=
|
409
387
|
*/
|
410
388
|
double
|
@@ -421,7 +399,7 @@ rm_fuzz_to_dbl(VALUE fuzz_arg)
|
|
421
399
|
{
|
422
400
|
// Convert to string, issue error message if failure.
|
423
401
|
fuzz_arg = rb_rescue(rb_str_to_str, fuzz_arg, rescue_not_str, fuzz_arg);
|
424
|
-
fuzz_str =
|
402
|
+
fuzz_str = StringValuePtr(fuzz_arg);
|
425
403
|
errno = 0;
|
426
404
|
fuzz = strtod(fuzz_str, &end);
|
427
405
|
if (errno == ERANGE)
|
@@ -434,7 +412,7 @@ rm_fuzz_to_dbl(VALUE fuzz_arg)
|
|
434
412
|
{
|
435
413
|
rb_raise(rb_eArgError, "percentages may not be negative (got `%s')", fuzz_str);
|
436
414
|
}
|
437
|
-
fuzz = (fuzz *
|
415
|
+
fuzz = (fuzz * QuantumRange) / 100.0;
|
438
416
|
}
|
439
417
|
else if(*end != '\0')
|
440
418
|
{
|
@@ -454,6 +432,29 @@ rm_fuzz_to_dbl(VALUE fuzz_arg)
|
|
454
432
|
}
|
455
433
|
|
456
434
|
|
435
|
+
/*
|
436
|
+
Extern: rm_app2quantum
|
437
|
+
Purpose: Convert a application-supplied number to a Quantum. If the object
|
438
|
+
is a Float, truncate it before converting.
|
439
|
+
Notes: Ruby says that 2147483647.5 doesn't fit into an unsigned long.
|
440
|
+
If you truncate it, it works.
|
441
|
+
Should use this only when the input value is possibly subject
|
442
|
+
to this problem.
|
443
|
+
*/
|
444
|
+
Quantum
|
445
|
+
rm_app2quantum(VALUE obj)
|
446
|
+
{
|
447
|
+
volatile VALUE v = obj;
|
448
|
+
|
449
|
+
if (TYPE(obj) == T_FLOAT)
|
450
|
+
{
|
451
|
+
v = rb_funcall(obj, rm_ID_to_i, 0);
|
452
|
+
}
|
453
|
+
|
454
|
+
return NUM2QUANTUM(v);
|
455
|
+
}
|
456
|
+
|
457
|
+
|
457
458
|
/*
|
458
459
|
Extern: ImageList_cur_image
|
459
460
|
Purpose: Sends the "cur_image" method to the object. If 'img'
|
@@ -516,8 +517,8 @@ Pixel_to_s(VALUE self)
|
|
516
517
|
char buff[100];
|
517
518
|
|
518
519
|
Data_Get_Struct(self, Pixel, pixel);
|
519
|
-
sprintf(buff, "red
|
520
|
-
,
|
520
|
+
sprintf(buff, "red=" QuantumFormat ", green=" QuantumFormat ", blue=" QuantumFormat ", opacity=" QuantumFormat
|
521
|
+
, pixel->red, pixel->green, pixel->blue, pixel->opacity);
|
521
522
|
return rb_str_new2(buff);
|
522
523
|
}
|
523
524
|
|
@@ -540,13 +541,13 @@ Pixel_from_color(VALUE class, VALUE name)
|
|
540
541
|
class = class; // defeat "never referenced" message from icc
|
541
542
|
|
542
543
|
GetExceptionInfo(&exception);
|
543
|
-
okay = QueryColorDatabase(
|
544
|
+
okay = QueryColorDatabase(StringValuePtr(name), &pp, &exception);
|
544
545
|
CHECK_EXCEPTION()
|
545
546
|
(void) DestroyExceptionInfo(&exception);
|
546
547
|
|
547
548
|
if (!okay)
|
548
549
|
{
|
549
|
-
rb_raise(rb_eArgError, "invalid color name: %s",
|
550
|
+
rb_raise(rb_eArgError, "invalid color name: %s", StringValuePtr(name));
|
550
551
|
}
|
551
552
|
|
552
553
|
return Pixel_from_PixelPacket(&pp);
|
@@ -632,7 +633,6 @@ Pixel_to_HSL(VALUE self)
|
|
632
633
|
volatile VALUE hsl;
|
633
634
|
|
634
635
|
Data_Get_Struct(self, Pixel, pixel);
|
635
|
-
|
636
636
|
#if defined(HAVE_CONVERTRGBTOHSL)
|
637
637
|
ConvertRGBToHSL(pixel->red, pixel->green, pixel->blue, &hue, &saturation, &luminosity);
|
638
638
|
#else
|
@@ -653,10 +653,11 @@ Pixel_to_HSL(VALUE self)
|
|
653
653
|
VALUE
|
654
654
|
Pixel_from_HSL(VALUE class, VALUE hsl)
|
655
655
|
{
|
656
|
-
PixelPacket rgb
|
656
|
+
PixelPacket rgb;
|
657
657
|
double hue, saturation, luminosity;
|
658
658
|
|
659
659
|
class = class; // defeat "never referenced" message from icc
|
660
|
+
memset(&rgb, 0, sizeof(rgb));
|
660
661
|
|
661
662
|
hsl = rb_Array(hsl); // Ensure array
|
662
663
|
if (RARRAY(hsl)->len < 3)
|
@@ -675,7 +676,6 @@ Pixel_from_HSL(VALUE class, VALUE hsl)
|
|
675
676
|
HSLTransform(hue, saturation, luminosity,
|
676
677
|
&rgb.red, &rgb.green, &rgb.blue);
|
677
678
|
#endif
|
678
|
-
|
679
679
|
return Pixel_from_PixelPacket(&rgb);
|
680
680
|
}
|
681
681
|
|
@@ -696,10 +696,8 @@ Pixel_eql_q(VALUE self, VALUE other)
|
|
696
696
|
VALUE
|
697
697
|
Pixel_fcmp(int argc, VALUE *argv, VALUE self)
|
698
698
|
{
|
699
|
-
#if defined(HAVE_FUZZYCOLORCOMPARE)
|
700
699
|
Image *image;
|
701
700
|
Info *info;
|
702
|
-
#endif
|
703
701
|
|
704
702
|
Pixel *this, *that;
|
705
703
|
ColorspaceType colorspace = RGBColorspace;
|
@@ -723,8 +721,7 @@ Pixel_fcmp(int argc, VALUE *argv, VALUE self)
|
|
723
721
|
Data_Get_Struct(self, Pixel, this);
|
724
722
|
Data_Get_Struct(argv[0], Pixel, that);
|
725
723
|
|
726
|
-
|
727
|
-
// The FuzzyColorCompare function expects to get the
|
724
|
+
// The IsColorSimilar function expects to get the
|
728
725
|
// colorspace and fuzz parameters from an Image structure.
|
729
726
|
|
730
727
|
info = CloneImageInfo(NULL);
|
@@ -734,26 +731,21 @@ Pixel_fcmp(int argc, VALUE *argv, VALUE self)
|
|
734
731
|
}
|
735
732
|
|
736
733
|
image = AllocateImage(info);
|
734
|
+
|
735
|
+
// Delete Info now in case we have to raise an exception
|
736
|
+
(void) DestroyImageInfo(info);
|
737
|
+
|
737
738
|
if (!image)
|
738
739
|
{
|
739
740
|
rb_raise(rb_eNoMemError, "not enough memory to continue");
|
740
741
|
}
|
741
|
-
(void) DestroyImageInfo(info);
|
742
742
|
|
743
743
|
image->colorspace = colorspace;
|
744
744
|
image->fuzz = fuzz;
|
745
745
|
|
746
|
-
#if defined(HAVE_ISCOLORSIMILAR)
|
747
746
|
equal = IsColorSimilar(image, this, that);
|
748
|
-
#else
|
749
|
-
equal = FuzzyColorCompare(image, this, that);
|
750
|
-
#endif
|
751
747
|
(void) DestroyImage(image);
|
752
748
|
|
753
|
-
#else
|
754
|
-
equal = FuzzyColorMatch(this, that, fuzz);
|
755
|
-
#endif
|
756
|
-
|
757
749
|
return equal ? Qtrue : Qfalse;
|
758
750
|
}
|
759
751
|
|
@@ -797,7 +789,7 @@ Pixel_intensity(VALUE self)
|
|
797
789
|
+ (0.587*pixel->green)
|
798
790
|
+ (0.114*pixel->blue));
|
799
791
|
|
800
|
-
return
|
792
|
+
return QUANTUM2NUM((unsigned long) intensity);
|
801
793
|
}
|
802
794
|
|
803
795
|
|
@@ -879,7 +871,6 @@ destroy_Pixel(Pixel *pixel)
|
|
879
871
|
}
|
880
872
|
|
881
873
|
|
882
|
-
#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
|
883
874
|
/*
|
884
875
|
Extern: Pixel_alloc
|
885
876
|
Purpose: Allocate a Pixel object
|
@@ -894,27 +885,6 @@ Pixel_alloc(VALUE class)
|
|
894
885
|
return Data_Wrap_Struct(class, NULL, destroy_Pixel, pixel);
|
895
886
|
}
|
896
887
|
|
897
|
-
#else
|
898
|
-
|
899
|
-
/*
|
900
|
-
Method: Pixel.new
|
901
|
-
Purpose: Construct a new Pixel object
|
902
|
-
*/
|
903
|
-
VALUE
|
904
|
-
Pixel_new(int argc, VALUE *argv, VALUE class)
|
905
|
-
{
|
906
|
-
Pixel *pixel;
|
907
|
-
volatile VALUE pixel_obj;
|
908
|
-
|
909
|
-
pixel = ALLOC(Pixel);
|
910
|
-
memset(pixel, '\0', sizeof(Pixel));
|
911
|
-
pixel_obj = Data_Wrap_Struct(class, NULL, destroy_Pixel, pixel);
|
912
|
-
|
913
|
-
rb_obj_call_init(pixel_obj, argc, argv);
|
914
|
-
return pixel_obj;
|
915
|
-
}
|
916
|
-
#endif
|
917
|
-
|
918
888
|
|
919
889
|
/*
|
920
890
|
Method: Pixel#initialize(red=0,green=0,blue=0,opacity=0)
|
@@ -932,22 +902,22 @@ Pixel_initialize(int argc, VALUE *argv, VALUE self)
|
|
932
902
|
case 4:
|
933
903
|
if (argv[3] != Qnil)
|
934
904
|
{
|
935
|
-
pixel->opacity = (
|
905
|
+
pixel->opacity = APP2QUANTUM(argv[3]);
|
936
906
|
}
|
937
907
|
case 3:
|
938
908
|
if (argv[2] != Qnil)
|
939
909
|
{
|
940
|
-
pixel->blue = (
|
910
|
+
pixel->blue = APP2QUANTUM(argv[2]);
|
941
911
|
}
|
942
912
|
case 2:
|
943
913
|
if (argv[1] != Qnil)
|
944
914
|
{
|
945
|
-
pixel->green = (
|
915
|
+
pixel->green = APP2QUANTUM(argv[1]);
|
946
916
|
}
|
947
917
|
case 1:
|
948
918
|
if (argv[0] != Qnil)
|
949
919
|
{
|
950
|
-
pixel->red = (
|
920
|
+
pixel->red = APP2QUANTUM(argv[0]);
|
951
921
|
}
|
952
922
|
case 0:
|
953
923
|
break;
|
@@ -1011,7 +981,7 @@ Pixel_clone(VALUE self)
|
|
1011
981
|
clone = Pixel_dup(self);
|
1012
982
|
if (OBJ_FROZEN(self))
|
1013
983
|
{
|
1014
|
-
(
|
984
|
+
OBJ_FREEZE(clone);
|
1015
985
|
}
|
1016
986
|
|
1017
987
|
return clone;
|
@@ -1136,7 +1106,7 @@ Color_Name_to_PixelPacket(PixelPacket *color, VALUE name_arg)
|
|
1136
1106
|
ExceptionInfo exception;
|
1137
1107
|
|
1138
1108
|
GetExceptionInfo(&exception);
|
1139
|
-
name =
|
1109
|
+
name = StringValuePtr(name_arg);
|
1140
1110
|
okay = QueryColorDatabase(name, color, &exception);
|
1141
1111
|
(void) DestroyExceptionInfo(&exception);
|
1142
1112
|
if (!okay)
|
@@ -1213,19 +1183,6 @@ ColorspaceType_new(ColorspaceType cs)
|
|
1213
1183
|
{
|
1214
1184
|
const char *name;
|
1215
1185
|
|
1216
|
-
#if defined(HAVE_REC601YCBCRCOLORSPACE)
|
1217
|
-
// GM 1.2 defines this symbol to be equal to YCbCrColorspace, so we
|
1218
|
-
// can't use it as a case label. GM wants the string version of this
|
1219
|
-
// enumerator to be Rec601YCbCrColorspace (see ColorspaceTypeToString
|
1220
|
-
// in colorspace.c) so that's what we return for both versions of the
|
1221
|
-
// enumerator.
|
1222
|
-
if (cs == Rec601YCbCrColorspace)
|
1223
|
-
{
|
1224
|
-
return rm_enum_new(Class_ColorspaceType
|
1225
|
-
, ID2SYM(rb_intern("Rec601YCbCrColorspace")), INT2FIX(cs));
|
1226
|
-
}
|
1227
|
-
#endif
|
1228
|
-
|
1229
1186
|
switch(cs)
|
1230
1187
|
{
|
1231
1188
|
default:
|
@@ -1274,41 +1231,27 @@ ColorspaceType_new(ColorspaceType cs)
|
|
1274
1231
|
case HWBColorspace:
|
1275
1232
|
name = "HWBColorspace";
|
1276
1233
|
break;
|
1277
|
-
#if defined(HAVE_HSBCOLORSPACE)
|
1278
1234
|
case HSBColorspace:
|
1279
1235
|
name = "HSBColorspace";
|
1280
1236
|
break;
|
1281
|
-
#endif
|
1282
|
-
#if defined(HAVE_LABCOLORSPACE)
|
1283
1237
|
case LABColorspace:
|
1284
1238
|
name = "LABColorspace";
|
1285
1239
|
break;
|
1286
|
-
|
1287
|
-
|
1288
|
-
case CineonLogRGBColorspace:
|
1289
|
-
name = "CineonLogRGBColorspace";
|
1240
|
+
case Rec601YCbCrColorspace:
|
1241
|
+
name = "Rec601YCbCrColorspace";
|
1290
1242
|
break;
|
1291
|
-
#endif
|
1292
|
-
#if defined(HAVE_REC601LUMACOLORSPACE)
|
1293
1243
|
case Rec601LumaColorspace:
|
1294
1244
|
name = "Rec601LumaColorspace";
|
1295
1245
|
break;
|
1296
|
-
#endif
|
1297
|
-
#if defined(HAVE_REC709LUMACOLORSPACE)
|
1298
1246
|
case Rec709LumaColorspace:
|
1299
1247
|
name = "Rec709LumaColorspace";
|
1300
1248
|
break;
|
1301
|
-
#endif
|
1302
|
-
#if defined(HAVE_REC709YCBCRCOLORSPACE)
|
1303
1249
|
case Rec709YCbCrColorspace:
|
1304
1250
|
name = "Rec709YCbCrColorspace";
|
1305
1251
|
break;
|
1306
|
-
#endif
|
1307
|
-
#if defined(HAVE_LOGCOLORSPACE)
|
1308
1252
|
case LogColorspace:
|
1309
1253
|
name = "LogColorspace";
|
1310
1254
|
break;
|
1311
|
-
#endif
|
1312
1255
|
}
|
1313
1256
|
|
1314
1257
|
return rm_enum_new(Class_ColorspaceType, ID2SYM(rb_intern(name)), INT2FIX(cs));
|
@@ -1340,21 +1283,21 @@ CompositeOperator_name(CompositeOperator op)
|
|
1340
1283
|
{
|
1341
1284
|
switch (op)
|
1342
1285
|
{
|
1343
|
-
default:
|
1344
1286
|
ENUM_TO_NAME(UndefinedCompositeOp)
|
1345
1287
|
ENUM_TO_NAME(NoCompositeOp)
|
1346
1288
|
ENUM_TO_NAME(AddCompositeOp)
|
1347
1289
|
ENUM_TO_NAME(AtopCompositeOp)
|
1348
1290
|
ENUM_TO_NAME(BumpmapCompositeOp)
|
1291
|
+
#if defined(HAVE_ENUM_CHANGEMASKCOMPOSITEOP)
|
1292
|
+
ENUM_TO_NAME(ChangeMaskCompositeOp)
|
1293
|
+
#endif
|
1349
1294
|
ENUM_TO_NAME(ClearCompositeOp)
|
1350
|
-
#if defined(HAVE_COLORDODGECOMPOSITEOP)
|
1351
1295
|
ENUM_TO_NAME(ColorBurnCompositeOp)
|
1352
1296
|
ENUM_TO_NAME(BlendCompositeOp)
|
1353
1297
|
ENUM_TO_NAME(ColorDodgeCompositeOp)
|
1354
1298
|
ENUM_TO_NAME(ExclusionCompositeOp)
|
1355
1299
|
ENUM_TO_NAME(HardLightCompositeOp)
|
1356
1300
|
ENUM_TO_NAME(SoftLightCompositeOp)
|
1357
|
-
#endif
|
1358
1301
|
ENUM_TO_NAME(ColorizeCompositeOp)
|
1359
1302
|
ENUM_TO_NAME(CopyBlueCompositeOp)
|
1360
1303
|
ENUM_TO_NAME(CopyCompositeOp)
|
@@ -1366,19 +1309,23 @@ CompositeOperator_name(CompositeOperator op)
|
|
1366
1309
|
ENUM_TO_NAME(CopyOpacityCompositeOp)
|
1367
1310
|
ENUM_TO_NAME(CopyRedCompositeOp)
|
1368
1311
|
ENUM_TO_NAME(DarkenCompositeOp)
|
1369
|
-
#if defined(
|
1312
|
+
#if defined(HAVE_ENUM_DIVIDECOMPOSITEOP)
|
1313
|
+
ENUM_TO_NAME(DivideCompositeOp)
|
1314
|
+
#endif
|
1370
1315
|
ENUM_TO_NAME(DstAtopCompositeOp)
|
1371
1316
|
ENUM_TO_NAME(DstCompositeOp)
|
1372
1317
|
ENUM_TO_NAME(DstInCompositeOp)
|
1373
1318
|
ENUM_TO_NAME(DstOutCompositeOp)
|
1374
1319
|
ENUM_TO_NAME(DstOverCompositeOp)
|
1375
|
-
#endif
|
1376
1320
|
ENUM_TO_NAME(DifferenceCompositeOp)
|
1377
1321
|
ENUM_TO_NAME(DisplaceCompositeOp)
|
1378
1322
|
ENUM_TO_NAME(DissolveCompositeOp)
|
1379
1323
|
ENUM_TO_NAME(HueCompositeOp)
|
1380
1324
|
ENUM_TO_NAME(InCompositeOp)
|
1381
1325
|
ENUM_TO_NAME(LightenCompositeOp)
|
1326
|
+
#if defined(HAVE_ENUM_LINEARLIGHTCOMPOSITEOP)
|
1327
|
+
ENUM_TO_NAME(LinearLightCompositeOp)
|
1328
|
+
#endif
|
1382
1329
|
ENUM_TO_NAME(LuminizeCompositeOp)
|
1383
1330
|
ENUM_TO_NAME(MinusCompositeOp)
|
1384
1331
|
ENUM_TO_NAME(ModulateCompositeOp)
|
@@ -1387,22 +1334,20 @@ CompositeOperator_name(CompositeOperator op)
|
|
1387
1334
|
ENUM_TO_NAME(OverCompositeOp)
|
1388
1335
|
ENUM_TO_NAME(OverlayCompositeOp)
|
1389
1336
|
ENUM_TO_NAME(PlusCompositeOp)
|
1390
|
-
#if defined(HAVE_REPLACECOMPOSITEOP) // Added 5.5.8
|
1391
1337
|
ENUM_TO_NAME(ReplaceCompositeOp)
|
1392
|
-
#endif
|
1393
1338
|
ENUM_TO_NAME(SaturateCompositeOp)
|
1394
1339
|
ENUM_TO_NAME(ScreenCompositeOp)
|
1395
|
-
#if defined(HAVE_DSTCOMPOSITEOP)
|
1396
1340
|
ENUM_TO_NAME(SrcAtopCompositeOp)
|
1397
1341
|
ENUM_TO_NAME(SrcCompositeOp)
|
1398
1342
|
ENUM_TO_NAME(SrcInCompositeOp)
|
1399
1343
|
ENUM_TO_NAME(SrcOutCompositeOp)
|
1400
1344
|
ENUM_TO_NAME(SrcOverCompositeOp)
|
1401
|
-
#endif
|
1402
1345
|
ENUM_TO_NAME(SubtractCompositeOp)
|
1403
1346
|
ENUM_TO_NAME(ThresholdCompositeOp)
|
1404
1347
|
ENUM_TO_NAME(XorCompositeOp)
|
1405
1348
|
}
|
1349
|
+
|
1350
|
+
return "UndefinedCompositeOp";
|
1406
1351
|
}
|
1407
1352
|
|
1408
1353
|
/*
|
@@ -1412,9 +1357,7 @@ CompositeOperator_name(CompositeOperator op)
|
|
1412
1357
|
VALUE
|
1413
1358
|
CompositeOperator_new(CompositeOperator op)
|
1414
1359
|
{
|
1415
|
-
const char *name;
|
1416
|
-
|
1417
|
-
name = CompositeOperator_name(op);
|
1360
|
+
const char *name = CompositeOperator_name(op);
|
1418
1361
|
return rm_enum_new(Class_CompositeOperator, ID2SYM(rb_intern(name)), INT2FIX(op));
|
1419
1362
|
}
|
1420
1363
|
|
@@ -1428,18 +1371,20 @@ CompressionType_name(CompressionType ct)
|
|
1428
1371
|
{
|
1429
1372
|
switch (ct)
|
1430
1373
|
{
|
1431
|
-
default:
|
1432
1374
|
ENUM_TO_NAME(UndefinedCompression)
|
1433
1375
|
ENUM_TO_NAME(NoCompression)
|
1434
1376
|
ENUM_TO_NAME(BZipCompression)
|
1435
1377
|
ENUM_TO_NAME(FaxCompression)
|
1436
1378
|
ENUM_TO_NAME(Group4Compression)
|
1437
1379
|
ENUM_TO_NAME(JPEGCompression)
|
1380
|
+
ENUM_TO_NAME(JPEG2000Compression)
|
1438
1381
|
ENUM_TO_NAME(LosslessJPEGCompression)
|
1439
1382
|
ENUM_TO_NAME(LZWCompression)
|
1440
1383
|
ENUM_TO_NAME(RLECompression)
|
1441
1384
|
ENUM_TO_NAME(ZipCompression)
|
1442
1385
|
}
|
1386
|
+
|
1387
|
+
return "UndefinedCompression";
|
1443
1388
|
}
|
1444
1389
|
|
1445
1390
|
|
@@ -1450,9 +1395,7 @@ CompressionType_name(CompressionType ct)
|
|
1450
1395
|
VALUE
|
1451
1396
|
CompressionType_new(CompressionType ct)
|
1452
1397
|
{
|
1453
|
-
const char *name;
|
1454
|
-
|
1455
|
-
name = CompressionType_name(ct);
|
1398
|
+
const char *name = CompressionType_name(ct);
|
1456
1399
|
return rm_enum_new(Class_CompressionType, ID2SYM(rb_intern(name)), INT2FIX(ct));
|
1457
1400
|
}
|
1458
1401
|
|
@@ -1466,12 +1409,13 @@ DisposeType_name(DisposeType type)
|
|
1466
1409
|
{
|
1467
1410
|
switch(type)
|
1468
1411
|
{
|
1469
|
-
default:
|
1470
1412
|
ENUM_TO_NAME(UndefinedDispose)
|
1471
1413
|
ENUM_TO_NAME(BackgroundDispose)
|
1472
1414
|
ENUM_TO_NAME(NoneDispose)
|
1473
1415
|
ENUM_TO_NAME(PreviousDispose)
|
1474
1416
|
}
|
1417
|
+
|
1418
|
+
return "UndefinedDispose";
|
1475
1419
|
}
|
1476
1420
|
|
1477
1421
|
|
@@ -1482,9 +1426,7 @@ DisposeType_name(DisposeType type)
|
|
1482
1426
|
VALUE
|
1483
1427
|
DisposeType_new(DisposeType type)
|
1484
1428
|
{
|
1485
|
-
const char *name;
|
1486
|
-
|
1487
|
-
name = DisposeType_name(type);
|
1429
|
+
const char *name = DisposeType_name(type);
|
1488
1430
|
return rm_enum_new(Class_DisposeType, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1489
1431
|
}
|
1490
1432
|
|
@@ -1498,7 +1440,6 @@ FilterTypes_name(FilterTypes type)
|
|
1498
1440
|
{
|
1499
1441
|
switch(type)
|
1500
1442
|
{
|
1501
|
-
default:
|
1502
1443
|
ENUM_TO_NAME(UndefinedFilter)
|
1503
1444
|
ENUM_TO_NAME(PointFilter)
|
1504
1445
|
ENUM_TO_NAME(BoxFilter)
|
@@ -1515,7 +1456,30 @@ FilterTypes_name(FilterTypes type)
|
|
1515
1456
|
ENUM_TO_NAME(LanczosFilter)
|
1516
1457
|
ENUM_TO_NAME(BesselFilter)
|
1517
1458
|
ENUM_TO_NAME(SincFilter)
|
1459
|
+
#if defined(HAVE_ENUM_KAISERFILTER)
|
1460
|
+
ENUM_TO_NAME(KaiserFilter)
|
1461
|
+
#endif
|
1462
|
+
#if defined(HAVE_ENUM_WELSHFILTER)
|
1463
|
+
ENUM_TO_NAME(WelshFilter)
|
1464
|
+
#endif
|
1465
|
+
#if defined(HAVE_ENUM_PARZENFILTER)
|
1466
|
+
ENUM_TO_NAME(ParzenFilter)
|
1467
|
+
#endif
|
1468
|
+
#if defined(HAVE_ENUM_LAGRANGEFILTER)
|
1469
|
+
ENUM_TO_NAME(LagrangeFilter)
|
1470
|
+
#endif
|
1471
|
+
#if defined(HAVE_ENUM_BOHMANFILTER)
|
1472
|
+
ENUM_TO_NAME(BohmanFilter)
|
1473
|
+
#endif
|
1474
|
+
#if defined(HAVE_ENUM_BARTLETTFILTER)
|
1475
|
+
ENUM_TO_NAME(BartlettFilter)
|
1476
|
+
#endif
|
1477
|
+
#if defined(HAVE_ENUM_SENTINELFILTER)
|
1478
|
+
ENUM_TO_NAME(SentinelFilter)
|
1479
|
+
#endif
|
1518
1480
|
}
|
1481
|
+
|
1482
|
+
return "UndefinedFilter";
|
1519
1483
|
}
|
1520
1484
|
|
1521
1485
|
|
@@ -1526,9 +1490,7 @@ FilterTypes_name(FilterTypes type)
|
|
1526
1490
|
VALUE
|
1527
1491
|
FilterTypes_new(FilterTypes type)
|
1528
1492
|
{
|
1529
|
-
const char *name;
|
1530
|
-
|
1531
|
-
name = FilterTypes_name(type);
|
1493
|
+
const char *name = FilterTypes_name(type);
|
1532
1494
|
return rm_enum_new(Class_FilterTypes, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1533
1495
|
}
|
1534
1496
|
|
@@ -1543,11 +1505,11 @@ EndianType_name(EndianType type)
|
|
1543
1505
|
{
|
1544
1506
|
switch(type)
|
1545
1507
|
{
|
1546
|
-
default:
|
1547
1508
|
ENUM_TO_NAME(UndefinedEndian)
|
1548
1509
|
ENUM_TO_NAME(LSBEndian)
|
1549
1510
|
ENUM_TO_NAME(MSBEndian)
|
1550
1511
|
}
|
1512
|
+
return "UndefinedEndian";
|
1551
1513
|
}
|
1552
1514
|
|
1553
1515
|
/*
|
@@ -1557,13 +1519,50 @@ EndianType_name(EndianType type)
|
|
1557
1519
|
VALUE
|
1558
1520
|
EndianType_new(EndianType type)
|
1559
1521
|
{
|
1560
|
-
const char *name;
|
1561
|
-
|
1562
|
-
name = EndianType_name(type);
|
1522
|
+
const char *name = EndianType_name(type);
|
1563
1523
|
return rm_enum_new(Class_EndianType, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1564
1524
|
}
|
1565
1525
|
|
1566
1526
|
|
1527
|
+
/*
|
1528
|
+
Static: GravityType_name
|
1529
|
+
Purpose: Return the name of a GravityType enum as a string
|
1530
|
+
*/
|
1531
|
+
static const char *
|
1532
|
+
GravityType_name(GravityType type)
|
1533
|
+
{
|
1534
|
+
switch(type)
|
1535
|
+
{
|
1536
|
+
ENUM_TO_NAME(ForgetGravity)
|
1537
|
+
ENUM_TO_NAME(NorthWestGravity)
|
1538
|
+
ENUM_TO_NAME(NorthGravity)
|
1539
|
+
ENUM_TO_NAME(NorthEastGravity)
|
1540
|
+
ENUM_TO_NAME(WestGravity)
|
1541
|
+
ENUM_TO_NAME(CenterGravity)
|
1542
|
+
ENUM_TO_NAME(EastGravity)
|
1543
|
+
ENUM_TO_NAME(SouthWestGravity)
|
1544
|
+
ENUM_TO_NAME(SouthGravity)
|
1545
|
+
ENUM_TO_NAME(SouthEastGravity)
|
1546
|
+
ENUM_TO_NAME(StaticGravity)
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
// Defeat "duplicate case value" error.
|
1550
|
+
return "UndefinedGravity";
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
|
1554
|
+
/*
|
1555
|
+
External: GravityType.new
|
1556
|
+
Purpose: Construct an GravityType enum object for the specified value
|
1557
|
+
*/
|
1558
|
+
VALUE
|
1559
|
+
GravityType_new(GravityType type)
|
1560
|
+
{
|
1561
|
+
const char *name = GravityType_name(type);
|
1562
|
+
return rm_enum_new(Class_GravityType, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
|
1567
1566
|
|
1568
1567
|
/*
|
1569
1568
|
Static: ImageType_name
|
@@ -1571,9 +1570,9 @@ EndianType_new(EndianType type)
|
|
1571
1570
|
*/
|
1572
1571
|
static char *
|
1573
1572
|
ImageType_name(ImageType type)
|
1574
|
-
{
|
1573
|
+
{
|
1574
|
+
switch(type)
|
1575
1575
|
{
|
1576
|
-
default:
|
1577
1576
|
ENUM_TO_NAME(UndefinedType)
|
1578
1577
|
ENUM_TO_NAME(BilevelType)
|
1579
1578
|
ENUM_TO_NAME(GrayscaleType)
|
@@ -1585,11 +1584,10 @@ ImageType_name(ImageType type)
|
|
1585
1584
|
ENUM_TO_NAME(ColorSeparationType)
|
1586
1585
|
ENUM_TO_NAME(ColorSeparationMatteType)
|
1587
1586
|
ENUM_TO_NAME(OptimizeType)
|
1588
|
-
#if defined(HAVE_PALETTEBILEVELMATTETYPE)
|
1589
1587
|
ENUM_TO_NAME(PaletteBilevelMatteType)
|
1590
|
-
#endif
|
1591
1588
|
}
|
1592
1589
|
|
1590
|
+
return "UndefinedType";
|
1593
1591
|
}
|
1594
1592
|
|
1595
1593
|
|
@@ -1600,9 +1598,7 @@ ImageType_name(ImageType type)
|
|
1600
1598
|
VALUE
|
1601
1599
|
ImageType_new(ImageType type)
|
1602
1600
|
{
|
1603
|
-
const char *name;
|
1604
|
-
|
1605
|
-
name = ImageType_name(type);
|
1601
|
+
const char *name = ImageType_name(type);
|
1606
1602
|
return rm_enum_new(Class_ImageType, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1607
1603
|
}
|
1608
1604
|
|
@@ -1616,13 +1612,23 @@ InterlaceType_name(InterlaceType interlace)
|
|
1616
1612
|
{
|
1617
1613
|
switch(interlace)
|
1618
1614
|
{
|
1619
|
-
default:
|
1620
1615
|
ENUM_TO_NAME(UndefinedInterlace)
|
1616
|
+
#if defined(HAVE_ENUM_GIFINTERLACE)
|
1617
|
+
ENUM_TO_NAME(GIFInterlace)
|
1618
|
+
#endif
|
1619
|
+
#if defined(HAVE_ENUM_JPEGINTERLACE)
|
1620
|
+
ENUM_TO_NAME(JPEGInterlace)
|
1621
|
+
#endif
|
1622
|
+
#if defined(HAVE_ENUM_PNGINTERLACE)
|
1623
|
+
ENUM_TO_NAME(PNGInterlace)
|
1624
|
+
#endif
|
1621
1625
|
ENUM_TO_NAME(NoInterlace)
|
1622
1626
|
ENUM_TO_NAME(LineInterlace)
|
1623
1627
|
ENUM_TO_NAME(PlaneInterlace)
|
1624
1628
|
ENUM_TO_NAME(PartitionInterlace)
|
1625
1629
|
}
|
1630
|
+
|
1631
|
+
return "UndefinedInterlace";
|
1626
1632
|
}
|
1627
1633
|
|
1628
1634
|
|
@@ -1633,9 +1639,7 @@ InterlaceType_name(InterlaceType interlace)
|
|
1633
1639
|
VALUE
|
1634
1640
|
InterlaceType_new(InterlaceType interlace)
|
1635
1641
|
{
|
1636
|
-
const char *name;
|
1637
|
-
|
1638
|
-
name = InterlaceType_name(interlace);
|
1642
|
+
const char *name = InterlaceType_name(interlace);
|
1639
1643
|
return rm_enum_new(Class_InterlaceType, ID2SYM(rb_intern(name)), INT2FIX(interlace));
|
1640
1644
|
}
|
1641
1645
|
|
@@ -1644,13 +1648,11 @@ InterlaceType_new(InterlaceType interlace)
|
|
1644
1648
|
Static: InterpolatePixelMethod_name
|
1645
1649
|
Purpose: Return the name of a InterpolatePixelMethod enum as a string
|
1646
1650
|
*/
|
1647
|
-
#if defined(HAVE_INTERPOLATEPIXELCOLOR)
|
1648
1651
|
static const char *
|
1649
1652
|
InterpolatePixelMethod_name(InterpolatePixelMethod interpolate)
|
1650
1653
|
{
|
1651
1654
|
switch(interpolate)
|
1652
1655
|
{
|
1653
|
-
default:
|
1654
1656
|
ENUM_TO_NAME(UndefinedInterpolatePixel)
|
1655
1657
|
ENUM_TO_NAME(AverageInterpolatePixel)
|
1656
1658
|
ENUM_TO_NAME(BicubicInterpolatePixel)
|
@@ -1659,7 +1661,12 @@ InterpolatePixelMethod_name(InterpolatePixelMethod interpolate)
|
|
1659
1661
|
ENUM_TO_NAME(IntegerInterpolatePixel)
|
1660
1662
|
ENUM_TO_NAME(MeshInterpolatePixel)
|
1661
1663
|
ENUM_TO_NAME(NearestNeighborInterpolatePixel)
|
1664
|
+
#if defined(HAVE_ENUM_SPLINEINTERPOLATEPIXEL)
|
1665
|
+
ENUM_TO_NAME(SplineInterpolatePixel)
|
1666
|
+
#endif
|
1662
1667
|
}
|
1668
|
+
|
1669
|
+
return "UndefinedInterpolatePixel";
|
1663
1670
|
}
|
1664
1671
|
|
1665
1672
|
|
@@ -1670,47 +1677,64 @@ InterpolatePixelMethod_name(InterpolatePixelMethod interpolate)
|
|
1670
1677
|
VALUE
|
1671
1678
|
InterpolatePixelMethod_new(InterpolatePixelMethod interpolate)
|
1672
1679
|
{
|
1673
|
-
const char *name;
|
1674
|
-
|
1675
|
-
name = InterpolatePixelMethod_name(interpolate);
|
1680
|
+
const char *name = InterpolatePixelMethod_name(interpolate);
|
1676
1681
|
return rm_enum_new(Class_InterpolatePixelMethod, ID2SYM(rb_intern(name)), INT2FIX(interpolate));
|
1677
1682
|
}
|
1678
|
-
#endif
|
1679
1683
|
|
1680
1684
|
|
1681
1685
|
/*
|
1682
1686
|
External: MagickLayerMethod_new
|
1683
1687
|
Purpose: Construct an MagickLayerMethod enum object for the specified value.
|
1684
1688
|
*/
|
1685
|
-
#if defined(HAVE_COMPAREIMAGELAYERS)
|
1686
1689
|
static const char *
|
1687
|
-
|
1690
|
+
LAYERMETHODTYPE_NAME(LAYERMETHODTYPE method)
|
1688
1691
|
{
|
1689
1692
|
switch(method)
|
1690
1693
|
{
|
1691
|
-
default:
|
1692
1694
|
ENUM_TO_NAME(UndefinedLayer)
|
1693
1695
|
ENUM_TO_NAME(CompareAnyLayer)
|
1694
1696
|
ENUM_TO_NAME(CompareClearLayer)
|
1695
1697
|
ENUM_TO_NAME(CompareOverlayLayer)
|
1696
1698
|
ENUM_TO_NAME(OptimizeLayer)
|
1697
1699
|
ENUM_TO_NAME(OptimizePlusLayer)
|
1698
|
-
#if defined(HAVE_COALESCELAYER)
|
1699
1700
|
ENUM_TO_NAME(CoalesceLayer)
|
1700
1701
|
ENUM_TO_NAME(DisposeLayer)
|
1702
|
+
#if defined(HAVE_ENUM_OPTIMIZETRANSLAYER)
|
1703
|
+
ENUM_TO_NAME(OptimizeTransLayer)
|
1704
|
+
#endif
|
1705
|
+
#if defined(HAVE_ENUM_OPTIMIZEIMAGELAYER)
|
1706
|
+
ENUM_TO_NAME(OptimizeImageLayer)
|
1707
|
+
#endif
|
1708
|
+
#if defined(HAVE_ENUM_REMOVEDUPSLAYER)
|
1709
|
+
ENUM_TO_NAME(RemoveDupsLayer)
|
1710
|
+
#endif
|
1711
|
+
#if defined(HAVE_ENUM_REMOVEZEROLAYER)
|
1712
|
+
ENUM_TO_NAME(RemoveZeroLayer)
|
1701
1713
|
#endif
|
1714
|
+
#if defined(HAVE_ENUM_COMPOSITELAYER)
|
1715
|
+
ENUM_TO_NAME(CompositeLayer)
|
1716
|
+
#endif
|
1717
|
+
#if defined(HAVE_ENUM_MERGELAYER)
|
1718
|
+
ENUM_TO_NAME(MergeLayer)
|
1719
|
+
#endif
|
1720
|
+
#if defined(HAVE_ENUM_MOSAICLAYER)
|
1721
|
+
ENUM_TO_NAME(MosaicLayer)
|
1722
|
+
#endif
|
1723
|
+
#if defined(HAVE_ENUM_FLATTENLAYER)
|
1724
|
+
ENUM_TO_NAME(FlattenLayer)
|
1725
|
+
#endif
|
1726
|
+
|
1702
1727
|
}
|
1728
|
+
|
1729
|
+
return "UndefinedLayer";
|
1703
1730
|
}
|
1704
1731
|
|
1705
1732
|
VALUE
|
1706
|
-
|
1733
|
+
LAYERMETHODTYPE_NEW(LAYERMETHODTYPE method)
|
1707
1734
|
{
|
1708
|
-
const char *name;
|
1709
|
-
|
1710
|
-
name = MagickLayerMethod_name(method);
|
1711
|
-
return rm_enum_new(Class_MagickLayerMethod, ID2SYM(rb_intern(name)), INT2FIX(method));
|
1735
|
+
const char *name = LAYERMETHODTYPE_NAME(method);
|
1736
|
+
return rm_enum_new(CLASS_LAYERMETHODTYPE, ID2SYM(rb_intern(name)), INT2FIX(method));
|
1712
1737
|
}
|
1713
|
-
#endif
|
1714
1738
|
|
1715
1739
|
|
1716
1740
|
/*
|
@@ -1722,7 +1746,6 @@ RenderingIntent_name(RenderingIntent intent)
|
|
1722
1746
|
{
|
1723
1747
|
switch(intent)
|
1724
1748
|
{
|
1725
|
-
default:
|
1726
1749
|
ENUM_TO_NAME(UndefinedIntent)
|
1727
1750
|
ENUM_TO_NAME(SaturationIntent)
|
1728
1751
|
ENUM_TO_NAME(PerceptualIntent)
|
@@ -1730,6 +1753,7 @@ RenderingIntent_name(RenderingIntent intent)
|
|
1730
1753
|
ENUM_TO_NAME(RelativeIntent)
|
1731
1754
|
}
|
1732
1755
|
|
1756
|
+
return "UndefinedIntent";
|
1733
1757
|
}
|
1734
1758
|
|
1735
1759
|
|
@@ -1741,9 +1765,7 @@ RenderingIntent_name(RenderingIntent intent)
|
|
1741
1765
|
VALUE
|
1742
1766
|
RenderingIntent_new(RenderingIntent intent)
|
1743
1767
|
{
|
1744
|
-
const char *name;
|
1745
|
-
|
1746
|
-
name = RenderingIntent_name(intent);
|
1768
|
+
const char *name = RenderingIntent_name(intent);
|
1747
1769
|
return rm_enum_new(Class_RenderingIntent, ID2SYM(rb_intern(name)), INT2FIX(intent));
|
1748
1770
|
}
|
1749
1771
|
|
@@ -1757,12 +1779,12 @@ ResolutionType_name(ResolutionType type)
|
|
1757
1779
|
{
|
1758
1780
|
switch(type)
|
1759
1781
|
{
|
1760
|
-
default:
|
1761
1782
|
ENUM_TO_NAME(UndefinedResolution)
|
1762
1783
|
ENUM_TO_NAME(PixelsPerInchResolution)
|
1763
1784
|
ENUM_TO_NAME(PixelsPerCentimeterResolution)
|
1764
1785
|
}
|
1765
1786
|
|
1787
|
+
return "UndefinedResolution";
|
1766
1788
|
}
|
1767
1789
|
|
1768
1790
|
|
@@ -1773,15 +1795,12 @@ ResolutionType_name(ResolutionType type)
|
|
1773
1795
|
VALUE
|
1774
1796
|
ResolutionType_new(ResolutionType type)
|
1775
1797
|
{
|
1776
|
-
const char *name;
|
1777
|
-
|
1778
|
-
name = ResolutionType_name(type);
|
1798
|
+
const char *name = ResolutionType_name(type);
|
1779
1799
|
return rm_enum_new(Class_ResolutionType, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1780
1800
|
}
|
1781
1801
|
|
1782
1802
|
|
1783
1803
|
|
1784
|
-
#if defined(HAVE_IMAGE_ORIENTATION)
|
1785
1804
|
/*
|
1786
1805
|
Static: OrientationType_name
|
1787
1806
|
Purpose: Return the name of a OrientationType enum as a string
|
@@ -1791,7 +1810,6 @@ OrientationType_name(OrientationType type)
|
|
1791
1810
|
{
|
1792
1811
|
switch(type)
|
1793
1812
|
{
|
1794
|
-
default:
|
1795
1813
|
ENUM_TO_NAME(UndefinedOrientation)
|
1796
1814
|
ENUM_TO_NAME(TopLeftOrientation)
|
1797
1815
|
ENUM_TO_NAME(TopRightOrientation)
|
@@ -1802,6 +1820,8 @@ OrientationType_name(OrientationType type)
|
|
1802
1820
|
ENUM_TO_NAME(RightBottomOrientation)
|
1803
1821
|
ENUM_TO_NAME(LeftBottomOrientation)
|
1804
1822
|
}
|
1823
|
+
|
1824
|
+
return "UndefinedOrientation";
|
1805
1825
|
}
|
1806
1826
|
|
1807
1827
|
|
@@ -1812,12 +1832,9 @@ OrientationType_name(OrientationType type)
|
|
1812
1832
|
VALUE
|
1813
1833
|
OrientationType_new(OrientationType type)
|
1814
1834
|
{
|
1815
|
-
const char *name;
|
1816
|
-
|
1817
|
-
name = OrientationType_name(type);
|
1835
|
+
const char *name = OrientationType_name(type);
|
1818
1836
|
return rm_enum_new(Class_OrientationType, ID2SYM(rb_intern(name)), INT2FIX(type));
|
1819
1837
|
}
|
1820
|
-
#endif
|
1821
1838
|
|
1822
1839
|
|
1823
1840
|
/*
|
@@ -1836,11 +1853,7 @@ Color_from_ColorInfo(const ColorInfo *ci)
|
|
1836
1853
|
|
1837
1854
|
compliance_type = ci->compliance;
|
1838
1855
|
compliance = ComplianceType_new(compliance_type);
|
1839
|
-
#if defined(HAVE_NEW_COLORINFO)
|
1840
1856
|
color = Pixel_from_MagickPixelPacket((MagickPixelPacket *)(&(ci->color)));
|
1841
|
-
#else
|
1842
|
-
color = Pixel_from_PixelPacket((PixelPacket *)(&(ci->color)));
|
1843
|
-
#endif
|
1844
1857
|
|
1845
1858
|
return rb_funcall(Class_Color, rm_ID_new, 3
|
1846
1859
|
, name, compliance, color);
|
@@ -1870,7 +1883,7 @@ Color_to_ColorInfo(ColorInfo *ci, VALUE st)
|
|
1870
1883
|
m = rb_ary_entry(members, 0);
|
1871
1884
|
if (m != Qnil)
|
1872
1885
|
{
|
1873
|
-
(void) CloneString((char **)&(ci->name),
|
1886
|
+
(void) CloneString((char **)&(ci->name), StringValuePtr(m));
|
1874
1887
|
}
|
1875
1888
|
m = rb_ary_entry(members, 1);
|
1876
1889
|
if (m != Qnil)
|
@@ -1881,7 +1894,6 @@ Color_to_ColorInfo(ColorInfo *ci, VALUE st)
|
|
1881
1894
|
if (m != Qnil)
|
1882
1895
|
{
|
1883
1896
|
Data_Get_Struct(m, Pixel, pixel);
|
1884
|
-
#if defined(HAVE_NEW_COLORINFO)
|
1885
1897
|
// For >= 6.3.0, ColorInfo.color is a MagickPixelPacket so we have to
|
1886
1898
|
// convert the PixelPacket.
|
1887
1899
|
GetMagickPixelPacket(NULL, &ci->color);
|
@@ -1890,9 +1902,6 @@ Color_to_ColorInfo(ColorInfo *ci, VALUE st)
|
|
1890
1902
|
ci->color.blue = (MagickRealType) pixel->blue;
|
1891
1903
|
ci->color.opacity = (MagickRealType) OpaqueOpacity;
|
1892
1904
|
ci->color.index = (MagickRealType) 0;
|
1893
|
-
#else
|
1894
|
-
ci->color = *pixel;
|
1895
|
-
#endif
|
1896
1905
|
}
|
1897
1906
|
}
|
1898
1907
|
|
@@ -1919,19 +1928,15 @@ Color_to_s(VALUE self)
|
|
1919
1928
|
|
1920
1929
|
Color_to_ColorInfo(&ci, self);
|
1921
1930
|
|
1922
|
-
#if defined(HAVE_NEW_COLORINFO)
|
1923
1931
|
sprintf(buff, "name=%s, compliance=%s, "
|
1924
|
-
|
1925
|
-
|
1926
|
-
ComplianceType_name(&ci.compliance),
|
1927
|
-
ci.color.red, ci.color.green, ci.color.blue, ci.color.opacity);
|
1932
|
+
#if (QuantumDepth == 32 || QuantumDepth == 64) && defined(HAVE_TYPE_LONG_DOUBLE)
|
1933
|
+
"color.red=%Lg, color.green=%Lg, color.blue=%Lg, color.opacity=%Lg ",
|
1928
1934
|
#else
|
1929
|
-
|
1930
|
-
|
1935
|
+
"color.red=%g, color.green=%g, color.blue=%g, color.opacity=%g ",
|
1936
|
+
#endif
|
1931
1937
|
ci.name,
|
1932
1938
|
ComplianceType_name(&ci.compliance),
|
1933
1939
|
ci.color.red, ci.color.green, ci.color.blue, ci.color.opacity);
|
1934
|
-
#endif
|
1935
1940
|
|
1936
1941
|
destroy_ColorInfo(&ci);
|
1937
1942
|
return rb_str_new2(buff);
|
@@ -1958,7 +1963,6 @@ Pixel_from_PixelPacket(PixelPacket *pp)
|
|
1958
1963
|
Purpose: Create a Magick::Pixel object from a MagickPixelPacket structure.
|
1959
1964
|
Notes: bypasses normal Pixel.new, Pixel#initialize methods
|
1960
1965
|
*/
|
1961
|
-
#if defined(HAVE_NEW_COLORINFO)
|
1962
1966
|
static VALUE
|
1963
1967
|
Pixel_from_MagickPixelPacket(MagickPixelPacket *pp)
|
1964
1968
|
{
|
@@ -1972,7 +1976,6 @@ Pixel_from_MagickPixelPacket(MagickPixelPacket *pp)
|
|
1972
1976
|
|
1973
1977
|
return Data_Wrap_Struct(Class_Pixel, NULL, destroy_Pixel, pixel);
|
1974
1978
|
}
|
1975
|
-
#endif
|
1976
1979
|
|
1977
1980
|
|
1978
1981
|
/*
|
@@ -2254,9 +2257,7 @@ Segment_to_SegmentInfo(SegmentInfo *segment, VALUE s)
|
|
2254
2257
|
static VALUE
|
2255
2258
|
StretchType_new(StretchType stretch)
|
2256
2259
|
{
|
2257
|
-
const char *name;
|
2258
|
-
|
2259
|
-
name = StretchType_name(stretch);
|
2260
|
+
const char *name = StretchType_name(stretch);
|
2260
2261
|
return rm_enum_new(Class_StretchType, ID2SYM(rb_intern(name)), INT2FIX(stretch));
|
2261
2262
|
}
|
2262
2263
|
|
@@ -2268,9 +2269,7 @@ StretchType_new(StretchType stretch)
|
|
2268
2269
|
static VALUE
|
2269
2270
|
StyleType_new(StyleType style)
|
2270
2271
|
{
|
2271
|
-
const char *name;
|
2272
|
-
|
2273
|
-
name = StyleType_name(style);
|
2272
|
+
const char *name = StyleType_name(style);
|
2274
2273
|
return rm_enum_new(Class_StyleType, ID2SYM(rb_intern(name)), INT2FIX(style));
|
2275
2274
|
}
|
2276
2275
|
|
@@ -2321,17 +2320,17 @@ Font_to_TypeInfo(TypeInfo *ti, VALUE st)
|
|
2321
2320
|
m = rb_ary_entry(members, 0);
|
2322
2321
|
if (m != Qnil)
|
2323
2322
|
{
|
2324
|
-
(void) CloneString((char **)&(ti->name),
|
2323
|
+
(void) CloneString((char **)&(ti->name), StringValuePtr(m));
|
2325
2324
|
}
|
2326
2325
|
m = rb_ary_entry(members, 1);
|
2327
2326
|
if (m != Qnil)
|
2328
2327
|
{
|
2329
|
-
(void) CloneString((char **)&(ti->description),
|
2328
|
+
(void) CloneString((char **)&(ti->description), StringValuePtr(m));
|
2330
2329
|
}
|
2331
2330
|
m = rb_ary_entry(members, 2);
|
2332
2331
|
if (m != Qnil)
|
2333
2332
|
{
|
2334
|
-
(void) CloneString((char **)&(ti->family),
|
2333
|
+
(void) CloneString((char **)&(ti->family), StringValuePtr(m));
|
2335
2334
|
}
|
2336
2335
|
m = rb_ary_entry(members, 3); ti->style = m == Qnil ? 0 : FIX2INT(m);
|
2337
2336
|
m = rb_ary_entry(members, 4); ti->stretch = m == Qnil ? 0 : FIX2INT(m);
|
@@ -2339,13 +2338,13 @@ Font_to_TypeInfo(TypeInfo *ti, VALUE st)
|
|
2339
2338
|
|
2340
2339
|
m = rb_ary_entry(members, 6);
|
2341
2340
|
if (m != Qnil)
|
2342
|
-
(void) CloneString((char **)&(ti->encoding),
|
2341
|
+
(void) CloneString((char **)&(ti->encoding), StringValuePtr(m));
|
2343
2342
|
m = rb_ary_entry(members, 7);
|
2344
2343
|
if (m != Qnil)
|
2345
|
-
(void) CloneString((char **)&(ti->foundry),
|
2344
|
+
(void) CloneString((char **)&(ti->foundry), StringValuePtr(m));
|
2346
2345
|
m = rb_ary_entry(members, 8);
|
2347
2346
|
if (m != Qnil)
|
2348
|
-
(void) CloneString((char **)&(ti->format),
|
2347
|
+
(void) CloneString((char **)&(ti->format), StringValuePtr(m));
|
2349
2348
|
}
|
2350
2349
|
|
2351
2350
|
|
@@ -2515,16 +2514,30 @@ VirtualPixelMethod_name(VirtualPixelMethod method)
|
|
2515
2514
|
{
|
2516
2515
|
switch (method)
|
2517
2516
|
{
|
2518
|
-
default:
|
2519
2517
|
ENUM_TO_NAME(UndefinedVirtualPixelMethod)
|
2520
2518
|
ENUM_TO_NAME(EdgeVirtualPixelMethod)
|
2521
2519
|
ENUM_TO_NAME(MirrorVirtualPixelMethod)
|
2522
2520
|
ENUM_TO_NAME(TileVirtualPixelMethod)
|
2523
|
-
#if defined(HAVE_TRANSPARENTVIRTUALPIXELMETHOD)
|
2524
2521
|
ENUM_TO_NAME(TransparentVirtualPixelMethod)
|
2525
2522
|
ENUM_TO_NAME(BackgroundVirtualPixelMethod)
|
2523
|
+
ENUM_TO_NAME(DitherVirtualPixelMethod)
|
2524
|
+
ENUM_TO_NAME(RandomVirtualPixelMethod)
|
2525
|
+
ENUM_TO_NAME(ConstantVirtualPixelMethod)
|
2526
|
+
#if defined(HAVE_ENUM_MASKVIRTUALPIXELMETHOD)
|
2527
|
+
ENUM_TO_NAME(MaskVirtualPixelMethod)
|
2528
|
+
#endif
|
2529
|
+
#if defined(HAVE_ENUM_BLACKVIRTUALPIXELMETHOD)
|
2530
|
+
ENUM_TO_NAME(BlackVirtualPixelMethod)
|
2531
|
+
#endif
|
2532
|
+
#if defined(HAVE_ENUM_GRAYVIRTUALPIXELMETHOD)
|
2533
|
+
ENUM_TO_NAME(GrayVirtualPixelMethod)
|
2534
|
+
#endif
|
2535
|
+
#if defined(HAVE_ENUM_WHITEVIRTUALPIXELMETHOD)
|
2536
|
+
ENUM_TO_NAME(WhiteVirtualPixelMethod)
|
2526
2537
|
#endif
|
2527
2538
|
}
|
2539
|
+
|
2540
|
+
return "UndefinedVirtualPixelMethod";
|
2528
2541
|
}
|
2529
2542
|
|
2530
2543
|
|
@@ -2535,9 +2548,7 @@ VirtualPixelMethod_name(VirtualPixelMethod method)
|
|
2535
2548
|
VALUE
|
2536
2549
|
VirtualPixelMethod_new(VirtualPixelMethod style)
|
2537
2550
|
{
|
2538
|
-
const char *name;
|
2539
|
-
|
2540
|
-
name = VirtualPixelMethod_name(style);
|
2551
|
+
const char *name = VirtualPixelMethod_name(style);
|
2541
2552
|
return rm_enum_new(Class_VirtualPixelMethod, ID2SYM(rb_intern(name)), INT2FIX(style));
|
2542
2553
|
}
|
2543
2554
|
|
@@ -2554,13 +2565,11 @@ VALUE rm_define_enum_type(char *tag)
|
|
2554
2565
|
|
2555
2566
|
rb_define_singleton_method(class, "values", Enum_type_values, 0);
|
2556
2567
|
rb_define_method(class, "initialize", Enum_type_initialize, 2);
|
2557
|
-
RUBY16(rb_enable_super(class, "initialize");)
|
2558
2568
|
rb_define_method(class, "inspect", Enum_type_inspect, 0);
|
2559
2569
|
return class;
|
2560
2570
|
}
|
2561
2571
|
|
2562
2572
|
|
2563
|
-
#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
|
2564
2573
|
/*
|
2565
2574
|
Extern: rm_enum_new (1.8)
|
2566
2575
|
Purpose: Construct a new Enum subclass instance
|
@@ -2589,38 +2598,6 @@ VALUE Enum_alloc(VALUE class)
|
|
2589
2598
|
}
|
2590
2599
|
|
2591
2600
|
|
2592
|
-
#else
|
2593
|
-
/*
|
2594
|
-
Extern: rm_enum_new (1.6)
|
2595
|
-
Purpose: Construct a new Enum subclass instance
|
2596
|
-
*/
|
2597
|
-
VALUE rm_enum_new(VALUE class, VALUE sym, VALUE val)
|
2598
|
-
{
|
2599
|
-
return Enum_new(class, sym, val);
|
2600
|
-
}
|
2601
|
-
|
2602
|
-
/*
|
2603
|
-
Method: Enum.new
|
2604
|
-
Purpose: Construct a new Enum object
|
2605
|
-
Notes: `class' can be an Enum subclass
|
2606
|
-
*/
|
2607
|
-
VALUE Enum_new(VALUE class, VALUE sym, VALUE val)
|
2608
|
-
{
|
2609
|
-
volatile VALUE new_enum;
|
2610
|
-
volatile VALUE argv[2];
|
2611
|
-
MagickEnum *magick_enum;
|
2612
|
-
|
2613
|
-
new_enum = Data_Make_Struct(class, MagickEnum, NULL, NULL, magick_enum);
|
2614
|
-
argv[0] = sym;
|
2615
|
-
argv[1] = val;
|
2616
|
-
|
2617
|
-
rb_obj_call_init(new_enum, 2, argv);
|
2618
|
-
OBJ_FREEZE(new_enum);
|
2619
|
-
return new_enum;
|
2620
|
-
}
|
2621
|
-
|
2622
|
-
#endif
|
2623
|
-
|
2624
2601
|
/*
|
2625
2602
|
Method: Enum#initialize
|
2626
2603
|
Purpose: Initialize a new Enum instance
|
@@ -2718,17 +2695,20 @@ VALUE Enum_case_eq(VALUE self, VALUE other)
|
|
2718
2695
|
*/
|
2719
2696
|
VALUE Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
|
2720
2697
|
{
|
2721
|
-
VALUE super_argv[2];
|
2698
|
+
volatile VALUE super_argv[2];
|
2722
2699
|
volatile VALUE enumerators;
|
2723
2700
|
|
2724
2701
|
super_argv[0] = sym;
|
2725
2702
|
super_argv[1] = val;
|
2726
|
-
(void) rb_call_super(2, super_argv);
|
2703
|
+
(void) rb_call_super(2, (VALUE *)super_argv);
|
2727
2704
|
|
2728
2705
|
if (rb_cvar_defined(CLASS_OF(self), rm_ID_enumerators) != Qtrue)
|
2729
2706
|
{
|
2730
|
-
|
2731
|
-
|
2707
|
+
#if defined(HAVE_NEW_RB_CVAR_SET)
|
2708
|
+
rb_cvar_set(CLASS_OF(self), rm_ID_enumerators, rb_ary_new());
|
2709
|
+
#else
|
2710
|
+
rb_cvar_set(CLASS_OF(self), rm_ID_enumerators, rb_ary_new(), 0);
|
2711
|
+
#endif
|
2732
2712
|
}
|
2733
2713
|
|
2734
2714
|
enumerators = rb_cvar_get(CLASS_OF(self), rm_ID_enumerators);
|
@@ -2833,51 +2813,6 @@ ComplianceType_name(ComplianceType *c)
|
|
2833
2813
|
}
|
2834
2814
|
|
2835
2815
|
|
2836
|
-
#if defined(HAVE_GETIMAGESTATISTICS)
|
2837
|
-
/*
|
2838
|
-
Extern: Statistics_new(stats)
|
2839
|
-
Purpose: Create a Magick::Statistics object from an
|
2840
|
-
ImageStatistics structure.
|
2841
|
-
*/
|
2842
|
-
VALUE
|
2843
|
-
Statistics_new(ImageStatistics *stats)
|
2844
|
-
{
|
2845
|
-
volatile VALUE red, green, blue, opacity;
|
2846
|
-
volatile VALUE min, max, mean, stddev, var;
|
2847
|
-
|
2848
|
-
min = rb_float_new(stats->red.minimum);
|
2849
|
-
max = rb_float_new(stats->red.maximum);
|
2850
|
-
mean = rb_float_new(stats->red.mean);
|
2851
|
-
stddev = rb_float_new(stats->red.standard_deviation);
|
2852
|
-
var = rb_float_new(stats->red.variance);
|
2853
|
-
red = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
|
2854
|
-
|
2855
|
-
min = rb_float_new(stats->green.minimum);
|
2856
|
-
max = rb_float_new(stats->green.maximum);
|
2857
|
-
mean = rb_float_new(stats->green.mean);
|
2858
|
-
stddev = rb_float_new(stats->green.standard_deviation);
|
2859
|
-
var = rb_float_new(stats->green.variance);
|
2860
|
-
green = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
|
2861
|
-
|
2862
|
-
min = rb_float_new(stats->blue.minimum);
|
2863
|
-
max = rb_float_new(stats->blue.maximum);
|
2864
|
-
mean = rb_float_new(stats->blue.mean);
|
2865
|
-
stddev = rb_float_new(stats->blue.standard_deviation);
|
2866
|
-
var = rb_float_new(stats->blue.variance);
|
2867
|
-
blue = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
|
2868
|
-
|
2869
|
-
min = rb_float_new(stats->opacity.minimum);
|
2870
|
-
max = rb_float_new(stats->opacity.maximum);
|
2871
|
-
mean = rb_float_new(stats->opacity.mean);
|
2872
|
-
stddev = rb_float_new(stats->opacity.standard_deviation);
|
2873
|
-
var = rb_float_new(stats->opacity.variance);
|
2874
|
-
opacity = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
|
2875
|
-
|
2876
|
-
return rb_funcall(Class_Statistics, rm_ID_new, 4, red, green, blue, opacity);
|
2877
|
-
|
2878
|
-
}
|
2879
|
-
#endif // HAVE_GETIMAGESTATISTICS
|
2880
|
-
|
2881
2816
|
/*
|
2882
2817
|
Extern: StorageType_name
|
2883
2818
|
Purpose: Return the string representation of a StorageType value
|
@@ -2887,22 +2822,17 @@ StorageType_name(StorageType type)
|
|
2887
2822
|
{
|
2888
2823
|
switch (type)
|
2889
2824
|
{
|
2825
|
+
ENUM_TO_NAME(UndefinedPixel)
|
2890
2826
|
ENUM_TO_NAME(CharPixel)
|
2891
2827
|
ENUM_TO_NAME(DoublePixel)
|
2892
2828
|
ENUM_TO_NAME(FloatPixel)
|
2893
2829
|
ENUM_TO_NAME(IntegerPixel)
|
2894
2830
|
ENUM_TO_NAME(LongPixel)
|
2895
|
-
#if defined(HAVE_QUANTUMPIXEL)
|
2896
2831
|
ENUM_TO_NAME(QuantumPixel)
|
2897
|
-
#endif
|
2898
2832
|
ENUM_TO_NAME(ShortPixel)
|
2899
|
-
default:
|
2900
|
-
#if defined(HAVE_UNDEFINEDGRAVITY) // UndefinedGravity & UndefinedPixel were both introduced in IM 6.0.0
|
2901
|
-
ENUM_TO_NAME(UndefinedPixel)
|
2902
|
-
#else
|
2903
|
-
return "UndefinedPixel";
|
2904
|
-
#endif
|
2905
2833
|
}
|
2834
|
+
|
2835
|
+
return "UndefinedPixel";
|
2906
2836
|
}
|
2907
2837
|
|
2908
2838
|
/*
|
@@ -2914,6 +2844,7 @@ StretchType_name(StretchType stretch)
|
|
2914
2844
|
{
|
2915
2845
|
switch (stretch)
|
2916
2846
|
{
|
2847
|
+
ENUM_TO_NAME(UndefinedStretch)
|
2917
2848
|
ENUM_TO_NAME(NormalStretch)
|
2918
2849
|
ENUM_TO_NAME(UltraCondensedStretch)
|
2919
2850
|
ENUM_TO_NAME(ExtraCondensedStretch)
|
@@ -2924,13 +2855,9 @@ StretchType_name(StretchType stretch)
|
|
2924
2855
|
ENUM_TO_NAME(ExtraExpandedStretch)
|
2925
2856
|
ENUM_TO_NAME(UltraExpandedStretch)
|
2926
2857
|
ENUM_TO_NAME(AnyStretch)
|
2927
|
-
default:
|
2928
|
-
#if defined(HAVE_UNDEFINEDGRAVITY) // UndefinedGravity & UndefinedStretch were both introduced in IM 6.0.0
|
2929
|
-
ENUM_TO_NAME(UndefinedStretch)
|
2930
|
-
#else
|
2931
|
-
return "UndefinedStretch";
|
2932
|
-
#endif
|
2933
2858
|
}
|
2859
|
+
|
2860
|
+
return "UndefinedStretch";
|
2934
2861
|
}
|
2935
2862
|
|
2936
2863
|
|
@@ -2943,17 +2870,14 @@ StyleType_name(StyleType style)
|
|
2943
2870
|
{
|
2944
2871
|
switch (style)
|
2945
2872
|
{
|
2873
|
+
ENUM_TO_NAME(UndefinedStyle)
|
2946
2874
|
ENUM_TO_NAME(NormalStyle)
|
2947
2875
|
ENUM_TO_NAME(ItalicStyle)
|
2948
2876
|
ENUM_TO_NAME(ObliqueStyle)
|
2949
2877
|
ENUM_TO_NAME(AnyStyle)
|
2950
|
-
default:
|
2951
|
-
#if defined(HAVE_UNDEFINEDGRAVITY) // UndefinedGravity & UndefinedStyle were both introduced in IM 6.0.0
|
2952
|
-
ENUM_TO_NAME(UndefinedStyle)
|
2953
|
-
#else
|
2954
|
-
return "UndefinedStyle";
|
2955
|
-
#endif
|
2956
2878
|
}
|
2879
|
+
|
2880
|
+
return "UndefinedStyle";
|
2957
2881
|
}
|
2958
2882
|
|
2959
2883
|
|
@@ -2990,8 +2914,11 @@ rm_write_temp_image(Image *image, char *tmpnam)
|
|
2990
2914
|
}
|
2991
2915
|
|
2992
2916
|
id += 1;
|
2993
|
-
|
2994
|
-
|
2917
|
+
#if defined(HAVE_NEW_RB_CVAR_SET)
|
2918
|
+
rb_cvar_set(Module_Magick, rm_ID__tmpnam_, INT2FIX(id));
|
2919
|
+
#else
|
2920
|
+
rb_cvar_set(Module_Magick, rm_ID__tmpnam_, INT2FIX(id), 0);
|
2921
|
+
#endif
|
2995
2922
|
|
2996
2923
|
sprintf(tmpnam, "mpri:%d", id);
|
2997
2924
|
|
@@ -3008,12 +2935,9 @@ rm_write_temp_image(Image *image, char *tmpnam)
|
|
3008
2935
|
|
3009
2936
|
long registry_id;
|
3010
2937
|
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
".\nUpgrade to ImageMagick 6.3.4 or later to prevent this behavior."
|
3015
|
-
, rb_id2name(rb_frame_last_func()));
|
3016
|
-
#endif
|
2938
|
+
rb_warn("`%s' can cause memory leaks with ImageMagick " MagickLibVersionText
|
2939
|
+
".\nUpgrade to ImageMagick 6.3.4-10 or later to prevent this behavior."
|
2940
|
+
, rb_id2name(THIS_FUNC()));
|
3017
2941
|
|
3018
2942
|
registry_id = SetMagickRegistry(ImageRegistryType, image, sizeof(Image), &image->exception);
|
3019
2943
|
rm_check_image_exception(image, RetainOnError);
|
@@ -3021,6 +2945,7 @@ rm_write_temp_image(Image *image, char *tmpnam)
|
|
3021
2945
|
{
|
3022
2946
|
rb_raise(rb_eRuntimeError, "SetMagickRegistry failed.");
|
3023
2947
|
}
|
2948
|
+
|
3024
2949
|
sprintf(tmpnam, "mpri:%ld", registry_id);
|
3025
2950
|
#endif
|
3026
2951
|
|
@@ -3051,7 +2976,6 @@ rm_delete_temp_image(char *tmpnam)
|
|
3051
2976
|
(void) DeleteMagickRegistry(registry_id);
|
3052
2977
|
}
|
3053
2978
|
#endif
|
3054
|
-
|
3055
2979
|
}
|
3056
2980
|
|
3057
2981
|
/*
|
@@ -3059,16 +2983,13 @@ rm_delete_temp_image(char *tmpnam)
|
|
3059
2983
|
Purpose: raise NotImplementedError
|
3060
2984
|
Notes: Called when a xMagick API is not available.
|
3061
2985
|
Replaces Ruby's rb_notimplement function.
|
3062
|
-
Notes: The MagickPackageName macro is not available
|
3063
|
-
until 5.5.7. Use MAGICKNAME instead.
|
3064
2986
|
*/
|
3065
2987
|
void
|
3066
2988
|
rm_not_implemented(void)
|
3067
2989
|
{
|
3068
2990
|
|
3069
|
-
rb_raise(rb_eNotImpError, "the `%s' method is not supported by "
|
3070
|
-
|
3071
|
-
, rb_id2name(rb_frame_last_func()));
|
2991
|
+
rb_raise(rb_eNotImpError, "the `%s' method is not supported by ImageMagick "
|
2992
|
+
MagickLibVersionText, rb_id2name(THIS_FUNC()));
|
3072
2993
|
}
|
3073
2994
|
|
3074
2995
|
/*
|
@@ -3100,7 +3021,7 @@ rm_magick_error(const char *msg, const char *loc)
|
|
3100
3021
|
VALUE
|
3101
3022
|
ImageMagickError_initialize(int argc, VALUE *argv, VALUE self)
|
3102
3023
|
{
|
3103
|
-
VALUE super_argv[1] = {(VALUE)0};
|
3024
|
+
volatile VALUE super_argv[1] = {(VALUE)0};
|
3104
3025
|
int super_argc = 0;
|
3105
3026
|
volatile VALUE extra = Qnil;
|
3106
3027
|
|
@@ -3117,7 +3038,7 @@ ImageMagickError_initialize(int argc, VALUE *argv, VALUE self)
|
|
3117
3038
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 to 2)", argc);
|
3118
3039
|
}
|
3119
3040
|
|
3120
|
-
(void) rb_call_super(super_argc, super_argv);
|
3041
|
+
(void) rb_call_super(super_argc, (VALUE *)super_argv);
|
3121
3042
|
(void) rb_iv_set(self, "@"MAGICK_LOC, extra);
|
3122
3043
|
|
3123
3044
|
|
@@ -3146,10 +3067,10 @@ const char *rm_get_property(const Image *img, const char *property)
|
|
3146
3067
|
Function: rm_set_property
|
3147
3068
|
Purpose: Backport SetImageProperty for pre-6.3.1 versions of ImageMagick
|
3148
3069
|
*/
|
3149
|
-
|
3070
|
+
MagickBooleanType rm_set_property(Image *image, const char *property, const char *value)
|
3150
3071
|
{
|
3151
3072
|
#if defined(HAVE_SETIMAGEPROPERTY)
|
3152
|
-
return
|
3073
|
+
return SetImageProperty(image, property, value);
|
3153
3074
|
#else
|
3154
3075
|
return SetImageAttribute(image, property, value);
|
3155
3076
|
#endif
|
@@ -3239,8 +3160,8 @@ rm_exif_by_entry(Image *image)
|
|
3239
3160
|
|
3240
3161
|
#else
|
3241
3162
|
|
3242
|
-
const
|
3243
|
-
return attr ? rb_str_new2(attr
|
3163
|
+
const char *attr = rm_get_property(image, "EXIF:*");
|
3164
|
+
return attr ? rb_str_new2(attr) : Qnil;
|
3244
3165
|
|
3245
3166
|
#endif
|
3246
3167
|
}
|
@@ -3329,15 +3250,15 @@ rm_exif_by_number(Image *image)
|
|
3329
3250
|
|
3330
3251
|
#else
|
3331
3252
|
|
3332
|
-
const
|
3333
|
-
return attr ? rb_str_new2(attr
|
3253
|
+
const char *attr = rm_get_property(image, "EXIF:!");
|
3254
|
+
return attr ? rb_str_new2(attr) : Qnil;
|
3334
3255
|
|
3335
3256
|
#endif
|
3336
3257
|
}
|
3337
3258
|
|
3338
3259
|
|
3339
3260
|
/*
|
3340
|
-
* Extern:
|
3261
|
+
* Extern: rm_get_geometry
|
3341
3262
|
* Purpose: Get the values from a Geometry object and return
|
3342
3263
|
* them in C variables.
|
3343
3264
|
*/
|
@@ -3389,6 +3310,8 @@ rm_get_geometry(
|
|
3389
3310
|
/*
|
3390
3311
|
* Extern: rm_clone_image
|
3391
3312
|
* Purpose: clone an image, handle errors
|
3313
|
+
* Notes: don't trace creation - the clone may not be used as an Image
|
3314
|
+
* object. Let the caller do the trace if desired.
|
3392
3315
|
*/
|
3393
3316
|
Image *rm_clone_image(Image *image)
|
3394
3317
|
{
|
@@ -3413,7 +3336,6 @@ Image *rm_clone_image(Image *image)
|
|
3413
3336
|
Purpose: SetImage(Info)ProgressMonitor exit
|
3414
3337
|
Notes: ImageMagick's "tag" argument is unused. We pass along the method name instead.
|
3415
3338
|
*/
|
3416
|
-
#if defined(HAVE_SETIMAGEPROGRESSMONITOR)
|
3417
3339
|
MagickBooleanType rm_progress_monitor(
|
3418
3340
|
const char *tag,
|
3419
3341
|
const MagickOffsetType of,
|
@@ -3423,7 +3345,7 @@ MagickBooleanType rm_progress_monitor(
|
|
3423
3345
|
volatile VALUE rval;
|
3424
3346
|
volatile VALUE method, offset, span;
|
3425
3347
|
|
3426
|
-
tag = tag;
|
3348
|
+
tag = tag; // defeat gcc message
|
3427
3349
|
|
3428
3350
|
#if defined(HAVE_LONG_LONG) // defined in Ruby's defines.h
|
3429
3351
|
offset = rb_ll2inum(of);
|
@@ -3433,13 +3355,12 @@ MagickBooleanType rm_progress_monitor(
|
|
3433
3355
|
span = rb_uint2big((unsigned long)sp);
|
3434
3356
|
#endif
|
3435
3357
|
|
3436
|
-
method = rb_str_new2(rb_id2name(
|
3358
|
+
method = rb_str_new2(rb_id2name(THIS_FUNC()));
|
3437
3359
|
|
3438
3360
|
rval = rb_funcall((VALUE)client_data, rm_ID_call, 3, method, offset, span);
|
3439
3361
|
|
3440
3362
|
return RTEST(rval) ? MagickTrue : MagickFalse;
|
3441
3363
|
}
|
3442
|
-
#endif
|
3443
3364
|
|
3444
3365
|
|
3445
3366
|
/*
|
@@ -3463,107 +3384,6 @@ rm_split(Image *image)
|
|
3463
3384
|
}
|
3464
3385
|
|
3465
3386
|
|
3466
|
-
|
3467
|
-
/*
|
3468
|
-
* Static: copy_exception
|
3469
|
-
* clear_exception
|
3470
|
-
* Purpose: Define alternative implementations of ImageMagick's
|
3471
|
-
* InheritException and ClearMagickException.
|
3472
|
-
* Notes: InheritException is ALWAYS defined in ImageMagick and
|
3473
|
-
* NEVER defined in GraphicsMagick. ClearMagickException
|
3474
|
-
* is defined in ImageMagick 6.2.6 and later and NEVER
|
3475
|
-
* defined in GraphicsMagick.
|
3476
|
-
*
|
3477
|
-
* The purpose of InheritException is to copy the exception
|
3478
|
-
* information from a "related" exception to a destination
|
3479
|
-
* exception if the related exception is more severe than the
|
3480
|
-
* destination exception.
|
3481
|
-
*
|
3482
|
-
* The purpose of ClearException is to reset the ExceptionInfo
|
3483
|
-
* structure to its initial format.
|
3484
|
-
*/
|
3485
|
-
|
3486
|
-
#if defined(HAVE_INHERITEXCEPTION)
|
3487
|
-
|
3488
|
-
// This is ImageMagick - InheritException is always defined
|
3489
|
-
static void copy_exception(ExceptionInfo *exception, ExceptionInfo *relative)
|
3490
|
-
{
|
3491
|
-
InheritException(exception, relative);
|
3492
|
-
}
|
3493
|
-
|
3494
|
-
// ImageMagick < 6.2.6 had a different kind of ExceptionInfo struct
|
3495
|
-
// and doesn't define ClearMagickException.
|
3496
|
-
#if defined(HAVE_CLEARMAGICKEXCEPTION)
|
3497
|
-
static void clear_exception(ExceptionInfo *exception)
|
3498
|
-
{
|
3499
|
-
ClearMagickException(exception);
|
3500
|
-
}
|
3501
|
-
#else
|
3502
|
-
|
3503
|
-
static void clear_exception(ExceptionInfo *exception)
|
3504
|
-
{
|
3505
|
-
DestroyExceptionInfo(exception);
|
3506
|
-
GetExceptionInfo(exception);
|
3507
|
-
}
|
3508
|
-
|
3509
|
-
#endif
|
3510
|
-
|
3511
|
-
|
3512
|
-
#else // !defined(HAVE_INHERITEXCEPTION)
|
3513
|
-
|
3514
|
-
// This is GraphicsMagick. Very old versions don't support the
|
3515
|
-
// module, function, and line fields in the ExceptionInfo struct.
|
3516
|
-
|
3517
|
-
static void copy_exception(ExceptionInfo *exception, ExceptionInfo *relative)
|
3518
|
-
{
|
3519
|
-
assert(exception != NULL);
|
3520
|
-
assert(exception->signature == MagickSignature);
|
3521
|
-
assert(relative != NULL);
|
3522
|
-
|
3523
|
-
if (relative->severity < exception->severity)
|
3524
|
-
{
|
3525
|
-
return;
|
3526
|
-
}
|
3527
|
-
|
3528
|
-
DestroyExceptionInfo(exception);
|
3529
|
-
GetExceptionInfo(exception);
|
3530
|
-
|
3531
|
-
exception->severity = relative->severity;
|
3532
|
-
if (relative->reason)
|
3533
|
-
{
|
3534
|
-
magick_clone_string(&exception->reason, relative->reason);
|
3535
|
-
}
|
3536
|
-
|
3537
|
-
if (relative->description)
|
3538
|
-
{
|
3539
|
-
magick_clone_string(&exception->description, relative->description);
|
3540
|
-
}
|
3541
|
-
|
3542
|
-
|
3543
|
-
#if defined(HAVE_EXCEPTIONINFO_MODULE)
|
3544
|
-
if (relative->module)
|
3545
|
-
{
|
3546
|
-
magick_clone_string(&exception->module, relative->module);
|
3547
|
-
}
|
3548
|
-
if (relative->function)
|
3549
|
-
{
|
3550
|
-
magick_clone_string(&exception->function, relative->function);
|
3551
|
-
}
|
3552
|
-
|
3553
|
-
exception->line = relative->line;
|
3554
|
-
#endif
|
3555
|
-
}
|
3556
|
-
|
3557
|
-
|
3558
|
-
static void clear_exception(ExceptionInfo *exception)
|
3559
|
-
{
|
3560
|
-
DestroyExceptionInfo(exception);
|
3561
|
-
GetExceptionInfo(exception);
|
3562
|
-
}
|
3563
|
-
|
3564
|
-
#endif
|
3565
|
-
|
3566
|
-
|
3567
3387
|
/*
|
3568
3388
|
Extern: rm_check_image_exception
|
3569
3389
|
Purpose: If an ExceptionInfo struct in a list of images indicates a warning,
|
@@ -3593,10 +3413,10 @@ rm_check_image_exception(Image *imglist, ErrorRetention retention)
|
|
3593
3413
|
if (!badboy || image->exception.severity > badboy->exception.severity)
|
3594
3414
|
{
|
3595
3415
|
badboy = image;
|
3596
|
-
|
3416
|
+
InheritException(&exception, &badboy->exception);
|
3597
3417
|
}
|
3598
3418
|
|
3599
|
-
|
3419
|
+
ClearMagickException(&image->exception);
|
3600
3420
|
}
|
3601
3421
|
image = GetNextImageInList(image);
|
3602
3422
|
}
|
@@ -3641,13 +3461,6 @@ handle_exception(ExceptionInfo *exception, Image *imglist, ErrorRetention retent
|
|
3641
3461
|
char desc[500];
|
3642
3462
|
char msg[sizeof(reason)+sizeof(desc)+20];
|
3643
3463
|
|
3644
|
-
#if defined(HAVE_EXCEPTIONINFO_MODULE)
|
3645
|
-
char module[200], function[200];
|
3646
|
-
char extra[sizeof(module)+sizeof(function)+20];
|
3647
|
-
unsigned long line;
|
3648
|
-
#endif
|
3649
|
-
|
3650
|
-
|
3651
3464
|
memset(msg, 0, sizeof(msg));
|
3652
3465
|
|
3653
3466
|
|
@@ -3719,40 +3532,8 @@ handle_exception(ExceptionInfo *exception, Image *imglist, ErrorRetention retent
|
|
3719
3532
|
|
3720
3533
|
msg[sizeof(msg)-1] = '\0';
|
3721
3534
|
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
memset(module, 0, sizeof(module));
|
3726
|
-
memset(function, 0, sizeof(function));
|
3727
|
-
memset(extra, 0, sizeof(extra));
|
3728
|
-
|
3729
|
-
if (exception->module)
|
3730
|
-
{
|
3731
|
-
strncpy(module, exception->module, sizeof(module)-1);
|
3732
|
-
module[sizeof(module)-1] = '\0';
|
3733
|
-
}
|
3734
|
-
if (exception->function)
|
3735
|
-
{
|
3736
|
-
strncpy(function, exception->function, sizeof(function)-1);
|
3737
|
-
function[sizeof(function)-1] = '\0';
|
3738
|
-
}
|
3739
|
-
line = exception->line;
|
3740
|
-
|
3741
|
-
#if defined(HAVE_SNPRINTF)
|
3742
|
-
snprintf(extra, sizeof(extra)-1, "%s at %s:%lu", function, module, line);
|
3743
|
-
#else
|
3744
|
-
sprintf(extra, "%.*s at %.*s:%lu", sizeof(function), function, sizeof(module), module, line);
|
3745
|
-
#endif
|
3746
|
-
|
3747
|
-
extra[sizeof(extra)-1] = '\0';
|
3748
|
-
|
3749
|
-
(void) DestroyExceptionInfo(exception);
|
3750
|
-
rm_magick_error(msg, extra);
|
3751
|
-
|
3752
|
-
#else
|
3753
|
-
(void) DestroyExceptionInfo(exception);
|
3754
|
-
rm_magick_error(msg, NULL);
|
3755
|
-
#endif
|
3535
|
+
(void) DestroyExceptionInfo(exception);
|
3536
|
+
rm_magick_error(msg, NULL);
|
3756
3537
|
|
3757
3538
|
}
|
3758
3539
|
|