rmagick 2.5.2 → 2.6.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 +29 -0
- data/README.html +7 -7
- data/doc/comtasks.html +2 -2
- data/doc/constants.html +22 -5
- data/doc/draw.html +2 -2
- data/doc/ex/affinity.rb +12 -0
- data/doc/ex/affinity_images.rb +21 -0
- data/doc/ex/composite_tiled.rb +23 -0
- data/doc/ex/images/Apple.miff +0 -0
- data/doc/ex/images/Leaf.miff +0 -0
- data/doc/ex/images/Rocks_On_Beach.miff +0 -0
- data/doc/ex/images/Yellow_Rose.miff +0 -0
- data/doc/ex/level_colors.rb +11 -0
- data/doc/ilist.html +72 -30
- data/doc/image1.html +305 -34
- data/doc/image2.html +144 -18
- data/doc/image3.html +111 -8
- data/doc/imageattrs.html +10 -2
- data/doc/imusage.html +5 -5
- data/doc/index.html +3 -3
- data/doc/info.html +2 -2
- data/doc/magick.html +2 -2
- data/doc/optequiv.html +54 -9
- data/doc/rvg.html +2 -2
- data/doc/rvgclip.html +2 -2
- data/doc/rvggroup.html +2 -2
- data/doc/rvgimage.html +2 -2
- data/doc/rvgpattern.html +2 -2
- data/doc/rvgshape.html +2 -2
- data/doc/rvgstyle.html +2 -2
- data/doc/rvgtext.html +2 -2
- data/doc/rvgtspan.html +2 -2
- data/doc/rvgtut.html +2 -2
- data/doc/rvguse.html +2 -2
- data/doc/rvgxform.html +2 -2
- data/doc/struct.html +2 -2
- data/doc/usage.html +27 -8
- data/ext/RMagick/MANIFEST +9 -3
- data/ext/RMagick/extconf.rb +19 -3
- data/ext/RMagick/rmagick.h +23 -7
- data/ext/RMagick/rmdraw.c +74 -22
- data/ext/RMagick/rmfill.c +2 -2
- data/ext/RMagick/rmilist.c +79 -29
- data/ext/RMagick/rmimage.c +904 -393
- data/ext/RMagick/rminfo.c +9 -9
- data/ext/RMagick/rmmain.c +64 -9
- data/ext/RMagick/rmutil.c +158 -44
- data/lib/RMagick.rb +32 -1
- data/rmagick.gemspec +1 -1
- metadata +10 -4
- data/doc/ex/map.rb +0 -28
- data/doc/ex/map_f.rb +0 -15
data/ext/RMagick/rminfo.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: rminfo.c,v 1.
|
1
|
+
/* $Id: rminfo.c,v 1.72 2008/08/26 22:36:15 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
3
|
| Copyright (C) 2008 by Timothy P. Hunter
|
4
4
|
| Name: rminfo.c
|
@@ -278,7 +278,7 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
278
278
|
else
|
279
279
|
{
|
280
280
|
/* Allow any argument that supports to_s */
|
281
|
-
value =
|
281
|
+
value = rm_to_s(value);
|
282
282
|
value_p = StringValuePtr(value);
|
283
283
|
|
284
284
|
(void) RemoveImageOption(info, ckey);
|
@@ -541,7 +541,7 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
541
541
|
{
|
542
542
|
case 3:
|
543
543
|
/* Allow any argument that supports to_s */
|
544
|
-
fmt_arg =
|
544
|
+
fmt_arg = rb_String(argv[2]);
|
545
545
|
value = (const char *)StringValuePtr(fmt_arg);
|
546
546
|
case 2:
|
547
547
|
key = rm_str2cstr(argv[1], &key_l);
|
@@ -665,7 +665,7 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
665
665
|
return self;
|
666
666
|
}
|
667
667
|
|
668
|
-
density =
|
668
|
+
density = rm_to_s(density_arg);
|
669
669
|
dens = StringValuePtr(density);
|
670
670
|
if (!IsGeometry(dens))
|
671
671
|
{
|
@@ -830,7 +830,7 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
830
830
|
return self;
|
831
831
|
}
|
832
832
|
|
833
|
-
extract =
|
833
|
+
extract = rm_to_s(extract_arg);
|
834
834
|
extr = StringValuePtr(extract);
|
835
835
|
if (!IsGeometry(extr))
|
836
836
|
{
|
@@ -1283,7 +1283,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1283
1283
|
return self;
|
1284
1284
|
}
|
1285
1285
|
|
1286
|
-
origin_str =
|
1286
|
+
origin_str = rm_to_s(origin_arg);
|
1287
1287
|
origin = GetPageGeometry(StringValuePtr(origin_str));
|
1288
1288
|
|
1289
1289
|
if (IsGeometry(origin) == MagickFalse)
|
@@ -1326,7 +1326,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1326
1326
|
info->page = NULL;
|
1327
1327
|
return self;
|
1328
1328
|
}
|
1329
|
-
geom_str =
|
1329
|
+
geom_str = rm_to_s(page_arg);
|
1330
1330
|
geometry=GetPageGeometry(StringValuePtr(geom_str));
|
1331
1331
|
if (*geometry == '\0')
|
1332
1332
|
{
|
@@ -1442,7 +1442,7 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
1442
1442
|
return self;
|
1443
1443
|
}
|
1444
1444
|
|
1445
|
-
size =
|
1445
|
+
size = rm_to_s(size_arg);
|
1446
1446
|
sz = StringValuePtr(size);
|
1447
1447
|
if (!IsGeometry(sz))
|
1448
1448
|
{
|
@@ -1549,7 +1549,7 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
|
|
1549
1549
|
volatile VALUE offset_str;
|
1550
1550
|
char *tile_offset;
|
1551
1551
|
|
1552
|
-
offset_str =
|
1552
|
+
offset_str = rm_to_s(offset);
|
1553
1553
|
tile_offset = StringValuePtr(offset_str);
|
1554
1554
|
if (!IsGeometry(tile_offset))
|
1555
1555
|
{
|
data/ext/RMagick/rmmain.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: rmmain.c,v 1.
|
1
|
+
/* $Id: rmmain.c,v 1.266 2008/08/31 20:00:39 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
3
|
| Copyright (C) 2008 by Timothy P. Hunter
|
4
4
|
| Name: rmmain.c
|
@@ -66,6 +66,7 @@ Magick_colors(VALUE class)
|
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
69
|
+
|
69
70
|
/*
|
70
71
|
Method: Magick::fonts [ { |fontinfo| } ]
|
71
72
|
Purpose: If called with the optional block, iterates over the fonts,
|
@@ -123,7 +124,8 @@ Magick_fonts(VALUE class)
|
|
123
124
|
There are 3 implementations.
|
124
125
|
*/
|
125
126
|
|
126
|
-
static VALUE
|
127
|
+
static VALUE
|
128
|
+
MagickInfo_to_format(const MagickInfo *magick_info)
|
127
129
|
{
|
128
130
|
char mode[4];
|
129
131
|
|
@@ -135,6 +137,7 @@ static VALUE MagickInfo_to_format(const MagickInfo *magick_info)
|
|
135
137
|
return rb_str_new(mode, sizeof(mode));
|
136
138
|
}
|
137
139
|
|
140
|
+
|
138
141
|
VALUE
|
139
142
|
Magick_init_formats(VALUE class)
|
140
143
|
{
|
@@ -256,7 +259,6 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE class)
|
|
256
259
|
}
|
257
260
|
|
258
261
|
|
259
|
-
|
260
262
|
/*
|
261
263
|
Method Magick.set_cache_threshold(megabytes)
|
262
264
|
Purpose: sets the amount of free memory allocated for the
|
@@ -273,6 +275,7 @@ Magick_set_cache_threshold(VALUE class, VALUE threshold)
|
|
273
275
|
return class;
|
274
276
|
}
|
275
277
|
|
278
|
+
|
276
279
|
/*
|
277
280
|
Method: Magick.set_log_event_mask(event,...) -> Magick
|
278
281
|
Notes: "event" is one of "all", "annotate", "blob", "cache",
|
@@ -318,14 +321,12 @@ Magick_set_log_format(VALUE class, VALUE format)
|
|
318
321
|
}
|
319
322
|
|
320
323
|
|
321
|
-
|
322
324
|
/*
|
323
325
|
External: Init_RMagick2
|
324
326
|
Purpose: define the classes and constants
|
325
327
|
Arguments: void
|
326
328
|
Returns: void
|
327
329
|
*/
|
328
|
-
|
329
330
|
void
|
330
331
|
Init_RMagick2(void)
|
331
332
|
{
|
@@ -355,6 +356,7 @@ Init_RMagick2(void)
|
|
355
356
|
rm_ID_from_s = rb_intern("from_s");
|
356
357
|
rm_ID_Geometry = rb_intern("Geometry");
|
357
358
|
rm_ID_GeometryValue = rb_intern("GeometryValue");
|
359
|
+
rm_ID_has_key_q = rb_intern("has_key?");
|
358
360
|
rm_ID_height = rb_intern("height");
|
359
361
|
rm_ID_initialize_copy = rb_intern("initialize_copy");
|
360
362
|
rm_ID_length = rb_intern("length");
|
@@ -479,6 +481,7 @@ Init_RMagick2(void)
|
|
479
481
|
rb_define_method(Class_Image, "add_noise_channel", Image_add_noise_channel, -1);
|
480
482
|
rb_define_method(Class_Image, "add_profile", Image_add_profile, 1);
|
481
483
|
rb_define_method(Class_Image, "affine_transform", Image_affine_transform, 1);
|
484
|
+
rb_define_method(Class_Image, "affinity", Image_affinity, -1);
|
482
485
|
rb_define_method(Class_Image, "alpha", Image_alpha, -1);
|
483
486
|
rb_define_method(Class_Image, "alpha?", Image_alpha_q, 0);
|
484
487
|
rb_define_method(Class_Image, "[]", Image_aref, 1);
|
@@ -517,6 +520,8 @@ Init_RMagick2(void)
|
|
517
520
|
rb_define_method(Class_Image, "composite_affine", Image_composite_affine, 2);
|
518
521
|
rb_define_method(Class_Image, "composite_channel", Image_composite_channel, -1);
|
519
522
|
rb_define_method(Class_Image, "composite_channel!", Image_composite_channel_bang, -1);
|
523
|
+
rb_define_method(Class_Image, "composite_tiled", Image_composite_tiled, -1);
|
524
|
+
rb_define_method(Class_Image, "composite_tiled!", Image_composite_tiled_bang, -1);
|
520
525
|
rb_define_method(Class_Image, "compress_colormap!", Image_compress_colormap_bang, 0);
|
521
526
|
rb_define_method(Class_Image, "contrast", Image_contrast, -1);
|
522
527
|
rb_define_method(Class_Image, "contrast_stretch_channel", Image_contrast_stretch_channel, -1);
|
@@ -527,6 +532,8 @@ Init_RMagick2(void)
|
|
527
532
|
rb_define_method(Class_Image, "crop!", Image_crop_bang, -1);
|
528
533
|
rb_define_method(Class_Image, "cycle_colormap", Image_cycle_colormap, 1);
|
529
534
|
rb_define_method(Class_Image, "decipher", Image_decipher, 1);
|
535
|
+
rb_define_method(Class_Image, "define", Image_define, 2);
|
536
|
+
rb_define_method(Class_Image, "deskew", Image_deskew, -1);
|
530
537
|
rb_define_method(Class_Image, "delete_compose_mask", Image_delete_compose_mask, 0);
|
531
538
|
rb_define_method(Class_Image, "delete_profile", Image_delete_profile, 1);
|
532
539
|
rb_define_method(Class_Image, "despeckle", Image_despeckle, 0);
|
@@ -574,6 +581,8 @@ Init_RMagick2(void)
|
|
574
581
|
rb_define_method(Class_Image, "inspect", Image_inspect, 0);
|
575
582
|
rb_define_method(Class_Image, "level2", Image_level2, -1);
|
576
583
|
rb_define_method(Class_Image, "level_channel", Image_level_channel, -1);
|
584
|
+
rb_define_method(Class_Image, "level_colors", Image_level_colors, -1);
|
585
|
+
rb_define_method(Class_Image, "levelize_channel", Image_levelize_channel, -1);
|
577
586
|
rb_define_method(Class_Image, "linear_stretch", Image_linear_stretch, -1);
|
578
587
|
rb_define_method(Class_Image, "liquid_rescale", Image_liquid_rescale, -1);
|
579
588
|
rb_define_method(Class_Image, "magnify", Image_magnify, 0);
|
@@ -637,6 +646,7 @@ Init_RMagick2(void)
|
|
637
646
|
rb_define_method(Class_Image, "sketch", Image_sketch, -1);
|
638
647
|
rb_define_method(Class_Image, "solarize", Image_solarize, -1);
|
639
648
|
rb_define_method(Class_Image, "<=>", Image_spaceship, 1);
|
649
|
+
rb_define_method(Class_Image, "sparse_color", Image_sparse_color, -1);
|
640
650
|
rb_define_method(Class_Image, "splice", Image_splice, -1);
|
641
651
|
rb_define_method(Class_Image, "spread", Image_spread, -1);
|
642
652
|
rb_define_method(Class_Image, "stegano", Image_stegano, 2);
|
@@ -659,6 +669,7 @@ Init_RMagick2(void)
|
|
659
669
|
rb_define_method(Class_Image, "transverse!", Image_transverse_bang, 0);
|
660
670
|
rb_define_method(Class_Image, "trim", Image_trim, -1);
|
661
671
|
rb_define_method(Class_Image, "trim!", Image_trim_bang, -1);
|
672
|
+
rb_define_method(Class_Image, "undefine", Image_undefine, 1);
|
662
673
|
rb_define_method(Class_Image, "unique_colors", Image_unique_colors, 0);
|
663
674
|
rb_define_method(Class_Image, "unsharp_mask", Image_unsharp_mask, -1);
|
664
675
|
rb_define_method(Class_Image, "unsharp_mask_channel", Image_unsharp_mask_channel, -1);
|
@@ -677,6 +688,7 @@ Init_RMagick2(void)
|
|
677
688
|
|
678
689
|
// Define an alias for Object#display before we override it
|
679
690
|
rb_define_alias(Class_ImageList, "__display__", "display");
|
691
|
+
rb_define_method(Class_ImageList, "affinity", ImageList_affinity, -1);
|
680
692
|
rb_define_method(Class_ImageList, "animate", ImageList_animate, -1);
|
681
693
|
rb_define_method(Class_ImageList, "append", ImageList_append, 1);
|
682
694
|
rb_define_method(Class_ImageList, "average", ImageList_average, 0);
|
@@ -1243,13 +1255,37 @@ Init_RMagick2(void)
|
|
1243
1255
|
ENUMERATOR(AffineProjectionDistortion)
|
1244
1256
|
#if defined(HAVE_ENUM_ARCDISTORTION)
|
1245
1257
|
ENUMERATOR(ArcDistortion)
|
1258
|
+
#endif
|
1259
|
+
#if defined(HAVE_ENUM_POLARDISTORTION)
|
1260
|
+
ENUMERATOR(PolarDistortion)
|
1261
|
+
#endif
|
1262
|
+
#if defined(HAVE_ENUM_DEPOLARDISTORTION)
|
1263
|
+
ENUMERATOR(DePolarDistortion)
|
1264
|
+
#endif
|
1265
|
+
#if defined(HAVE_ENUM_BARRELDISTORTION)
|
1266
|
+
ENUMERATOR(BarrelDistortion)
|
1246
1267
|
#endif
|
1247
1268
|
ENUMERATOR(BilinearDistortion)
|
1248
1269
|
ENUMERATOR(PerspectiveDistortion)
|
1249
|
-
#if defined(
|
1270
|
+
#if defined(HAVE_ENUM_PERSPECTIVEPROJECTIONDISTORTION)
|
1250
1271
|
ENUMERATOR(PerspectiveProjectionDistortion)
|
1272
|
+
#endif
|
1273
|
+
#if defined(HAVE_ENUM_POLYNOMIALDISTORTION)
|
1274
|
+
ENUMERATOR(PolynomialDistortion)
|
1251
1275
|
#endif
|
1252
1276
|
ENUMERATOR(ScaleRotateTranslateDistortion)
|
1277
|
+
#if defined(HAVE_ENUM_SHEPARDSDISTORTION)
|
1278
|
+
ENUMERATOR(ShepardsDistortion)
|
1279
|
+
#endif
|
1280
|
+
END_ENUM
|
1281
|
+
#endif
|
1282
|
+
|
1283
|
+
#if defined(HAVE_TYPE_DITHERMETHOD)
|
1284
|
+
DEF_ENUM(DitherMethod)
|
1285
|
+
ENUMERATOR(UndefinedDitherMethod)
|
1286
|
+
ENUMERATOR(NoDitherMethod)
|
1287
|
+
ENUMERATOR(RiemersmaDitherMethod)
|
1288
|
+
ENUMERATOR(FloydSteinbergDitherMethod)
|
1253
1289
|
END_ENUM
|
1254
1290
|
#endif
|
1255
1291
|
|
@@ -1516,6 +1552,17 @@ Init_RMagick2(void)
|
|
1516
1552
|
ENUMERATOR(PixelsPerCentimeterResolution)
|
1517
1553
|
END_ENUM
|
1518
1554
|
|
1555
|
+
#if defined(HAVE_SPARSECOLORINTERPOLATE)
|
1556
|
+
DEF_ENUM(SparseColorInterpolateMethod)
|
1557
|
+
ENUMERATOR(UndefinedColorInterpolate)
|
1558
|
+
ENUMERATOR(BarycentricColorInterpolate)
|
1559
|
+
ENUMERATOR(BilinearColorInterpolate)
|
1560
|
+
ENUMERATOR(PolynomialColorInterpolate)
|
1561
|
+
ENUMERATOR(ShepardsColorInterpolate)
|
1562
|
+
ENUMERATOR(VoronoiColorInterpolate)
|
1563
|
+
END_ENUM
|
1564
|
+
#endif
|
1565
|
+
|
1519
1566
|
// StorageType
|
1520
1567
|
DEF_ENUM(StorageType)
|
1521
1568
|
ENUMERATOR(UndefinedPixel)
|
@@ -1572,6 +1619,12 @@ Init_RMagick2(void)
|
|
1572
1619
|
#endif
|
1573
1620
|
#if defined(HAVE_ENUM_WHITEVIRTUALPIXELMETHOD)
|
1574
1621
|
ENUMERATOR(WhiteVirtualPixelMethod)
|
1622
|
+
#endif
|
1623
|
+
#if defined(HAVE_ENUM_HORIZONTALTILEVIRTUALPIXELMETHOD)
|
1624
|
+
ENUMERATOR(HorizontalTileVirtualPixelMethod)
|
1625
|
+
#endif
|
1626
|
+
#if defined(HAVE_ENUM_VERTICALTILEVIRTUALPIXELMETHOD)
|
1627
|
+
ENUMERATOR(VerticalTileVirtualPixelMethod)
|
1575
1628
|
#endif
|
1576
1629
|
END_ENUM
|
1577
1630
|
|
@@ -1656,7 +1709,8 @@ Init_RMagick2(void)
|
|
1656
1709
|
* Notes: Bypass the test by defining the constant RMAGICK_BYPASS_VERSION_TEST
|
1657
1710
|
* to 'true' at the top level, before requiring 'RMagick'
|
1658
1711
|
*/
|
1659
|
-
static void
|
1712
|
+
static void
|
1713
|
+
test_Magick_version(void)
|
1660
1714
|
{
|
1661
1715
|
unsigned long version_number;
|
1662
1716
|
const char *version_str;
|
@@ -1696,7 +1750,8 @@ static void test_Magick_version(void)
|
|
1696
1750
|
Static: version_constants
|
1697
1751
|
Purpose: create Version, Magick_version, and Version_long constants.
|
1698
1752
|
*/
|
1699
|
-
static void
|
1753
|
+
static void
|
1754
|
+
version_constants(void)
|
1700
1755
|
{
|
1701
1756
|
const char *mgk_version;
|
1702
1757
|
volatile VALUE str;
|
@@ -1713,7 +1768,7 @@ static void version_constants(void)
|
|
1713
1768
|
rb_define_const(Module_Magick, "Version", str);
|
1714
1769
|
|
1715
1770
|
sprintf(long_version,
|
1716
|
-
"This is %s ($Date: 2008/
|
1771
|
+
"This is %s ($Date: 2008/08/31 20:00:39 $) Copyright (C) 2008 by Timothy P. Hunter\n"
|
1717
1772
|
"Built with %s\n"
|
1718
1773
|
"Built for %s\n"
|
1719
1774
|
"Web page: http://rmagick.rubyforge.org\n"
|
data/ext/RMagick/rmutil.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: rmutil.c,v 1.
|
1
|
+
/* $Id: rmutil.c,v 1.162 2008/09/03 00:00:35 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
3
|
| Copyright (C) 2008 by Timothy P. Hunter
|
4
4
|
| Name: rmutil.c
|
@@ -32,7 +32,8 @@ static VALUE Pixel_from_MagickPixelPacket(const MagickPixelPacket *);
|
|
32
32
|
caused by integer overflow. Added in 6.3.5-9 but backwards
|
33
33
|
compatible with prior releases.
|
34
34
|
*/
|
35
|
-
void *
|
35
|
+
void *
|
36
|
+
magick_safe_malloc(const size_t count, const size_t quantum)
|
36
37
|
{
|
37
38
|
#if defined(HAVE_ACQUIREQUANTUMMEMORY)
|
38
39
|
void *ptr;
|
@@ -57,7 +58,9 @@ void *magick_safe_malloc(const size_t count, const size_t quantum)
|
|
57
58
|
#endif
|
58
59
|
}
|
59
60
|
|
60
|
-
|
61
|
+
|
62
|
+
void *
|
63
|
+
magick_malloc(const size_t size)
|
61
64
|
{
|
62
65
|
void *ptr;
|
63
66
|
ptr = AcquireMagickMemory(size);
|
@@ -69,12 +72,16 @@ void *magick_malloc(const size_t size)
|
|
69
72
|
return ptr;
|
70
73
|
}
|
71
74
|
|
72
|
-
|
75
|
+
|
76
|
+
void
|
77
|
+
magick_free(void *ptr)
|
73
78
|
{
|
74
79
|
(void) RelinquishMagickMemory(ptr);
|
75
80
|
}
|
76
81
|
|
77
|
-
|
82
|
+
|
83
|
+
void *
|
84
|
+
magick_safe_realloc(void *memory, const size_t count, const size_t quantum)
|
78
85
|
{
|
79
86
|
#if defined(HAVE_RESIZEQUANTUMMEMORY)
|
80
87
|
void *v;
|
@@ -96,7 +103,9 @@ void *magick_safe_realloc(void *memory, const size_t count, const size_t quantum
|
|
96
103
|
#endif
|
97
104
|
}
|
98
105
|
|
99
|
-
|
106
|
+
|
107
|
+
void *
|
108
|
+
magick_realloc(void *ptr, const size_t size)
|
100
109
|
{
|
101
110
|
void *v;
|
102
111
|
v = ResizeMagickMemory(ptr, size);
|
@@ -107,6 +116,7 @@ void *magick_realloc(void *ptr, const size_t size)
|
|
107
116
|
return v;
|
108
117
|
}
|
109
118
|
|
119
|
+
|
110
120
|
/*
|
111
121
|
Extern: magick_clone_string
|
112
122
|
Purpose: make a copy of a string in malloc'd memory
|
@@ -115,7 +125,8 @@ void *magick_realloc(void *ptr, const size_t size)
|
|
115
125
|
its return value.
|
116
126
|
|
117
127
|
*/
|
118
|
-
void
|
128
|
+
void
|
129
|
+
magick_clone_string(char **new_str, const char *str)
|
119
130
|
{
|
120
131
|
(void) CloneString(new_str, str);
|
121
132
|
}
|
@@ -142,8 +153,6 @@ rm_strcasecmp(const char *s1, const char *s2)
|
|
142
153
|
}
|
143
154
|
|
144
155
|
|
145
|
-
|
146
|
-
|
147
156
|
/*
|
148
157
|
* Extern: rm_strncasecmp(s1, s2, n)
|
149
158
|
* Purpose: compare s1 and s2 ignoring case
|
@@ -169,7 +178,6 @@ rm_strncasecmp(const char *s1, const char *s2, size_t n)
|
|
169
178
|
}
|
170
179
|
|
171
180
|
|
172
|
-
|
173
181
|
/*
|
174
182
|
* Extern: rm_check_ary_len(ary, len)
|
175
183
|
* Purpose: raise exception if array too short
|
@@ -225,6 +233,23 @@ VALUE
|
|
225
233
|
rm_no_freeze(VALUE obj)
|
226
234
|
{
|
227
235
|
rb_raise(rb_eTypeError, "can't freeze %s", rb_class2name(CLASS_OF(obj)));
|
236
|
+
return (VALUE)0;
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
/*
|
241
|
+
Extern: rm_to_s
|
242
|
+
Purpose: return obj.to_s, or obj if obj is already a string.
|
243
|
+
*/
|
244
|
+
VALUE
|
245
|
+
rm_to_s(VALUE obj)
|
246
|
+
{
|
247
|
+
|
248
|
+
if (TYPE(obj) != T_STRING)
|
249
|
+
{
|
250
|
+
return rb_funcall(obj, rm_ID_to_s, 0);
|
251
|
+
}
|
252
|
+
return obj;
|
228
253
|
}
|
229
254
|
|
230
255
|
|
@@ -268,8 +293,10 @@ rescue_not_str(VALUE arg)
|
|
268
293
|
{
|
269
294
|
rb_raise(rb_eTypeError, "argument must be a number or a string in the form 'NN%%' (%s given)",
|
270
295
|
rb_class2name(CLASS_OF(arg)));
|
296
|
+
return (VALUE)0;
|
271
297
|
}
|
272
298
|
|
299
|
+
|
273
300
|
/*
|
274
301
|
* Extern: rm_percentage(obj)
|
275
302
|
* Purpose: Return a double between 0.0 and 1.0, inclusive.
|
@@ -357,7 +384,8 @@ rescue_not_dbl(VALUE ignored)
|
|
357
384
|
Extern: rm_check_num2dbl
|
358
385
|
Purpose: Return 1 if the object can be converted to a double, 0 otherwise.
|
359
386
|
*/
|
360
|
-
int
|
387
|
+
int
|
388
|
+
rm_check_num2dbl(VALUE obj)
|
361
389
|
{
|
362
390
|
return FIX2INT(rb_rescue(check_num2dbl, obj, rescue_not_dbl, (VALUE)0));
|
363
391
|
}
|
@@ -368,7 +396,8 @@ int rm_check_num2dbl(VALUE obj)
|
|
368
396
|
* Purpose: Given a string in the form NN% return the corresponding double.
|
369
397
|
*
|
370
398
|
*/
|
371
|
-
double
|
399
|
+
double
|
400
|
+
rm_str_to_pct(VALUE str)
|
372
401
|
{
|
373
402
|
long pct;
|
374
403
|
char *pct_str, *end;
|
@@ -473,7 +502,7 @@ rm_app2quantum(VALUE obj)
|
|
473
502
|
|
474
503
|
|
475
504
|
/*
|
476
|
-
Extern:
|
505
|
+
Extern: rm_cur_image
|
477
506
|
Purpose: Sends the "cur_image" method to the object. If 'img'
|
478
507
|
is an ImageList, then cur_image is self[@scene].
|
479
508
|
If 'img' is an image, then cur_image is simply
|
@@ -481,11 +510,12 @@ rm_app2quantum(VALUE obj)
|
|
481
510
|
Returns: the return value from "cur_image"
|
482
511
|
*/
|
483
512
|
VALUE
|
484
|
-
|
513
|
+
rm_cur_image(VALUE img)
|
485
514
|
{
|
486
515
|
return rb_funcall(img, rm_ID_cur_image, 0);
|
487
516
|
}
|
488
517
|
|
518
|
+
|
489
519
|
/*
|
490
520
|
Method: Magick::PrimaryInfo#to_s
|
491
521
|
Purpose: Create a string representation of a Magick::PrimaryInfo
|
@@ -501,6 +531,7 @@ PrimaryInfo_to_s(VALUE self)
|
|
501
531
|
return rb_str_new2(buff);
|
502
532
|
}
|
503
533
|
|
534
|
+
|
504
535
|
/*
|
505
536
|
Method: Magick::Chromaticity#to_s
|
506
537
|
Purpose: Create a string representation of a Magick::Chromaticity
|
@@ -523,6 +554,7 @@ ChromaticityInfo_to_s(VALUE self)
|
|
523
554
|
return rb_str_new2(buff);
|
524
555
|
}
|
525
556
|
|
557
|
+
|
526
558
|
/*
|
527
559
|
Method: Magick::Pixel#to_s
|
528
560
|
Purpose: Create a string representation of a Magick::Pixel
|
@@ -539,6 +571,7 @@ Pixel_to_s(VALUE self)
|
|
539
571
|
return rb_str_new2(buff);
|
540
572
|
}
|
541
573
|
|
574
|
+
|
542
575
|
/*
|
543
576
|
Method: Magick::Pixel.from_color(string)
|
544
577
|
Purpose: Construct an Magick::Pixel corresponding to the given color name.
|
@@ -577,7 +610,8 @@ Pixel_from_color(VALUE class, VALUE name)
|
|
577
610
|
Notes: Same code as the private function SetMagickPixelPacket
|
578
611
|
in ImageMagick.
|
579
612
|
*/
|
580
|
-
static void
|
613
|
+
static void
|
614
|
+
rm_set_magick_pixel_packet(Pixel *pixel, IndexPacket *index_packet, MagickPixelPacket *pp)
|
581
615
|
{
|
582
616
|
pp->red = (MagickRealType) pixel->red;
|
583
617
|
pp->green = (MagickRealType) pixel->green;
|
@@ -587,7 +621,6 @@ static void rm_set_magick_pixel_packet(Pixel *pixel, IndexPacket *index_packet,
|
|
587
621
|
}
|
588
622
|
|
589
623
|
|
590
|
-
|
591
624
|
/*
|
592
625
|
Method: Magick::Pixel#to_color(compliance=AllCompliance, matte=false,
|
593
626
|
depth=QuantumDepth, hex=false)
|
@@ -681,6 +714,7 @@ Pixel_to_color(int argc, VALUE *argv, VALUE self)
|
|
681
714
|
return rb_str_new2(name);
|
682
715
|
}
|
683
716
|
|
717
|
+
|
684
718
|
/*
|
685
719
|
Method: Pixel#to_HSL *** DEPRECATED ***
|
686
720
|
Purpose: Converts an RGB pixel to the array
|
@@ -707,6 +741,7 @@ Pixel_to_HSL(VALUE self)
|
|
707
741
|
return hsl;
|
708
742
|
}
|
709
743
|
|
744
|
+
|
710
745
|
/*
|
711
746
|
Method: Pixel.from_HSL *** DEPRECATED ***
|
712
747
|
Purpose: Constructs an RGB pixel from the array
|
@@ -743,7 +778,6 @@ Pixel_from_HSL(VALUE class, VALUE hsl)
|
|
743
778
|
}
|
744
779
|
|
745
780
|
|
746
|
-
|
747
781
|
/*
|
748
782
|
Method: Pixel#from_hsla(hue, saturation, lightness, alpha=1)
|
749
783
|
Purpose: Replace brain-dead from_HSL, above.
|
@@ -865,6 +899,7 @@ Pixel_eql_q(VALUE self, VALUE other)
|
|
865
899
|
return NUM2INT(Pixel_spaceship(self, other)) == 0 ? Qtrue : Qfalse;
|
866
900
|
}
|
867
901
|
|
902
|
+
|
868
903
|
/*
|
869
904
|
Method: Pixel#fcmp(other[, fuzz[, colorspace]])
|
870
905
|
Purpose: Compare pixel values for equality
|
@@ -949,6 +984,7 @@ Pixel_hash(VALUE self)
|
|
949
984
|
|
950
985
|
}
|
951
986
|
|
987
|
+
|
952
988
|
/*
|
953
989
|
Method: Pixel#intensity
|
954
990
|
Purpose: Return the "intensity" of a pixel
|
@@ -1000,12 +1036,12 @@ DEF_PIXEL_CMYK_CHANNEL_ACCESSOR(yellow, blue)
|
|
1000
1036
|
DEF_PIXEL_CMYK_CHANNEL_ACCESSOR(black, opacity)
|
1001
1037
|
|
1002
1038
|
|
1003
|
-
|
1004
1039
|
/*
|
1005
1040
|
Method: Pixel#<=>
|
1006
1041
|
Purpose: Support Comparable mixin
|
1007
1042
|
*/
|
1008
|
-
VALUE
|
1043
|
+
VALUE
|
1044
|
+
Pixel_spaceship(VALUE self, VALUE other)
|
1009
1045
|
{
|
1010
1046
|
Pixel *this, *that;
|
1011
1047
|
|
@@ -1110,7 +1146,8 @@ Pixel_initialize(int argc, VALUE *argv, VALUE self)
|
|
1110
1146
|
Purpose: "Case equal" operator for Pixel
|
1111
1147
|
*/
|
1112
1148
|
|
1113
|
-
VALUE
|
1149
|
+
VALUE
|
1150
|
+
Pixel_case_eq(VALUE self, VALUE other)
|
1114
1151
|
{
|
1115
1152
|
Pixel *this, *that;
|
1116
1153
|
|
@@ -1168,7 +1205,8 @@ Pixel_clone(VALUE self)
|
|
1168
1205
|
Method: Pixel#initialize_copy
|
1169
1206
|
Purpose: initialize clone, dup methods
|
1170
1207
|
*/
|
1171
|
-
VALUE
|
1208
|
+
VALUE
|
1209
|
+
Pixel_init_copy(VALUE self, VALUE orig)
|
1172
1210
|
{
|
1173
1211
|
Pixel *copy, *original;
|
1174
1212
|
|
@@ -1181,7 +1219,6 @@ VALUE Pixel_init_copy(VALUE self, VALUE orig)
|
|
1181
1219
|
}
|
1182
1220
|
|
1183
1221
|
|
1184
|
-
|
1185
1222
|
/*
|
1186
1223
|
Method: Magick::Rectangle#to_s
|
1187
1224
|
Purpose: Create a string representation of a Magick::Rectangle
|
@@ -1198,6 +1235,7 @@ RectangleInfo_to_s(VALUE self)
|
|
1198
1235
|
return rb_str_new2(buff);
|
1199
1236
|
}
|
1200
1237
|
|
1238
|
+
|
1201
1239
|
/*
|
1202
1240
|
Method: Magick::SegmentInfo#to_s
|
1203
1241
|
Purpose: Create a string representation of a Magick::Segment
|
@@ -1214,6 +1252,7 @@ SegmentInfo_to_s(VALUE self)
|
|
1214
1252
|
return rb_str_new2(buff);
|
1215
1253
|
}
|
1216
1254
|
|
1255
|
+
|
1217
1256
|
/*
|
1218
1257
|
Extern: PixelPacket_to_Color_Name
|
1219
1258
|
Purpose: Map the color intensity to a named color
|
@@ -1236,6 +1275,7 @@ PixelPacket_to_Color_Name(Image *image, PixelPacket *color)
|
|
1236
1275
|
return rb_str_new2(name);
|
1237
1276
|
}
|
1238
1277
|
|
1278
|
+
|
1239
1279
|
/*
|
1240
1280
|
Extern: PixelPacket_to_Color_Name_Info
|
1241
1281
|
Purpose: Map the color intensity to a named color
|
@@ -1269,6 +1309,7 @@ PixelPacket_to_Color_Name_Info(Info *info, PixelPacket *color)
|
|
1269
1309
|
return color_name;
|
1270
1310
|
}
|
1271
1311
|
|
1312
|
+
|
1272
1313
|
/*
|
1273
1314
|
Static: Color_Name_to_PixelPacket
|
1274
1315
|
Purpose: Convert a color name to a PixelPacket
|
@@ -1439,6 +1480,7 @@ ColorspaceType_new(ColorspaceType cs)
|
|
1439
1480
|
|
1440
1481
|
}
|
1441
1482
|
|
1483
|
+
|
1442
1484
|
/*
|
1443
1485
|
* Static: ComplianceType_new
|
1444
1486
|
Purpose: construct a ComplianceType enum object for the specified value
|
@@ -1531,6 +1573,7 @@ CompositeOperator_name(CompositeOperator op)
|
|
1531
1573
|
return "UndefinedCompositeOp";
|
1532
1574
|
}
|
1533
1575
|
|
1576
|
+
|
1534
1577
|
/*
|
1535
1578
|
External: CompositeOperator_new
|
1536
1579
|
Purpose: Construct a CompositeOperator enum object for the specified value
|
@@ -1687,7 +1730,6 @@ FilterTypes_new(FilterTypes type)
|
|
1687
1730
|
}
|
1688
1731
|
|
1689
1732
|
|
1690
|
-
|
1691
1733
|
/*
|
1692
1734
|
Static: EndianType_name
|
1693
1735
|
Purpose: Return the name of a EndianType enum as a string
|
@@ -1704,6 +1746,7 @@ EndianType_name(EndianType type)
|
|
1704
1746
|
return "UndefinedEndian";
|
1705
1747
|
}
|
1706
1748
|
|
1749
|
+
|
1707
1750
|
/*
|
1708
1751
|
External: EndianType.new
|
1709
1752
|
Purpose: Construct an EndianType enum object
|
@@ -1755,7 +1798,6 @@ GravityType_new(GravityType type)
|
|
1755
1798
|
}
|
1756
1799
|
|
1757
1800
|
|
1758
|
-
|
1759
1801
|
/*
|
1760
1802
|
Static: ImageType_name
|
1761
1803
|
Purpose: Return the name of a ImageType enum as a string
|
@@ -1921,6 +1963,7 @@ LAYERMETHODTYPE_NAME(LAYERMETHODTYPE method)
|
|
1921
1963
|
return "UndefinedLayer";
|
1922
1964
|
}
|
1923
1965
|
|
1966
|
+
|
1924
1967
|
VALUE
|
1925
1968
|
LAYERMETHODTYPE_NEW(LAYERMETHODTYPE method)
|
1926
1969
|
{
|
@@ -1949,7 +1992,6 @@ RenderingIntent_name(RenderingIntent intent)
|
|
1949
1992
|
}
|
1950
1993
|
|
1951
1994
|
|
1952
|
-
|
1953
1995
|
/*
|
1954
1996
|
External: RenderingIntent_new
|
1955
1997
|
Purpose: Construct an RenderingIntent enum object for the specified value.
|
@@ -2097,6 +2139,7 @@ Color_to_ColorInfo(ColorInfo *ci, VALUE st)
|
|
2097
2139
|
}
|
2098
2140
|
}
|
2099
2141
|
|
2142
|
+
|
2100
2143
|
/*
|
2101
2144
|
Static: destroy_ColorInfo
|
2102
2145
|
Purpose: free the storage allocated by Color_to_ColorInfo, above.
|
@@ -2108,6 +2151,7 @@ destroy_ColorInfo(ColorInfo *ci)
|
|
2108
2151
|
ci->name = NULL;
|
2109
2152
|
}
|
2110
2153
|
|
2154
|
+
|
2111
2155
|
/*
|
2112
2156
|
Method: Color#to_s
|
2113
2157
|
Purpose: Return a string representation of a Magick::Color object
|
@@ -2134,6 +2178,7 @@ Color_to_s(VALUE self)
|
|
2134
2178
|
return rb_str_new2(buff);
|
2135
2179
|
}
|
2136
2180
|
|
2181
|
+
|
2137
2182
|
/*
|
2138
2183
|
Extern: Pixel_from_PixelPacket
|
2139
2184
|
Purpose: Create a Magick::Pixel object from a PixelPacket structure.
|
@@ -2180,8 +2225,10 @@ color_arg_rescue(VALUE arg)
|
|
2180
2225
|
{
|
2181
2226
|
rb_raise(rb_eTypeError, "argument must be color name or pixel (%s given)",
|
2182
2227
|
rb_class2name(CLASS_OF(arg)));
|
2228
|
+
return (VALUE)0;
|
2183
2229
|
}
|
2184
2230
|
|
2231
|
+
|
2185
2232
|
/*
|
2186
2233
|
Extern: Color_to_PixelPacket
|
2187
2234
|
Purpose: Convert either a String color name or
|
@@ -2241,6 +2288,7 @@ PrimaryInfo_from_PrimaryInfo(PrimaryInfo *p)
|
|
2241
2288
|
, INT2FIX(p->x), INT2FIX(p->y), INT2FIX(p->z));
|
2242
2289
|
}
|
2243
2290
|
|
2291
|
+
|
2244
2292
|
/*
|
2245
2293
|
Extern: PrimaryInfo_to_PrimaryInfo
|
2246
2294
|
Purpose: Convert a Magick::PrimaryInfo object to a PrimaryInfo structure
|
@@ -2264,6 +2312,7 @@ PrimaryInfo_to_PrimaryInfo(PrimaryInfo *pi, VALUE sp)
|
|
2264
2312
|
pi->z = m == Qnil ? 0.0 : NUM2DBL(m);
|
2265
2313
|
}
|
2266
2314
|
|
2315
|
+
|
2267
2316
|
/*
|
2268
2317
|
Extern: PointInfo_to_Point(pp)
|
2269
2318
|
Purpose: Create a Magick::Point object from a PointInfo structure.
|
@@ -2275,6 +2324,7 @@ PointInfo_to_Point(PointInfo *p)
|
|
2275
2324
|
, INT2FIX(p->x), INT2FIX(p->y));
|
2276
2325
|
}
|
2277
2326
|
|
2327
|
+
|
2278
2328
|
/*
|
2279
2329
|
Extern: Point_to_PointInfo
|
2280
2330
|
Purpose: Convert a Magick::Point object to a PointInfo structure
|
@@ -2297,7 +2347,6 @@ Point_to_PointInfo(PointInfo *pi, VALUE sp)
|
|
2297
2347
|
}
|
2298
2348
|
|
2299
2349
|
|
2300
|
-
|
2301
2350
|
/*
|
2302
2351
|
Extern: ChromaticityInfo_new(pp)
|
2303
2352
|
Purpose: Create a Magick::ChromaticityInfo object from a
|
@@ -2320,6 +2369,7 @@ ChromaticityInfo_new(ChromaticityInfo *ci)
|
|
2320
2369
|
, red_primary, green_primary, blue_primary, white_point);
|
2321
2370
|
}
|
2322
2371
|
|
2372
|
+
|
2323
2373
|
/*
|
2324
2374
|
Extern: ChromaticityInfo_to_ChromaticityInfo
|
2325
2375
|
Purpose: Extract the elements from a Magick::ChromaticityInfo
|
@@ -2380,6 +2430,7 @@ ChromaticityInfo_to_ChromaticityInfo(ChromaticityInfo *ci, VALUE chrom)
|
|
2380
2430
|
ci->white_point.z = 0.0;
|
2381
2431
|
}
|
2382
2432
|
|
2433
|
+
|
2383
2434
|
/*
|
2384
2435
|
External: Rectangle_from_RectangleInfo
|
2385
2436
|
Purpose: Convert a RectangleInfo structure to a Magick::Rectangle
|
@@ -2399,6 +2450,7 @@ Rectangle_from_RectangleInfo(RectangleInfo *rect)
|
|
2399
2450
|
, width, height, x, y);
|
2400
2451
|
}
|
2401
2452
|
|
2453
|
+
|
2402
2454
|
/*
|
2403
2455
|
External: Rectangle_to_RectangleInfo
|
2404
2456
|
Purpose: Convert a Magick::Rectangle to a RectangleInfo structure.
|
@@ -2424,6 +2476,7 @@ Rectangle_to_RectangleInfo(RectangleInfo *rect, VALUE sr)
|
|
2424
2476
|
rect->y = m == Qnil ? 0 : NUM2LONG (m);
|
2425
2477
|
}
|
2426
2478
|
|
2479
|
+
|
2427
2480
|
/*
|
2428
2481
|
External: Segment_from_SegmentInfo
|
2429
2482
|
Purpose: Convert a SegmentInfo structure to a Magick::Segment
|
@@ -2440,6 +2493,7 @@ Segment_from_SegmentInfo(SegmentInfo *segment)
|
|
2440
2493
|
return rb_funcall(Class_Segment, rm_ID_new, 4, x1, y1, x2, y2);
|
2441
2494
|
}
|
2442
2495
|
|
2496
|
+
|
2443
2497
|
/*
|
2444
2498
|
External: Segment_to_SegmentInfo
|
2445
2499
|
Purpose: Convert a Magick::Segment to a SegmentInfo structure.
|
@@ -2466,6 +2520,7 @@ Segment_to_SegmentInfo(SegmentInfo *segment, VALUE s)
|
|
2466
2520
|
segment->y2 = m == Qnil ? 0.0 : NUM2DBL(m);
|
2467
2521
|
}
|
2468
2522
|
|
2523
|
+
|
2469
2524
|
/*
|
2470
2525
|
Static: StretchType_new
|
2471
2526
|
Purpose: Construct a StretchType enum for a specified StretchType value
|
@@ -2489,6 +2544,7 @@ StyleType_new(StyleType style)
|
|
2489
2544
|
return rm_enum_new(Class_StyleType, ID2SYM(rb_intern(name)), INT2FIX(style));
|
2490
2545
|
}
|
2491
2546
|
|
2547
|
+
|
2492
2548
|
/*
|
2493
2549
|
External: Font_from_TypeInfo
|
2494
2550
|
Purpose: Convert a TypeInfo structure to a Magick::Font
|
@@ -2515,6 +2571,7 @@ Font_from_TypeInfo(const TypeInfo *ti)
|
|
2515
2571
|
, stretch, weight, encoding, foundry, format);
|
2516
2572
|
}
|
2517
2573
|
|
2574
|
+
|
2518
2575
|
/*
|
2519
2576
|
External: Font_to_TypeInfo
|
2520
2577
|
Purpose: Convert a Magick::Font to a TypeInfo structure
|
@@ -2585,6 +2642,7 @@ destroy_TypeInfo(TypeInfo *ti)
|
|
2585
2642
|
ti->format = NULL;
|
2586
2643
|
}
|
2587
2644
|
|
2645
|
+
|
2588
2646
|
/*
|
2589
2647
|
External: Font_to_s
|
2590
2648
|
Purpose: implement the Font#to_s method
|
@@ -2629,6 +2687,7 @@ Font_to_s(VALUE self)
|
|
2629
2687
|
|
2630
2688
|
}
|
2631
2689
|
|
2690
|
+
|
2632
2691
|
/*
|
2633
2692
|
External: TypeMetric_from_TypeMetric
|
2634
2693
|
Purpose: Convert a TypeMetric structure to a Magick::TypeMetric
|
@@ -2657,6 +2716,7 @@ TypeMetric_from_TypeMetric(TypeMetric *tm)
|
|
2657
2716
|
, underline_position, underline_thickness);
|
2658
2717
|
}
|
2659
2718
|
|
2719
|
+
|
2660
2720
|
/*
|
2661
2721
|
External: TypeMetric_to_TypeMetric
|
2662
2722
|
Purpose: Convert a Magick::TypeMetric to a TypeMetric structure.
|
@@ -2697,6 +2757,7 @@ TypeMetric_to_TypeMetric(TypeMetric *tm, VALUE st)
|
|
2697
2757
|
tm->underline_thickness = m == Qnil ? 0.0 : NUM2DBL(m);
|
2698
2758
|
}
|
2699
2759
|
|
2760
|
+
|
2700
2761
|
/*
|
2701
2762
|
Method: Magick::TypeMetric#to_s
|
2702
2763
|
Purpose: Create a string representation of a Magick::TypeMetric
|
@@ -2720,7 +2781,6 @@ TypeMetric_to_s(VALUE self)
|
|
2720
2781
|
}
|
2721
2782
|
|
2722
2783
|
|
2723
|
-
|
2724
2784
|
/*
|
2725
2785
|
Static: VirtualPixelMethod_name
|
2726
2786
|
Purpose: Return the string representation of a VirtualPixelMethod value
|
@@ -2750,6 +2810,12 @@ VirtualPixelMethod_name(VirtualPixelMethod method)
|
|
2750
2810
|
#endif
|
2751
2811
|
#if defined(HAVE_ENUM_WHITEVIRTUALPIXELMETHOD)
|
2752
2812
|
ENUM_TO_NAME(WhiteVirtualPixelMethod)
|
2813
|
+
#endif
|
2814
|
+
#if defined(HAVE_ENUM_HORIZONTALTILEVIRTUALPIXELMETHOD)
|
2815
|
+
ENUM_TO_NAME(HorizontalTileVirtualPixelMethod)
|
2816
|
+
#endif
|
2817
|
+
#if defined(HAVE_ENUM_VERTICALTILEVIRTUALPIXELMETHOD)
|
2818
|
+
ENUM_TO_NAME(VerticalTileVirtualPixelMethod)
|
2753
2819
|
#endif
|
2754
2820
|
}
|
2755
2821
|
|
@@ -2773,7 +2839,8 @@ VirtualPixelMethod_new(VirtualPixelMethod style)
|
|
2773
2839
|
* Extern: rm_define_enum_type
|
2774
2840
|
* Purpose: set up a subclass of Enum
|
2775
2841
|
*/
|
2776
|
-
VALUE
|
2842
|
+
VALUE
|
2843
|
+
rm_define_enum_type(const char *tag)
|
2777
2844
|
{
|
2778
2845
|
VALUE class;
|
2779
2846
|
|
@@ -2790,7 +2857,8 @@ VALUE rm_define_enum_type(const char *tag)
|
|
2790
2857
|
Extern: rm_enum_new (1.8)
|
2791
2858
|
Purpose: Construct a new Enum subclass instance
|
2792
2859
|
*/
|
2793
|
-
VALUE
|
2860
|
+
VALUE
|
2861
|
+
rm_enum_new(VALUE class, VALUE sym, VALUE val)
|
2794
2862
|
{
|
2795
2863
|
VALUE argv[2];
|
2796
2864
|
|
@@ -2799,11 +2867,13 @@ VALUE rm_enum_new(VALUE class, VALUE sym, VALUE val)
|
|
2799
2867
|
return rb_obj_freeze(rb_class_new_instance(2, argv, class));
|
2800
2868
|
}
|
2801
2869
|
|
2870
|
+
|
2802
2871
|
/*
|
2803
2872
|
Extern: Enum_alloc (1.8)
|
2804
2873
|
Purpose: Enum class alloc function
|
2805
2874
|
*/
|
2806
|
-
VALUE
|
2875
|
+
VALUE
|
2876
|
+
Enum_alloc(VALUE class)
|
2807
2877
|
{
|
2808
2878
|
MagickEnum *magick_enum;
|
2809
2879
|
volatile VALUE enumr;
|
@@ -2818,7 +2888,8 @@ VALUE Enum_alloc(VALUE class)
|
|
2818
2888
|
Method: Enum#initialize
|
2819
2889
|
Purpose: Initialize a new Enum instance
|
2820
2890
|
*/
|
2821
|
-
VALUE
|
2891
|
+
VALUE
|
2892
|
+
Enum_initialize(VALUE self, VALUE sym, VALUE val)
|
2822
2893
|
{
|
2823
2894
|
MagickEnum *magick_enum;
|
2824
2895
|
|
@@ -2834,7 +2905,8 @@ VALUE Enum_initialize(VALUE self, VALUE sym, VALUE val)
|
|
2834
2905
|
Method: Enum#to_s
|
2835
2906
|
Purpose: Return the name of an enum
|
2836
2907
|
*/
|
2837
|
-
VALUE
|
2908
|
+
VALUE
|
2909
|
+
Enum_to_s(VALUE self)
|
2838
2910
|
{
|
2839
2911
|
MagickEnum *magick_enum;
|
2840
2912
|
|
@@ -2847,7 +2919,8 @@ VALUE Enum_to_s(VALUE self)
|
|
2847
2919
|
Method: Enum#to_i
|
2848
2920
|
Purpose: Return the value of an enum
|
2849
2921
|
*/
|
2850
|
-
VALUE
|
2922
|
+
VALUE
|
2923
|
+
Enum_to_i(VALUE self)
|
2851
2924
|
{
|
2852
2925
|
MagickEnum *magick_enum;
|
2853
2926
|
|
@@ -2862,7 +2935,8 @@ VALUE Enum_to_i(VALUE self)
|
|
2862
2935
|
Returns: -1, 0, 1, or nil
|
2863
2936
|
Notes: Enums must be instances of the same class to be equal.
|
2864
2937
|
*/
|
2865
|
-
VALUE
|
2938
|
+
VALUE
|
2939
|
+
Enum_spaceship(VALUE self, VALUE other)
|
2866
2940
|
{
|
2867
2941
|
MagickEnum *this, *that;
|
2868
2942
|
|
@@ -2890,7 +2964,8 @@ VALUE Enum_spaceship(VALUE self, VALUE other)
|
|
2890
2964
|
Returns: true or false
|
2891
2965
|
Notes: Yes, I know "case equal" is a misnomer.
|
2892
2966
|
*/
|
2893
|
-
VALUE
|
2967
|
+
VALUE
|
2968
|
+
Enum_case_eq(VALUE self, VALUE other)
|
2894
2969
|
{
|
2895
2970
|
MagickEnum *this, *that;
|
2896
2971
|
|
@@ -2909,7 +2984,8 @@ VALUE Enum_case_eq(VALUE self, VALUE other)
|
|
2909
2984
|
* Method: xxx#initialize
|
2910
2985
|
* Purpose: initialize method for all Enum subclasses
|
2911
2986
|
*/
|
2912
|
-
VALUE
|
2987
|
+
VALUE
|
2988
|
+
Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
|
2913
2989
|
{
|
2914
2990
|
VALUE super_argv[2];
|
2915
2991
|
volatile VALUE enumerators;
|
@@ -2934,7 +3010,8 @@ VALUE Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
|
|
2934
3010
|
* Method: xxx#inspect
|
2935
3011
|
* Purpose: Enum subclass #inspect
|
2936
3012
|
*/
|
2937
|
-
static VALUE
|
3013
|
+
static VALUE
|
3014
|
+
Enum_type_inspect(VALUE self)
|
2938
3015
|
{
|
2939
3016
|
char str[100];
|
2940
3017
|
MagickEnum *magick_enum;
|
@@ -2951,7 +3028,8 @@ static VALUE Enum_type_inspect(VALUE self)
|
|
2951
3028
|
* Purpose: Behaves like #each if a block is present, otherwise like #to_a.
|
2952
3029
|
* Notes: defined for each Enum subclass
|
2953
3030
|
*/
|
2954
|
-
static VALUE
|
3031
|
+
static VALUE
|
3032
|
+
Enum_type_values(VALUE class)
|
2955
3033
|
{
|
2956
3034
|
volatile VALUE enumerators, copy;
|
2957
3035
|
volatile VALUE rv;
|
@@ -3047,6 +3125,7 @@ StorageType_name(StorageType type)
|
|
3047
3125
|
return "UndefinedPixel";
|
3048
3126
|
}
|
3049
3127
|
|
3128
|
+
|
3050
3129
|
/*
|
3051
3130
|
Static: StretchType_name
|
3052
3131
|
Purpose: Return the string representation of a StretchType value
|
@@ -3160,6 +3239,7 @@ rm_write_temp_image(Image *image, char *temp_name)
|
|
3160
3239
|
|
3161
3240
|
}
|
3162
3241
|
|
3242
|
+
|
3163
3243
|
/*
|
3164
3244
|
External: delete_temp_image
|
3165
3245
|
Purpose: Delete the temporary image from the registry
|
@@ -3187,6 +3267,7 @@ rm_delete_temp_image(char *temp_name)
|
|
3187
3267
|
#endif
|
3188
3268
|
}
|
3189
3269
|
|
3270
|
+
|
3190
3271
|
/*
|
3191
3272
|
External: rm_not_implemented
|
3192
3273
|
Purpose: raise NotImplementedError
|
@@ -3201,6 +3282,7 @@ rm_not_implemented(void)
|
|
3201
3282
|
MagickLibVersionText, rb_id2name(THIS_FUNC()));
|
3202
3283
|
}
|
3203
3284
|
|
3285
|
+
|
3204
3286
|
/*
|
3205
3287
|
Static: rm_magick_error(msg, loc)
|
3206
3288
|
Purpose: create a new ImageMagickError object and raise an exception
|
@@ -3259,7 +3341,8 @@ ImageMagickError_initialize(int argc, VALUE *argv, VALUE self)
|
|
3259
3341
|
Function: rm_get_property
|
3260
3342
|
Purpose: Backport GetImageProperty for pre-6.3.1 versions of ImageMagick
|
3261
3343
|
*/
|
3262
|
-
const char *
|
3344
|
+
const char *
|
3345
|
+
rm_get_property(const Image *img, const char *property)
|
3263
3346
|
{
|
3264
3347
|
#if defined(HAVE_GETIMAGEPROPERTY)
|
3265
3348
|
return GetImageProperty(img, property);
|
@@ -3276,7 +3359,8 @@ const char *rm_get_property(const Image *img, const char *property)
|
|
3276
3359
|
Function: rm_set_property
|
3277
3360
|
Purpose: Backport SetImageProperty for pre-6.3.1 versions of ImageMagick
|
3278
3361
|
*/
|
3279
|
-
MagickBooleanType
|
3362
|
+
MagickBooleanType
|
3363
|
+
rm_set_property(Image *image, const char *property, const char *value)
|
3280
3364
|
{
|
3281
3365
|
#if defined(HAVE_SETIMAGEPROPERTY)
|
3282
3366
|
return SetImageProperty(image, property, value);
|
@@ -3286,6 +3370,33 @@ MagickBooleanType rm_set_property(Image *image, const char *property, const char
|
|
3286
3370
|
}
|
3287
3371
|
|
3288
3372
|
|
3373
|
+
/*
|
3374
|
+
Function: rm_get_optional_arguments
|
3375
|
+
Purpose: Collect optional method arguments via Magick::OptionalMethodArguments
|
3376
|
+
Notes: Creates an instance of Magick::OptionalMethodArguments, then yields
|
3377
|
+
to a block in the context of the instance.
|
3378
|
+
*/
|
3379
|
+
void
|
3380
|
+
rm_get_optional_arguments(VALUE img)
|
3381
|
+
{
|
3382
|
+
volatile VALUE OptionalMethodArguments;
|
3383
|
+
volatile VALUE opt_args;
|
3384
|
+
VALUE argv[1];
|
3385
|
+
|
3386
|
+
// opt_args = Magick::OptionalMethodArguments.new(img)
|
3387
|
+
// opt_args.instance_eval { block }
|
3388
|
+
if (rb_block_given_p())
|
3389
|
+
{
|
3390
|
+
OptionalMethodArguments = rb_const_get_from(Module_Magick, rb_intern("OptionalMethodArguments"));
|
3391
|
+
argv[0] = img;
|
3392
|
+
opt_args = rb_class_new_instance(1, argv, OptionalMethodArguments);
|
3393
|
+
(void) rb_obj_instance_eval(0, NULL, opt_args);
|
3394
|
+
}
|
3395
|
+
|
3396
|
+
return;
|
3397
|
+
}
|
3398
|
+
|
3399
|
+
|
3289
3400
|
/*
|
3290
3401
|
Function: rm_exif_by_entry
|
3291
3402
|
Purpose: replicate old (< 6.3.2) EXIF:* functionality using GetImageProperty
|
@@ -3522,7 +3633,8 @@ rm_get_geometry(
|
|
3522
3633
|
* Notes: don't trace creation - the clone may not be used as an Image
|
3523
3634
|
* object. Let the caller do the trace if desired.
|
3524
3635
|
*/
|
3525
|
-
Image *
|
3636
|
+
Image *
|
3637
|
+
rm_clone_image(Image *image)
|
3526
3638
|
{
|
3527
3639
|
Image *clone;
|
3528
3640
|
ExceptionInfo exception;
|
@@ -3545,7 +3657,8 @@ Image *rm_clone_image(Image *image)
|
|
3545
3657
|
Purpose: SetImage(Info)ProgressMonitor exit
|
3546
3658
|
Notes: ImageMagick's "tag" argument is unused. We pass along the method name instead.
|
3547
3659
|
*/
|
3548
|
-
MagickBooleanType
|
3660
|
+
MagickBooleanType
|
3661
|
+
rm_progress_monitor(
|
3549
3662
|
const char *tag,
|
3550
3663
|
const MagickOffsetType of,
|
3551
3664
|
const MagickSizeType sp,
|
@@ -3584,7 +3697,7 @@ rm_split(Image *image)
|
|
3584
3697
|
|
3585
3698
|
if (!image)
|
3586
3699
|
{
|
3587
|
-
rb_bug("RMagick FATAL:
|
3700
|
+
rb_bug("RMagick FATAL: split called with NULL argument.");
|
3588
3701
|
}
|
3589
3702
|
while (image)
|
3590
3703
|
{
|
@@ -3751,7 +3864,8 @@ handle_exception(ExceptionInfo *exception, Image *imglist, ErrorRetention retent
|
|
3751
3864
|
* Extern: rm_ensure_result
|
3752
3865
|
* Purpose: RMagick expected a result. If it got NULL instead raise an exception.
|
3753
3866
|
*/
|
3754
|
-
void
|
3867
|
+
void
|
3868
|
+
rm_ensure_result(Image *image)
|
3755
3869
|
{
|
3756
3870
|
if (!image)
|
3757
3871
|
{
|