rmagick 1.15.11 → 1.15.12
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 +7 -0
- data/README.html +8 -8
- data/README.txt +6 -6
- data/configure +55 -31
- data/configure.ac +28 -15
- data/doc/comtasks.html +2 -2
- data/doc/constants.html +2 -2
- data/doc/draw.html +6 -6
- data/doc/ex/watermark.rb +6 -11
- data/doc/ilist.html +8 -8
- data/doc/image1.html +8 -10
- data/doc/image2.html +11 -11
- data/doc/image3.html +32 -32
- data/doc/imageattrs.html +9 -9
- data/doc/imusage.html +3 -3
- data/doc/index.html +3 -3
- data/doc/info.html +4 -4
- data/doc/magick.html +2 -2
- data/doc/optequiv.html +8 -8
- data/doc/rvg.html +3 -3
- data/doc/rvgclip.html +3 -3
- data/doc/rvggroup.html +3 -3
- data/doc/rvgimage.html +3 -3
- data/doc/rvgpattern.html +4 -4
- 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 +4 -4
- data/doc/usage.html +6 -6
- data/ext/RMagick/MANIFEST +1 -1
- data/ext/RMagick/rmagick.h +6 -1
- data/ext/RMagick/rmagick_config.h.in +4 -0
- data/ext/RMagick/rmimage.c +39 -10
- data/ext/RMagick/rmutil.c +240 -1
- data/rmagick.gemspec +1 -1
- metadata +2 -2
data/doc/rvgtut.html
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
<meta name="generator" content=
|
10
10
|
"HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />
|
11
11
|
|
12
|
-
<title>RMagick 1.15.
|
12
|
+
<title>RMagick 1.15.12: RVG Tutorial</title>
|
13
13
|
<meta name="GENERATOR" content="Quanta Plus" />
|
14
14
|
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
15
15
|
<style type="text/css">
|
@@ -23,7 +23,7 @@
|
|
23
23
|
</head>
|
24
24
|
|
25
25
|
<body>
|
26
|
-
<h6 id="header">RMagick 1.15.
|
26
|
+
<h6 id="header">RMagick 1.15.12 User's Guide and Reference</h6>
|
27
27
|
|
28
28
|
<div class="nav">
|
29
29
|
« <a href="constants.html">Prev</a> | <a href=
|
data/doc/rvguse.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<meta name="generator" content=
|
7
7
|
"HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />
|
8
8
|
|
9
|
-
<title>RMagick 1.15.
|
9
|
+
<title>RMagick 1.15.12: RVG Reference: RVG::Use Class</title>
|
10
10
|
<meta http-equiv="Content-Type" content=
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
@@ -27,7 +27,7 @@
|
|
27
27
|
</head>
|
28
28
|
|
29
29
|
<body>
|
30
|
-
<h6 id="header">RMagick 1.15.
|
30
|
+
<h6 id="header">RMagick 1.15.12 User's Guide and Reference</h6>
|
31
31
|
|
32
32
|
<div class="nav">
|
33
33
|
« <a href="rvgtspan.html">Prev</a> | <a href=
|
data/doc/rvgxform.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<meta name="generator" content=
|
7
7
|
"HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org" />
|
8
8
|
|
9
|
-
<title>RMagick 1.15.
|
9
|
+
<title>RMagick 1.15.12: RVG Reference: Transforms</title>
|
10
10
|
<meta http-equiv="Content-Type" content=
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
@@ -28,7 +28,7 @@
|
|
28
28
|
</head>
|
29
29
|
|
30
30
|
<body>
|
31
|
-
<h6 id="header">RMagick 1.15.
|
31
|
+
<h6 id="header">RMagick 1.15.12 User's Guide and Reference</h6>
|
32
32
|
|
33
33
|
<div class="nav">
|
34
34
|
« <a href="rvgshape.html">Prev</a> | <a href=
|
data/doc/struct.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<meta name="generator" content=
|
7
7
|
"HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />
|
8
8
|
|
9
|
-
<title>RMagick 1.15.
|
9
|
+
<title>RMagick 1.15.12: Miscellaneous classes</title>
|
10
10
|
<meta http-equiv="Content-Type" content=
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
@@ -27,7 +27,7 @@
|
|
27
27
|
</head>
|
28
28
|
|
29
29
|
<body>
|
30
|
-
<h6 id="header">RMagick 1.15.
|
30
|
+
<h6 id="header">RMagick 1.15.12 User's Guide and Reference</h6>
|
31
31
|
|
32
32
|
<div class="nav">
|
33
33
|
« <a href="draw.html">Prev</a> | <a href=
|
@@ -766,7 +766,7 @@ g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
|
|
766
766
|
</div>
|
767
767
|
|
768
768
|
<div class="sig">
|
769
|
-
<h4>to_color</h4>
|
769
|
+
<h4 id="Pixel_to_color">to_color</h4>
|
770
770
|
|
771
771
|
<p><span class="arg">pixel</span>.to_color(<span class=
|
772
772
|
"arg">compliance</span>=AllCompliance, <span class=
|
@@ -1081,7 +1081,7 @@ g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
|
|
1081
1081
|
<div class="intro">
|
1082
1082
|
<h3>Introduction</h3>
|
1083
1083
|
|
1084
|
-
<p>The <a href="
|
1084
|
+
<p>The <a href="image1.html#new">Image#new</a> and <a href=
|
1085
1085
|
"ilist.html#new_image">ImageList#new_image</a> methods accept
|
1086
1086
|
a <code>Fill</code> object as an optional third argument. A
|
1087
1087
|
<code>Fill</code> object is an instance of a <em>Fill
|
data/doc/usage.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<meta name="generator" content=
|
7
7
|
"HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org" />
|
8
8
|
|
9
|
-
<title>RMagick 1.15.
|
9
|
+
<title>RMagick 1.15.12: How to use RMagick</title>
|
10
10
|
<meta http-equiv="Content-Type" content=
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
@@ -90,7 +90,7 @@
|
|
90
90
|
</head>
|
91
91
|
|
92
92
|
<body>
|
93
|
-
<h6 id="header">RMagick 1.15.
|
93
|
+
<h6 id="header">RMagick 1.15.12 User's Guide and Reference</h6>
|
94
94
|
|
95
95
|
<div class="nav">
|
96
96
|
« <a href="index.html">Prev</a> | <a href=
|
@@ -687,7 +687,7 @@ exit
|
|
687
687
|
|
688
688
|
<dd>Get or set a color in the image's colormap</dd>
|
689
689
|
|
690
|
-
<dt><a href="image1.
|
690
|
+
<dt><a href="image1.html#color_point">color_point</a></dt>
|
691
691
|
|
692
692
|
<dd>Change the color of a single pixel in the image</dd>
|
693
693
|
|
@@ -701,7 +701,7 @@ exit
|
|
701
701
|
|
702
702
|
<dd>Displace the image's colormap</dd>
|
703
703
|
|
704
|
-
<dt><a href="
|
704
|
+
<dt><a href="image2.html#erase_bang">erase!</a></dt>
|
705
705
|
|
706
706
|
<dd>Set the entire image to a single color</dd>
|
707
707
|
|
@@ -1016,7 +1016,7 @@ exit
|
|
1016
1016
|
"image1.html#blur_channel">blur_channel</a>, <a href=
|
1017
1017
|
"image2.html#gaussian_blur">gaussian_blur</a>, <a href=
|
1018
1018
|
"image2.html#gaussian_blur_channel">gaussian_blur_channel</a>,
|
1019
|
-
<a href="
|
1019
|
+
<a href="image2.html#motion_blur">motion_blur</a>, <a href=
|
1020
1020
|
"image3.html#radial_blur">radial_blur</a>, <a href=
|
1021
1021
|
"image3.html#radial_blur_channel">radial_blur_channel</a></dt>
|
1022
1022
|
|
@@ -1353,7 +1353,7 @@ exit
|
|
1353
1353
|
<p>Most of the time, you'll want to specify text properties such
|
1354
1354
|
as the font, its size, font styles such as italic, font weights
|
1355
1355
|
such as bold, the fill and stroke color, etc. The Draw class
|
1356
|
-
defines <a href="draw.html#
|
1356
|
+
defines <a href="draw.html#attributes">attribute
|
1357
1357
|
writers</a> for this purpose. You can set the desired text
|
1358
1358
|
properties by calling the attribute writers before calling
|
1359
1359
|
<code>annotate</code>, or you can call them in an image block
|
data/ext/RMagick/MANIFEST
CHANGED
data/ext/RMagick/rmagick.h
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: rmagick.h,v 1.152.2.4 2007/
|
1
|
+
/* $Id: rmagick.h,v 1.152.2.4.2.1 2007/12/15 23:32:20 rmagick Exp $ */
|
2
2
|
/*=============================================================================
|
3
3
|
| Copyright (C) 2006 by Timothy P. Hunter
|
4
4
|
| Name: rmagick.h
|
@@ -1124,6 +1124,7 @@ extern char *rm_string_value_ptr(volatile VALUE *);
|
|
1124
1124
|
#endif
|
1125
1125
|
extern char *rm_string_value_ptr_len(volatile VALUE *, long *);
|
1126
1126
|
extern int rm_strcasecmp(const char *, const char *);
|
1127
|
+
extern int rm_strncasecmp(const char *, const char *, size_t);
|
1127
1128
|
extern void rm_check_ary_len(VALUE, long);
|
1128
1129
|
extern void rm_check_frozen(VALUE);
|
1129
1130
|
extern int rm_check_num2dbl(VALUE);
|
@@ -1136,6 +1137,8 @@ extern void rm_delete_temp_image(char *);
|
|
1136
1137
|
extern void rm_not_implemented(void);
|
1137
1138
|
extern void rm_attr_write(VALUE, VALUE);
|
1138
1139
|
extern void rm_get_geometry(VALUE, long *, long *, unsigned long *, unsigned long *, int *);
|
1140
|
+
extern const char *rm_get_property(const Image *, const char *);
|
1141
|
+
extern unsigned int rm_set_property(Image *, const char *, const char *);
|
1139
1142
|
extern void rm_split(Image *);
|
1140
1143
|
extern void rm_magick_error(const char *, const char *);
|
1141
1144
|
|
@@ -1152,6 +1155,8 @@ extern Image *rm_clone_image(Image *);
|
|
1152
1155
|
#if defined(HAVE_SETIMAGEPROGRESSMONITOR)
|
1153
1156
|
extern MagickBooleanType rm_progress_monitor(const char *, const MagickOffsetType, const MagickSizeType, void *);
|
1154
1157
|
#endif
|
1158
|
+
extern VALUE rm_exif_by_entry(Image *);
|
1159
|
+
extern VALUE rm_exif_by_number(Image *);
|
1155
1160
|
|
1156
1161
|
#endif
|
1157
1162
|
|
@@ -109,6 +109,8 @@
|
|
109
109
|
#undef HAVE_GETNEXTIMAGEATTRIBUTE
|
110
110
|
/* Introduced in IM 6.0.0 */
|
111
111
|
#undef HAVE_GETNEXTIMAGEPROFILE
|
112
|
+
/* Introduced in IM 6.3.2 */
|
113
|
+
#undef HAVE_GETIMAGEPROPERTY
|
112
114
|
/* Introduced in IM 6.0.1 */
|
113
115
|
#undef HAVE_GETTYPEINFOLIST
|
114
116
|
/* API changed in IM 6.1.3 */
|
@@ -223,6 +225,8 @@
|
|
223
225
|
#undef HAVE_SETIMAGEREGISTRY
|
224
226
|
/* Introduced in IM 6.1.0 */
|
225
227
|
#undef HAVE_SETIMAGEPROGRESSMONITOR
|
228
|
+
/* Introduced in IM 6.3.2 */
|
229
|
+
#undef HAVE_SETIMAGEPROPERTY
|
226
230
|
/* Introduced in IM 6.2.6 */
|
227
231
|
#undef HAVE_SETIMAGESTORAGECLASS
|
228
232
|
/* Introduced in IM 6.1.7 */
|
data/ext/RMagick/rmimage.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: rmimage.c,v 1.192.2.5.2.
|
1
|
+
/* $Id: rmimage.c,v 1.192.2.5.2.4 2007/12/21 15:17:58 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
3
|
| Copyright (C) 2007 by Timothy P. Hunter
|
4
4
|
| Name: rmimage.c
|
@@ -551,7 +551,7 @@ Image_aref(VALUE self, VALUE key_arg)
|
|
551
551
|
{
|
552
552
|
Image *image;
|
553
553
|
char *key;
|
554
|
-
const
|
554
|
+
const char *attr;
|
555
555
|
|
556
556
|
switch (TYPE(key_arg))
|
557
557
|
{
|
@@ -572,8 +572,18 @@ Image_aref(VALUE self, VALUE key_arg)
|
|
572
572
|
}
|
573
573
|
|
574
574
|
Data_Get_Struct(self, Image, image);
|
575
|
-
|
576
|
-
|
575
|
+
|
576
|
+
if (rm_strcasecmp(key, "EXIF:*") == 0)
|
577
|
+
{
|
578
|
+
return rm_exif_by_entry(image);
|
579
|
+
}
|
580
|
+
else if (rm_strcasecmp(key, "EXIF:!") == 0)
|
581
|
+
{
|
582
|
+
return rm_exif_by_number(image);
|
583
|
+
}
|
584
|
+
|
585
|
+
attr = rm_get_property(image, key);
|
586
|
+
return attr ? rb_str_new2(attr) : Qnil;
|
577
587
|
}
|
578
588
|
|
579
589
|
/*
|
@@ -597,7 +607,6 @@ Image_aset(VALUE self, VALUE key_arg, VALUE attr_arg)
|
|
597
607
|
{
|
598
608
|
Image *image;
|
599
609
|
char *key, *attr;
|
600
|
-
const ImageAttribute *attribute;
|
601
610
|
unsigned int okay;
|
602
611
|
|
603
612
|
rm_check_frozen(self);
|
@@ -630,22 +639,24 @@ Image_aset(VALUE self, VALUE key_arg, VALUE attr_arg)
|
|
630
639
|
// the "next" pointer to point to the attribute following
|
631
640
|
// this one. (No, this isn't thread-safe!)
|
632
641
|
|
642
|
+
#if !defined(HAVE_GETIMAGEPROPERTY) && !defined(HAVE_GETNEXTIMAGEATTRIBUTE)
|
633
643
|
if (Next_Attribute)
|
634
644
|
{
|
635
|
-
attribute = GetImageAttribute(image, key);
|
645
|
+
const ImageAttribute *attribute = GetImageAttribute(image, key);
|
636
646
|
if (attribute && attribute == Next_Attribute)
|
637
647
|
{
|
638
648
|
Next_Attribute = attribute->next;
|
639
649
|
}
|
640
650
|
}
|
651
|
+
#endif
|
641
652
|
|
642
653
|
// Delete existing value. SetImageAttribute returns False if
|
643
654
|
// the attribute doesn't exist - we don't care.
|
644
|
-
(void)
|
655
|
+
(void) rm_set_property(image, key, NULL);
|
645
656
|
// Set new value
|
646
657
|
if (attr)
|
647
658
|
{
|
648
|
-
okay =
|
659
|
+
okay = rm_set_property(image, key, attr);
|
649
660
|
if (!okay)
|
650
661
|
{
|
651
662
|
rb_warning("SetImageAttribute failed (probably out of memory)");
|
@@ -9270,6 +9281,7 @@ Image_class_type_eq(VALUE self, VALUE new_class_type)
|
|
9270
9281
|
#if defined(HAVE_SETIMAGESTORAGECLASS)
|
9271
9282
|
(void) SetImageStorageClass(image, class_type);
|
9272
9283
|
#else
|
9284
|
+
(void) SyncImage(image);
|
9273
9285
|
image->storage_class = class_type;
|
9274
9286
|
#endif
|
9275
9287
|
return self;
|
@@ -9315,11 +9327,27 @@ Image_store_pixels(
|
|
9315
9327
|
size = (long)(cols * rows);
|
9316
9328
|
rm_check_ary_len(new_pixels, size);
|
9317
9329
|
|
9318
|
-
|
9330
|
+
#if defined(HAVE_SETIMAGESTORAGECLASS)
|
9331
|
+
okay = SetImageStorageClass(image,DirectClass);
|
9332
|
+
rm_check_image_exception(image, RetainOnError);
|
9333
|
+
if (!okay)
|
9334
|
+
{
|
9335
|
+
rb_raise(Class_ImageMagickError, "Can't store pixels. Can't change image storage class.");
|
9336
|
+
}
|
9337
|
+
#else
|
9338
|
+
if (image->storage_class == PseudoClass)
|
9339
|
+
{
|
9340
|
+
SyncImage(image);
|
9341
|
+
rm_check_image_exception(image, RetainOnError);
|
9342
|
+
image->storage_class = DirectClass;
|
9343
|
+
}
|
9344
|
+
#endif
|
9319
9345
|
|
9320
9346
|
// Get a pointer to the pixels. Replace the values with the PixelPackets
|
9321
9347
|
// from the pixels argument.
|
9322
9348
|
pixels = GetImagePixels(image, x, y, cols, rows);
|
9349
|
+
rm_check_image_exception(image, RetainOnError);
|
9350
|
+
|
9323
9351
|
if (pixels)
|
9324
9352
|
{
|
9325
9353
|
for (n = 0; n < size; n++)
|
@@ -9330,9 +9358,10 @@ Image_store_pixels(
|
|
9330
9358
|
}
|
9331
9359
|
|
9332
9360
|
okay = SyncImagePixels(image);
|
9361
|
+
rm_check_image_exception(image, RetainOnError);
|
9333
9362
|
if (!okay)
|
9334
9363
|
{
|
9335
|
-
rb_raise(Class_ImageMagickError, "
|
9364
|
+
rb_raise(Class_ImageMagickError, "Can't store pixels. Can't sync image pixels.");
|
9336
9365
|
}
|
9337
9366
|
}
|
9338
9367
|
|
data/ext/RMagick/rmutil.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: rmutil.c,v 1.90.2.3.2.
|
1
|
+
/* $Id: rmutil.c,v 1.90.2.3.2.4 2007/12/15 23:31:26 rmagick Exp $ */
|
2
2
|
/*============================================================================\
|
3
3
|
| Copyright (C) 2007 by Timothy P. Hunter
|
4
4
|
| Name: rmutil.c
|
@@ -182,6 +182,33 @@ rm_strcasecmp(const char *s1, const char *s2)
|
|
182
182
|
}
|
183
183
|
|
184
184
|
|
185
|
+
/*
|
186
|
+
* Extern: rm_strncasecmp(s1, s2, n)
|
187
|
+
* Purpose: compare s1 and s2 ignoring case
|
188
|
+
* Returns: same as strcmp(3)
|
189
|
+
*/
|
190
|
+
int
|
191
|
+
rm_strncasecmp(const char *s1, const char *s2, size_t n)
|
192
|
+
{
|
193
|
+
if (n == 0)
|
194
|
+
{
|
195
|
+
return 0;
|
196
|
+
}
|
197
|
+
while (toupper(*s1) == toupper(*s2))
|
198
|
+
{
|
199
|
+
if (--n == 0 || *s1 == '\0')
|
200
|
+
{
|
201
|
+
return 0;
|
202
|
+
}
|
203
|
+
s1 += 1;
|
204
|
+
s2 += 1;
|
205
|
+
}
|
206
|
+
return (int)(*s1 - *s2);
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
185
212
|
|
186
213
|
/*
|
187
214
|
* Extern: rm_check_ary_len(ary, len)
|
@@ -3093,6 +3120,218 @@ ImageMagickError_initialize(int argc, VALUE *argv, VALUE self)
|
|
3093
3120
|
return self;
|
3094
3121
|
}
|
3095
3122
|
|
3123
|
+
|
3124
|
+
/*
|
3125
|
+
Function: rm_get_property
|
3126
|
+
Purpose: Backport GetImageProperty for pre-6.3.1 versions of ImageMagick
|
3127
|
+
*/
|
3128
|
+
const char *rm_get_property(const Image *img, const char *property)
|
3129
|
+
{
|
3130
|
+
#if defined(HAVE_GETIMAGEPROPERTY)
|
3131
|
+
return GetImageProperty(img, property);
|
3132
|
+
#else
|
3133
|
+
const ImageAttribute *attr;
|
3134
|
+
|
3135
|
+
attr = GetImageAttribute(img, property);
|
3136
|
+
return attr ? (const char *)attr->value : NULL;
|
3137
|
+
#endif
|
3138
|
+
}
|
3139
|
+
|
3140
|
+
|
3141
|
+
/*
|
3142
|
+
Function: rm_set_property
|
3143
|
+
Purpose: Backport SetImageProperty for pre-6.3.1 versions of ImageMagick
|
3144
|
+
*/
|
3145
|
+
unsigned int rm_set_property(Image *image, const char *property, const char *value)
|
3146
|
+
{
|
3147
|
+
#if defined(HAVE_SETIMAGEPROPERTY)
|
3148
|
+
return (unsigned int) SetImageProperty(image, property, value);
|
3149
|
+
#else
|
3150
|
+
return SetImageAttribute(image, property, value);
|
3151
|
+
#endif
|
3152
|
+
}
|
3153
|
+
|
3154
|
+
|
3155
|
+
/*
|
3156
|
+
Function: rm_exif_by_entry
|
3157
|
+
Purpose: replicate old (< 6.3.2) EXIF:* functionality using GetImageProperty
|
3158
|
+
by returning the exif entries as a single string, separated by \n's.
|
3159
|
+
Do this so that RMagick.rb works no matter which version of
|
3160
|
+
ImageMagick is in use.
|
3161
|
+
Notes: see magick/identify.c
|
3162
|
+
*/
|
3163
|
+
VALUE
|
3164
|
+
rm_exif_by_entry(Image *image)
|
3165
|
+
{
|
3166
|
+
#if defined(HAVE_GETIMAGEPROPERTY)
|
3167
|
+
const char *property, *value;
|
3168
|
+
char *str;
|
3169
|
+
size_t len = 0, property_l, value_l;
|
3170
|
+
volatile VALUE v;
|
3171
|
+
|
3172
|
+
(void) GetImageProperty(image, "exif:*");
|
3173
|
+
ResetImagePropertyIterator(image);
|
3174
|
+
property = GetNextImageProperty(image);
|
3175
|
+
|
3176
|
+
// Measure the exif properties and values
|
3177
|
+
while (property)
|
3178
|
+
{
|
3179
|
+
// ignore properties that don't start with "exif:"
|
3180
|
+
property_l = strlen(property);
|
3181
|
+
if (property_l > 5 && rm_strncasecmp(property, "exif:", 5) == 0)
|
3182
|
+
{
|
3183
|
+
if (len > 0)
|
3184
|
+
{
|
3185
|
+
len += 1; // there will be a \n between property=value entries
|
3186
|
+
}
|
3187
|
+
len += property_l - 5;
|
3188
|
+
value = GetImageProperty(image,property);
|
3189
|
+
if (value)
|
3190
|
+
{
|
3191
|
+
// add 1 for the = between property and value
|
3192
|
+
len += 1 + strlen(value);
|
3193
|
+
}
|
3194
|
+
}
|
3195
|
+
property = GetNextImageProperty(image);
|
3196
|
+
}
|
3197
|
+
|
3198
|
+
if (len == 0)
|
3199
|
+
{
|
3200
|
+
return Qnil;
|
3201
|
+
}
|
3202
|
+
str = xmalloc(len);
|
3203
|
+
len = 0;
|
3204
|
+
|
3205
|
+
// Copy the exif properties and values into the string.
|
3206
|
+
ResetImagePropertyIterator(image);
|
3207
|
+
property = GetNextImageProperty(image);
|
3208
|
+
|
3209
|
+
while (property)
|
3210
|
+
{
|
3211
|
+
property_l = strlen(property);
|
3212
|
+
if (property_l > 5 && rm_strncasecmp(property, "exif:", 5) == 0)
|
3213
|
+
{
|
3214
|
+
if (len > 0)
|
3215
|
+
{
|
3216
|
+
str[len++] = '\n';
|
3217
|
+
}
|
3218
|
+
memcpy(str+len, property+5, property_l-5);
|
3219
|
+
len += property_l - 5;
|
3220
|
+
value = GetImageProperty(image,property);
|
3221
|
+
if (value)
|
3222
|
+
{
|
3223
|
+
value_l = strlen(value);
|
3224
|
+
str[len++] = '=';
|
3225
|
+
memcpy(str+len, value, value_l);
|
3226
|
+
len += value_l;
|
3227
|
+
}
|
3228
|
+
}
|
3229
|
+
property = GetNextImageProperty(image);
|
3230
|
+
}
|
3231
|
+
|
3232
|
+
v = rb_str_new(str, len);
|
3233
|
+
xfree(str);
|
3234
|
+
return v;
|
3235
|
+
|
3236
|
+
#else
|
3237
|
+
|
3238
|
+
const ImageAttribute *attr = GetImageAttribute(image, "EXIF:*");
|
3239
|
+
return attr ? rb_str_new2(attr->value) : Qnil;
|
3240
|
+
|
3241
|
+
#endif
|
3242
|
+
}
|
3243
|
+
|
3244
|
+
|
3245
|
+
/*
|
3246
|
+
Function: rm_exif_by_number
|
3247
|
+
Purpose: replicate old (< 6.3.2) EXIF:! functionality using GetImageProperty
|
3248
|
+
by returning the exif entries as a single string, separated by \n's.
|
3249
|
+
Do this so that RMagick.rb works no matter which version of
|
3250
|
+
ImageMagick is in use.
|
3251
|
+
Notes: see magick/identify.c
|
3252
|
+
*/
|
3253
|
+
VALUE
|
3254
|
+
rm_exif_by_number(Image *image)
|
3255
|
+
{
|
3256
|
+
#if defined(HAVE_GETIMAGEPROPERTY)
|
3257
|
+
const char *property, *value;
|
3258
|
+
char *str;
|
3259
|
+
size_t len = 0, property_l, value_l;
|
3260
|
+
volatile VALUE v;
|
3261
|
+
|
3262
|
+
(void) GetImageProperty(image, "exif:!");
|
3263
|
+
ResetImagePropertyIterator(image);
|
3264
|
+
property = GetNextImageProperty(image);
|
3265
|
+
|
3266
|
+
// Measure the exif properties and values
|
3267
|
+
while (property)
|
3268
|
+
{
|
3269
|
+
// ignore properties that don't start with "#"
|
3270
|
+
property_l = strlen(property);
|
3271
|
+
if (property_l > 1 && property[0] == '#')
|
3272
|
+
{
|
3273
|
+
if (len > 0)
|
3274
|
+
{
|
3275
|
+
len += 1; // there will be a \n between property=value entries
|
3276
|
+
}
|
3277
|
+
len += property_l;
|
3278
|
+
value = GetImageProperty(image,property);
|
3279
|
+
if (value)
|
3280
|
+
{
|
3281
|
+
// add 1 for the = between property and value
|
3282
|
+
len += 1 + strlen(value);
|
3283
|
+
}
|
3284
|
+
}
|
3285
|
+
property = GetNextImageProperty(image);
|
3286
|
+
}
|
3287
|
+
|
3288
|
+
if (len == 0)
|
3289
|
+
{
|
3290
|
+
return Qnil;
|
3291
|
+
}
|
3292
|
+
str = xmalloc(len);
|
3293
|
+
len = 0;
|
3294
|
+
|
3295
|
+
// Copy the exif properties and values into the string.
|
3296
|
+
ResetImagePropertyIterator(image);
|
3297
|
+
property = GetNextImageProperty(image);
|
3298
|
+
|
3299
|
+
while (property)
|
3300
|
+
{
|
3301
|
+
property_l = strlen(property);
|
3302
|
+
if (property_l > 1 && property[0] == '#')
|
3303
|
+
{
|
3304
|
+
if (len > 0)
|
3305
|
+
{
|
3306
|
+
str[len++] = '\n';
|
3307
|
+
}
|
3308
|
+
memcpy(str+len, property, property_l);
|
3309
|
+
len += property_l;
|
3310
|
+
value = GetImageProperty(image,property);
|
3311
|
+
if (value)
|
3312
|
+
{
|
3313
|
+
value_l = strlen(value);
|
3314
|
+
str[len++] = '=';
|
3315
|
+
memcpy(str+len, value, value_l);
|
3316
|
+
len += value_l;
|
3317
|
+
}
|
3318
|
+
}
|
3319
|
+
property = GetNextImageProperty(image);
|
3320
|
+
}
|
3321
|
+
|
3322
|
+
v = rb_str_new(str, len);
|
3323
|
+
xfree(str);
|
3324
|
+
return v;
|
3325
|
+
|
3326
|
+
#else
|
3327
|
+
|
3328
|
+
const ImageAttribute *attr = GetImageAttribute(image, "EXIF:!");
|
3329
|
+
return attr ? rb_str_new2(attr->value) : Qnil;
|
3330
|
+
|
3331
|
+
#endif
|
3332
|
+
}
|
3333
|
+
|
3334
|
+
|
3096
3335
|
/*
|
3097
3336
|
* Extern: get_geometry
|
3098
3337
|
* Purpose: Get the values from a Geometry object and return
|