rmagick 2.13.1 → 2.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.travis.yml +57 -0
  4. data/CONTRIBUTING.md +22 -0
  5. data/ChangeLog +49 -2
  6. data/Gemfile +7 -0
  7. data/LICENSE +20 -0
  8. data/README.textile +161 -0
  9. data/Rakefile +176 -0
  10. data/before_install_linux.sh +12 -0
  11. data/before_install_osx.sh +2 -0
  12. data/doc/.cvsignore +1 -0
  13. data/doc/comtasks.html +2 -2
  14. data/doc/constants.html +2 -2
  15. data/doc/draw.html +2 -2
  16. data/doc/ex/PreserveAspectRatio.rb +0 -0
  17. data/doc/ex/ViewBox.rb +0 -0
  18. data/doc/ex/adaptive_threshold.rb +0 -0
  19. data/doc/ex/add_noise.rb +0 -0
  20. data/doc/ex/affine.rb +0 -0
  21. data/doc/ex/affine_transform.rb +0 -0
  22. data/doc/ex/arc.rb +0 -0
  23. data/doc/ex/arcpath.rb +0 -0
  24. data/doc/ex/average.rb +0 -0
  25. data/doc/ex/axes.rb +0 -0
  26. data/doc/ex/bilevel_channel.rb +0 -0
  27. data/doc/ex/blur_image.rb +0 -0
  28. data/doc/ex/border.rb +0 -0
  29. data/doc/ex/bounding_box.rb +0 -0
  30. data/doc/ex/cbezier1.rb +0 -0
  31. data/doc/ex/cbezier2.rb +0 -0
  32. data/doc/ex/cbezier3.rb +0 -0
  33. data/doc/ex/cbezier4.rb +0 -0
  34. data/doc/ex/cbezier5.rb +0 -0
  35. data/doc/ex/cbezier6.rb +0 -0
  36. data/doc/ex/channel.rb +0 -0
  37. data/doc/ex/charcoal.rb +0 -0
  38. data/doc/ex/chop.rb +0 -0
  39. data/doc/ex/circle.rb +0 -0
  40. data/doc/ex/clip_path.rb +0 -0
  41. data/doc/ex/coalesce.rb +0 -0
  42. data/doc/ex/color_fill_to_border.rb +0 -0
  43. data/doc/ex/color_floodfill.rb +0 -0
  44. data/doc/ex/color_histogram.rb +0 -0
  45. data/doc/ex/color_reset.rb +0 -0
  46. data/doc/ex/colorize.rb +0 -0
  47. data/doc/ex/colors.rb +0 -0
  48. data/doc/ex/composite.rb +0 -0
  49. data/doc/ex/composite_layers.rb +0 -0
  50. data/doc/ex/contrast.rb +0 -0
  51. data/doc/ex/crop.rb +0 -0
  52. data/doc/ex/cycle_colormap.rb +0 -0
  53. data/doc/ex/drawcomp.rb +0 -0
  54. data/doc/ex/drop_shadow.rb +0 -0
  55. data/doc/ex/edge.rb +0 -0
  56. data/doc/ex/ellipse.rb +0 -0
  57. data/doc/ex/emboss.rb +0 -0
  58. data/doc/ex/enhance.rb +0 -0
  59. data/doc/ex/equalize.rb +0 -0
  60. data/doc/ex/evenodd.rb +0 -0
  61. data/doc/ex/flatten_images.rb +0 -0
  62. data/doc/ex/flip.rb +0 -0
  63. data/doc/ex/flop.rb +0 -0
  64. data/doc/ex/fonts.rb +0 -0
  65. data/doc/ex/frame.rb +0 -0
  66. data/doc/ex/gaussian_blur.rb +0 -0
  67. data/doc/ex/get_pixels.rb +0 -0
  68. data/doc/ex/gradientfill.rb +0 -0
  69. data/doc/ex/grav.rb +0 -0
  70. data/doc/ex/gravity.rb +0 -0
  71. data/doc/ex/hatchfill.rb +0 -0
  72. data/doc/ex/images/image_with_profile.jpg +0 -0
  73. data/doc/ex/images/logo400x83.gif +0 -0
  74. data/doc/ex/implode.rb +0 -0
  75. data/doc/ex/level.rb +0 -0
  76. data/doc/ex/line.rb +0 -0
  77. data/doc/ex/mask.rb +1 -1
  78. data/doc/ex/matte_fill_to_border.rb +0 -0
  79. data/doc/ex/matte_floodfill.rb +0 -0
  80. data/doc/ex/matte_replace.rb +0 -0
  81. data/doc/ex/median_filter.rb +0 -0
  82. data/doc/ex/modulate.rb +0 -0
  83. data/doc/ex/mono.rb +0 -0
  84. data/doc/ex/morph.rb +0 -0
  85. data/doc/ex/mosaic.rb +0 -0
  86. data/doc/ex/motion_blur.rb +0 -0
  87. data/doc/ex/negate.rb +0 -0
  88. data/doc/ex/nested_rvg.rb +0 -0
  89. data/doc/ex/nonzero.rb +0 -0
  90. data/doc/ex/normalize.rb +0 -0
  91. data/doc/ex/oil_paint.rb +0 -0
  92. data/doc/ex/opacity.rb +0 -0
  93. data/doc/ex/ordered_dither.rb +0 -0
  94. data/doc/ex/path.rb +0 -0
  95. data/doc/ex/pattern1.rb +0 -0
  96. data/doc/ex/pattern2.rb +0 -0
  97. data/doc/ex/polygon.rb +0 -0
  98. data/doc/ex/polyline.rb +0 -0
  99. data/doc/ex/preview.rb +0 -0
  100. data/doc/ex/qbezierpath.rb +0 -0
  101. data/doc/ex/quantize-m.rb +0 -0
  102. data/doc/ex/radial_blur.rb +0 -0
  103. data/doc/ex/raise.rb +0 -0
  104. data/doc/ex/rectangle.rb +0 -0
  105. data/doc/ex/reduce_noise.rb +0 -0
  106. data/doc/ex/roll.rb +0 -0
  107. data/doc/ex/rotate.rb +0 -0
  108. data/doc/ex/rotate_f.rb +0 -0
  109. data/doc/ex/roundrect.rb +0 -0
  110. data/doc/ex/rubyname.rb +0 -0
  111. data/doc/ex/rvg_linecap.rb +0 -0
  112. data/doc/ex/rvg_linejoin.rb +0 -0
  113. data/doc/ex/rvg_opacity.rb +0 -0
  114. data/doc/ex/rvg_stroke_dasharray.rb +0 -0
  115. data/doc/ex/segment.rb +0 -0
  116. data/doc/ex/shade.rb +0 -0
  117. data/doc/ex/shave.rb +0 -0
  118. data/doc/ex/shear.rb +0 -0
  119. data/doc/ex/sketch.rb +0 -0
  120. data/doc/ex/skewx.rb +0 -0
  121. data/doc/ex/skewy.rb +0 -0
  122. data/doc/ex/smile.rb +0 -0
  123. data/doc/ex/solarize.rb +0 -0
  124. data/doc/ex/spread.rb +0 -0
  125. data/doc/ex/stegano.rb +0 -0
  126. data/doc/ex/stroke_dasharray.rb +0 -0
  127. data/doc/ex/stroke_fill.rb +0 -0
  128. data/doc/ex/stroke_linecap.rb +0 -0
  129. data/doc/ex/stroke_linejoin.rb +0 -0
  130. data/doc/ex/stroke_width.rb +0 -0
  131. data/doc/ex/swirl.rb +0 -0
  132. data/doc/ex/text.rb +0 -0
  133. data/doc/ex/text_align.rb +0 -0
  134. data/doc/ex/text_antialias.rb +0 -0
  135. data/doc/ex/text_undercolor.rb +0 -0
  136. data/doc/ex/texture_fill_to_border.rb +0 -0
  137. data/doc/ex/texture_floodfill.rb +0 -0
  138. data/doc/ex/texturefill.rb +0 -0
  139. data/doc/ex/threshold.rb +0 -0
  140. data/doc/ex/to_blob.rb +0 -0
  141. data/doc/ex/translate.rb +0 -0
  142. data/doc/ex/transparent.rb +0 -0
  143. data/doc/ex/unsharp_mask.rb +0 -0
  144. data/doc/ex/wave.rb +0 -0
  145. data/doc/ilist.html +2 -2
  146. data/doc/image1.html +2 -2
  147. data/doc/image2.html +2 -2
  148. data/doc/image3.html +2 -2
  149. data/doc/imageattrs.html +2 -2
  150. data/doc/imusage.html +2 -2
  151. data/doc/index.html +3 -3
  152. data/doc/info.html +2 -2
  153. data/doc/magick.html +2 -2
  154. data/doc/optequiv.html +2 -2
  155. data/doc/rvg.html +2 -2
  156. data/doc/rvgclip.html +2 -2
  157. data/doc/rvggroup.html +2 -2
  158. data/doc/rvgimage.html +2 -2
  159. data/doc/rvgpattern.html +2 -2
  160. data/doc/rvgshape.html +2 -2
  161. data/doc/rvgstyle.html +2 -2
  162. data/doc/rvgtext.html +2 -2
  163. data/doc/rvgtspan.html +2 -2
  164. data/doc/rvgtut.html +2 -2
  165. data/doc/rvguse.html +2 -2
  166. data/doc/rvgxform.html +2 -2
  167. data/doc/struct.html +2 -2
  168. data/doc/usage.html +2 -2
  169. data/examples/crop_with_gravity.rb +0 -0
  170. data/examples/demo.rb +0 -0
  171. data/examples/describe.rb +0 -0
  172. data/examples/identify.rb +1 -1
  173. data/examples/rotating_text.rb +0 -0
  174. data/ext/RMagick/extconf.rb +62 -31
  175. data/ext/RMagick/rmagick.c +15 -15
  176. data/ext/RMagick/rmagick.h +9 -7
  177. data/ext/RMagick/rmdraw.c +12 -12
  178. data/ext/RMagick/rmenum.c +2 -2
  179. data/ext/RMagick/rmfill.c +25 -25
  180. data/ext/RMagick/rmilist.c +121 -104
  181. data/ext/RMagick/rmimage.c +743 -548
  182. data/ext/RMagick/rminfo.c +15 -15
  183. data/ext/RMagick/rmmain.c +27 -3
  184. data/ext/RMagick/rmpixel.c +25 -27
  185. data/ext/RMagick/rmstruct.c +1 -1
  186. data/ext/RMagick/rmutil.c +18 -18
  187. data/lib/RMagick.rb +1 -1962
  188. data/lib/rmagick/version.rb +5 -0
  189. data/lib/rmagick.rb +1 -0
  190. data/lib/rmagick_internal.rb +1964 -0
  191. data/rmagick.gemspec +21 -9
  192. data/test/Draw.rb +121 -0
  193. data/test/Image1.rb +763 -0
  194. data/test/Image2.rb +1312 -0
  195. data/test/Image3.rb +1033 -0
  196. data/test/ImageList1.rb +808 -0
  197. data/test/ImageList2.rb +389 -0
  198. data/test/Image_attributes.rb +700 -0
  199. data/test/Import_Export.rb +126 -0
  200. data/test/Info.rb +349 -0
  201. data/test/Magick.rb +324 -0
  202. data/test/Pixel.rb +119 -0
  203. data/test/Preview.rb +62 -0
  204. data/test/cmyk.icm +0 -0
  205. data/test/srgb.icm +0 -0
  206. data/test/test_all_basic.rb +34 -0
  207. data/test/tmpnam_test.rb +50 -0
  208. metadata +395 -352
  209. data/README-Mac-OSX.txt +0 -1
  210. data/README.html +0 -10
  211. data/build_tarball.rake +0 -215
  212. data/ext/RMagick/MANIFEST +0 -358
  213. data/metaconfig +0 -7
  214. data/post-clean.rb +0 -12
  215. data/post-install.rb +0 -50
  216. data/post-setup.rb +0 -254
  217. data/setup.rb +0 -1585
  218. data/uninstall.rb +0 -74
@@ -6,7 +6,7 @@
6
6
  * Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
7
7
  *
8
8
  * @file rmimage.c
9
- * @version $Id: rmimage.c,v 1.360 2009/12/21 10:34:57 baror Exp $
9
+ * @version $Id: rmimage.c,v 1.361 2010/05/03 03:34:48 baror Exp $
10
10
  * @author Tim Hunter
11
11
  ******************************************************************************/
12
12
 
@@ -22,7 +22,7 @@ typedef Image *(magnifier_t)(const Image *, ExceptionInfo *);
22
22
  /** Method that reads an image */
23
23
  typedef Image *(reader_t)(const Info *, ExceptionInfo *);
24
24
  /** Method that scales an image */
25
- typedef Image *(scaler_t)(const Image *, const unsigned long, const unsigned long, ExceptionInfo *);
25
+ typedef Image *(scaler_t)(const Image *, const size_t, const size_t, ExceptionInfo *);
26
26
  /** Method that computes threshold on an image */
27
27
  typedef MagickBooleanType (thresholder_t)(Image *, const char *);
28
28
  /** Method that transforms an image */
@@ -62,7 +62,7 @@ adaptive_method(int argc, VALUE *argv, VALUE self
62
62
  Image *image, *new_image;
63
63
  double radius = 0.0;
64
64
  double sigma = 1.0;
65
- ExceptionInfo exception;
65
+ ExceptionInfo *exception;
66
66
 
67
67
  image = rm_check_destroyed(self);
68
68
 
@@ -79,12 +79,12 @@ adaptive_method(int argc, VALUE *argv, VALUE self
79
79
  break;
80
80
  }
81
81
 
82
- GetExceptionInfo(&exception);
82
+ exception = AcquireExceptionInfo();
83
83
 
84
- new_image = (fp)(image, radius, sigma, &exception);
85
- rm_check_exception(&exception, new_image, DestroyOnError);
84
+ new_image = (fp)(image, radius, sigma, exception);
85
+ rm_check_exception(exception, new_image, DestroyOnError);
86
86
 
87
- (void) DestroyExceptionInfo(&exception);
87
+ (void) DestroyExceptionInfo(exception);
88
88
 
89
89
  rm_ensure_result(new_image);
90
90
 
@@ -111,7 +111,7 @@ adaptive_channel_method(int argc, VALUE *argv, VALUE self
111
111
  Image *image, *new_image;
112
112
  double radius = 0.0;
113
113
  double sigma = 1.0;
114
- ExceptionInfo exception;
114
+ ExceptionInfo *exception;
115
115
  ChannelType channels;
116
116
 
117
117
  image = rm_check_destroyed(self);
@@ -130,12 +130,12 @@ adaptive_channel_method(int argc, VALUE *argv, VALUE self
130
130
  break;
131
131
  }
132
132
 
133
- GetExceptionInfo(&exception);
133
+ exception = AcquireExceptionInfo();
134
134
 
135
- new_image = (fp)(image, channels, radius, sigma, &exception);
136
- rm_check_exception(&exception, new_image, DestroyOnError);
135
+ new_image = (fp)(image, channels, radius, sigma, exception);
136
+ rm_check_exception(exception, new_image, DestroyOnError);
137
137
 
138
- (void) DestroyExceptionInfo(&exception);
138
+ (void) DestroyExceptionInfo(exception);
139
139
 
140
140
  rm_ensure_result(new_image);
141
141
 
@@ -213,7 +213,7 @@ Image_adaptive_resize(int argc, VALUE *argv, VALUE self)
213
213
  Image *image, *new_image;
214
214
  unsigned long rows, columns;
215
215
  double scale_val, drows, dcols;
216
- ExceptionInfo exception;
216
+ ExceptionInfo *exception;
217
217
 
218
218
  image = rm_check_destroyed(self);
219
219
 
@@ -243,11 +243,11 @@ Image_adaptive_resize(int argc, VALUE *argv, VALUE self)
243
243
  break;
244
244
  }
245
245
 
246
- GetExceptionInfo(&exception);
247
- new_image = AdaptiveResizeImage(image, columns, rows, &exception);
248
- rm_check_exception(&exception, new_image, DestroyOnError);
246
+ exception = AcquireExceptionInfo();
247
+ new_image = AdaptiveResizeImage(image, columns, rows, exception);
248
+ rm_check_exception(exception, new_image, DestroyOnError);
249
249
 
250
- (void) DestroyExceptionInfo(&exception);
250
+ (void) DestroyExceptionInfo(exception);
251
251
  rm_ensure_result(new_image);
252
252
 
253
253
  return rm_image_new(new_image);
@@ -326,7 +326,7 @@ Image_adaptive_threshold(int argc, VALUE *argv, VALUE self)
326
326
  Image *image, *new_image;
327
327
  unsigned long width = 3, height = 3;
328
328
  long offset = 0;
329
- ExceptionInfo exception;
329
+ ExceptionInfo *exception;
330
330
 
331
331
  image = rm_check_destroyed(self);
332
332
 
@@ -344,11 +344,11 @@ Image_adaptive_threshold(int argc, VALUE *argv, VALUE self)
344
344
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 to 3)", argc);
345
345
  }
346
346
 
347
- GetExceptionInfo(&exception);
348
- new_image = AdaptiveThresholdImage(image, width, height, offset, &exception);
349
- rm_check_exception(&exception, new_image, DestroyOnError);
347
+ exception = AcquireExceptionInfo();
348
+ new_image = AdaptiveThresholdImage(image, width, height, offset, exception);
349
+ rm_check_exception(exception, new_image, DestroyOnError);
350
350
 
351
- (void) DestroyExceptionInfo(&exception);
351
+ (void) DestroyExceptionInfo(exception);
352
352
 
353
353
  rm_ensure_result(new_image);
354
354
 
@@ -409,17 +409,17 @@ Image_add_noise(VALUE self, VALUE noise)
409
409
  {
410
410
  Image *image, *new_image;
411
411
  NoiseType noise_type;
412
- ExceptionInfo exception;
412
+ ExceptionInfo *exception;
413
413
 
414
414
  image = rm_check_destroyed(self);
415
415
 
416
416
  VALUE_TO_ENUM(noise, noise_type, NoiseType);
417
417
 
418
- GetExceptionInfo(&exception);
419
- new_image = AddNoiseImage(image, noise_type, &exception);
420
- rm_check_exception(&exception, new_image, DestroyOnError);
418
+ exception = AcquireExceptionInfo();
419
+ new_image = AddNoiseImage(image, noise_type, exception);
420
+ rm_check_exception(exception, new_image, DestroyOnError);
421
421
 
422
- (void) DestroyExceptionInfo(&exception);
422
+ (void) DestroyExceptionInfo(exception);
423
423
 
424
424
  rm_ensure_result(new_image);
425
425
 
@@ -447,7 +447,7 @@ Image_add_noise_channel(int argc, VALUE *argv, VALUE self)
447
447
  {
448
448
  Image *image, *new_image;
449
449
  NoiseType noise_type;
450
- ExceptionInfo exception;
450
+ ExceptionInfo *exception;
451
451
  ChannelType channels;
452
452
 
453
453
  image = rm_check_destroyed(self);
@@ -466,11 +466,11 @@ Image_add_noise_channel(int argc, VALUE *argv, VALUE self)
466
466
  VALUE_TO_ENUM(argv[0], noise_type, NoiseType);
467
467
  channels &= ~OpacityChannel;
468
468
 
469
- GetExceptionInfo(&exception);
470
- new_image = AddNoiseImageChannel(image, channels, noise_type, &exception);
471
- rm_check_exception(&exception, new_image, DestroyOnError);
469
+ exception = AcquireExceptionInfo();
470
+ new_image = AddNoiseImageChannel(image, channels, noise_type, exception);
471
+ rm_check_exception(exception, new_image, DestroyOnError);
472
472
 
473
- (void) DestroyExceptionInfo(&exception);
473
+ (void) DestroyExceptionInfo(exception);
474
474
 
475
475
  rm_ensure_result(new_image);
476
476
 
@@ -494,7 +494,7 @@ Image_add_profile(VALUE self, VALUE name)
494
494
  // ImageMagick code based on the code for the "-profile" option in mogrify.c
495
495
  Image *image, *profile_image;
496
496
  ImageInfo *info;
497
- ExceptionInfo exception;
497
+ ExceptionInfo *exception;
498
498
  char *profile_name;
499
499
  char *profile_filename = NULL;
500
500
  long profile_filename_l = 0;
@@ -518,11 +518,11 @@ Image_add_profile(VALUE self, VALUE name)
518
518
  strncpy(info->filename, profile_filename, min((size_t)profile_filename_l, sizeof(info->filename)));
519
519
  info->filename[MaxTextExtent-1] = '\0';
520
520
 
521
- GetExceptionInfo(&exception);
522
- profile_image = ReadImage(info, &exception);
521
+ exception = AcquireExceptionInfo();
522
+ profile_image = ReadImage(info, exception);
523
523
  (void) DestroyImageInfo(info);
524
- rm_check_exception(&exception, profile_image, DestroyOnError);
525
- (void) DestroyExceptionInfo(&exception);
524
+ rm_check_exception(exception, profile_image, DestroyOnError);
525
+ (void) DestroyExceptionInfo(exception);
526
526
  rm_ensure_result(profile_image);
527
527
 
528
528
  ResetImageProfileIterator(profile_image);
@@ -691,7 +691,7 @@ VALUE
691
691
  Image_affine_transform(VALUE self, VALUE affine)
692
692
  {
693
693
  Image *image, *new_image;
694
- ExceptionInfo exception;
694
+ ExceptionInfo *exception;
695
695
  AffineMatrix matrix;
696
696
 
697
697
  image = rm_check_destroyed(self);
@@ -699,11 +699,11 @@ Image_affine_transform(VALUE self, VALUE affine)
699
699
  // Convert Magick::AffineMatrix to AffineMatrix structure.
700
700
  Export_AffineMatrix(&matrix, affine);
701
701
 
702
- GetExceptionInfo(&exception);
703
- new_image = AffineTransformImage(image, &matrix, &exception);
704
- rm_check_exception(&exception, new_image, DestroyOnError);
702
+ exception = AcquireExceptionInfo();
703
+ new_image = AffineTransformImage(image, &matrix, exception);
704
+ rm_check_exception(exception, new_image, DestroyOnError);
705
705
 
706
- (void) DestroyExceptionInfo(&exception);
706
+ (void) DestroyExceptionInfo(exception);
707
707
 
708
708
  rm_ensure_result(new_image);
709
709
 
@@ -847,15 +847,15 @@ static VALUE
847
847
  crisscross(int bang, VALUE self, Image *fp(const Image *, ExceptionInfo *))
848
848
  {
849
849
  Image *image, *new_image;
850
- ExceptionInfo exception;
850
+ ExceptionInfo *exception;
851
851
 
852
852
  Data_Get_Struct(self, Image, image);
853
- GetExceptionInfo(&exception);
853
+ exception = AcquireExceptionInfo();
854
854
 
855
- new_image = (fp)(image, &exception);
856
- rm_check_exception(&exception, new_image, DestroyOnError);
855
+ new_image = (fp)(image, exception);
856
+ rm_check_exception(exception, new_image, DestroyOnError);
857
857
 
858
- (void) DestroyExceptionInfo(&exception);
858
+ (void) DestroyExceptionInfo(exception);
859
859
 
860
860
  rm_ensure_result(new_image);
861
861
 
@@ -1723,7 +1723,7 @@ Image_blue_shift(int argc, VALUE *argv, VALUE self)
1723
1723
  #if defined(HAVE_BLUESHIFTIMAGE)
1724
1724
  Image *image, *new_image;
1725
1725
  double factor = 1.5;
1726
- ExceptionInfo exception;
1726
+ ExceptionInfo *exception;
1727
1727
 
1728
1728
  image = rm_check_destroyed(self);
1729
1729
 
@@ -1739,10 +1739,10 @@ Image_blue_shift(int argc, VALUE *argv, VALUE self)
1739
1739
  }
1740
1740
 
1741
1741
 
1742
- GetExceptionInfo(&exception);
1743
- new_image = BlueShiftImage(image, factor, &exception);
1742
+ exception = AcquireExceptionInfo();
1743
+ new_image = BlueShiftImage(image, factor, exception);
1744
1744
  CHECK_EXCEPTION();
1745
- DestroyExceptionInfo(&exception);
1745
+ DestroyExceptionInfo(exception);
1746
1746
 
1747
1747
  return rm_image_new(new_image);
1748
1748
  #else
@@ -1782,7 +1782,7 @@ VALUE
1782
1782
  Image_blur_channel(int argc, VALUE *argv, VALUE self)
1783
1783
  {
1784
1784
  Image *image, *new_image;
1785
- ExceptionInfo exception;
1785
+ ExceptionInfo *exception;
1786
1786
  ChannelType channels;
1787
1787
  double radius = 0.0, sigma = 1.0;
1788
1788
 
@@ -1803,11 +1803,11 @@ Image_blur_channel(int argc, VALUE *argv, VALUE self)
1803
1803
  raise_ChannelType_error(argv[argc-1]);
1804
1804
  }
1805
1805
 
1806
- GetExceptionInfo(&exception);
1807
- new_image = BlurImageChannel(image, channels, radius, sigma, &exception);
1808
- rm_check_exception(&exception, new_image, DestroyOnError);
1806
+ exception = AcquireExceptionInfo();
1807
+ new_image = BlurImageChannel(image, channels, radius, sigma, exception);
1808
+ rm_check_exception(exception, new_image, DestroyOnError);
1809
1809
 
1810
- (void) DestroyExceptionInfo(&exception);
1810
+ (void) DestroyExceptionInfo(exception);
1811
1811
 
1812
1812
  rm_ensure_result(new_image);
1813
1813
 
@@ -1860,7 +1860,7 @@ border(int bang, VALUE self, VALUE width, VALUE height, VALUE color)
1860
1860
  {
1861
1861
  Image *image, *new_image;
1862
1862
  PixelPacket old_border;
1863
- ExceptionInfo exception;
1863
+ ExceptionInfo *exception;
1864
1864
  RectangleInfo rect;
1865
1865
 
1866
1866
  Data_Get_Struct(self, Image, image);
@@ -1873,11 +1873,11 @@ border(int bang, VALUE self, VALUE width, VALUE height, VALUE color)
1873
1873
  old_border = image->border_color;
1874
1874
  Color_to_PixelPacket(&image->border_color, color);
1875
1875
 
1876
- GetExceptionInfo(&exception);
1877
- new_image = BorderImage(image, &rect, &exception);
1878
- rm_check_exception(&exception, new_image, DestroyOnError);
1876
+ exception = AcquireExceptionInfo();
1877
+ new_image = BorderImage(image, &rect, exception);
1878
+ rm_check_exception(exception, new_image, DestroyOnError);
1879
1879
 
1880
- (void) DestroyExceptionInfo(&exception);
1880
+ (void) DestroyExceptionInfo(exception);
1881
1881
 
1882
1882
  rm_ensure_result(new_image);
1883
1883
 
@@ -1989,14 +1989,14 @@ Image_bounding_box(VALUE self)
1989
1989
  {
1990
1990
  Image *image;
1991
1991
  RectangleInfo box;
1992
- ExceptionInfo exception;
1992
+ ExceptionInfo *exception;
1993
1993
 
1994
1994
  image = rm_check_destroyed(self);
1995
- GetExceptionInfo(&exception);
1996
- box = GetImageBoundingBox(image, &exception);
1995
+ exception = AcquireExceptionInfo();
1996
+ box = GetImageBoundingBox(image, exception);
1997
1997
  CHECK_EXCEPTION()
1998
1998
 
1999
- (void) DestroyExceptionInfo(&exception);
1999
+ (void) DestroyExceptionInfo(exception);
2000
2000
 
2001
2001
  return Import_RectangleInfo(&box);
2002
2002
  }
@@ -2190,7 +2190,7 @@ Image_channel_depth(int argc, VALUE *argv, VALUE self)
2190
2190
  Image *image;
2191
2191
  ChannelType channels;
2192
2192
  unsigned long channel_depth;
2193
- ExceptionInfo exception;
2193
+ ExceptionInfo *exception;
2194
2194
 
2195
2195
  image = rm_check_destroyed(self);
2196
2196
  channels = extract_channels(&argc, argv);
@@ -2201,12 +2201,12 @@ Image_channel_depth(int argc, VALUE *argv, VALUE self)
2201
2201
  raise_ChannelType_error(argv[argc-1]);
2202
2202
  }
2203
2203
 
2204
- GetExceptionInfo(&exception);
2204
+ exception = AcquireExceptionInfo();
2205
2205
 
2206
- channel_depth = GetImageChannelDepth(image, channels, &exception);
2206
+ channel_depth = GetImageChannelDepth(image, channels, exception);
2207
2207
  CHECK_EXCEPTION()
2208
2208
 
2209
- (void) DestroyExceptionInfo(&exception);
2209
+ (void) DestroyExceptionInfo(exception);
2210
2210
 
2211
2211
  return ULONG2NUM(channel_depth);
2212
2212
  }
@@ -2237,8 +2237,8 @@ Image_channel_extrema(int argc, VALUE *argv, VALUE self)
2237
2237
  {
2238
2238
  Image *image;
2239
2239
  ChannelType channels;
2240
- ExceptionInfo exception;
2241
- unsigned long min, max;
2240
+ ExceptionInfo *exception;
2241
+ size_t min, max;
2242
2242
  volatile VALUE ary;
2243
2243
 
2244
2244
  image = rm_check_destroyed(self);
@@ -2251,11 +2251,11 @@ Image_channel_extrema(int argc, VALUE *argv, VALUE self)
2251
2251
  raise_ChannelType_error(argv[argc-1]);
2252
2252
  }
2253
2253
 
2254
- GetExceptionInfo(&exception);
2255
- (void) GetImageChannelExtrema(image, channels, &min, &max, &exception);
2254
+ exception = AcquireExceptionInfo();
2255
+ (void) GetImageChannelExtrema(image, channels, &min, &max, exception);
2256
2256
  CHECK_EXCEPTION()
2257
2257
 
2258
- (void) DestroyExceptionInfo(&exception);
2258
+ (void) DestroyExceptionInfo(exception);
2259
2259
 
2260
2260
  ary = rb_ary_new2(2);
2261
2261
  rb_ary_store(ary, 0, ULONG2NUM(min));
@@ -2285,7 +2285,7 @@ Image_channel_mean(int argc, VALUE *argv, VALUE self)
2285
2285
  {
2286
2286
  Image *image;
2287
2287
  ChannelType channels;
2288
- ExceptionInfo exception;
2288
+ ExceptionInfo *exception;
2289
2289
  double mean, stddev;
2290
2290
  volatile VALUE ary;
2291
2291
 
@@ -2299,11 +2299,11 @@ Image_channel_mean(int argc, VALUE *argv, VALUE self)
2299
2299
  raise_ChannelType_error(argv[argc-1]);
2300
2300
  }
2301
2301
 
2302
- GetExceptionInfo(&exception);
2303
- (void) GetImageChannelMean(image, channels, &mean, &stddev, &exception);
2302
+ exception = AcquireExceptionInfo();
2303
+ (void) GetImageChannelMean(image, channels, &mean, &stddev, exception);
2304
2304
  CHECK_EXCEPTION()
2305
2305
 
2306
- (void) DestroyExceptionInfo(&exception);
2306
+ (void) DestroyExceptionInfo(exception);
2307
2307
 
2308
2308
  ary = rb_ary_new2(2);
2309
2309
  rb_ary_store(ary, 0, rb_float_new(mean));
@@ -2506,9 +2506,9 @@ Image_color_histogram(VALUE self)
2506
2506
  {
2507
2507
  Image *image, *dc_copy = NULL;
2508
2508
  volatile VALUE hash, pixel;
2509
- unsigned long x, colors;
2509
+ size_t x, colors;
2510
2510
  ColorPacket *histogram;
2511
- ExceptionInfo exception;
2511
+ ExceptionInfo *exception;
2512
2512
 
2513
2513
  image = rm_check_destroyed(self);
2514
2514
 
@@ -2523,8 +2523,8 @@ Image_color_histogram(VALUE self)
2523
2523
  image = dc_copy;
2524
2524
  }
2525
2525
 
2526
- GetExceptionInfo(&exception);
2527
- histogram = GetImageHistogram(image, &colors, &exception);
2526
+ exception = AcquireExceptionInfo();
2527
+ histogram = GetImageHistogram(image, &colors, exception);
2528
2528
 
2529
2529
  if (histogram == NULL)
2530
2530
  {
@@ -2534,13 +2534,13 @@ Image_color_histogram(VALUE self)
2534
2534
  }
2535
2535
  rb_raise(rb_eNoMemError, "not enough memory to continue");
2536
2536
  }
2537
- if (exception.severity != UndefinedException)
2537
+ if (exception->severity != UndefinedException)
2538
2538
  {
2539
2539
  (void) RelinquishMagickMemory(histogram);
2540
- rm_check_exception(&exception, dc_copy, DestroyOnError);
2540
+ rm_check_exception(exception, dc_copy, DestroyOnError);
2541
2541
  }
2542
2542
 
2543
- (void) DestroyExceptionInfo(&exception);
2543
+ (void) DestroyExceptionInfo(exception);
2544
2544
 
2545
2545
  hash = rb_hash_new();
2546
2546
  for (x = 0; x < colors; x++)
@@ -2581,7 +2581,7 @@ set_profile(VALUE self, const char *name, VALUE profile)
2581
2581
  Image *image, *profile_image;
2582
2582
  ImageInfo *info;
2583
2583
  const MagickInfo *m;
2584
- ExceptionInfo exception;
2584
+ ExceptionInfo *exception;
2585
2585
  char *profile_name;
2586
2586
  char *profile_blob;
2587
2587
  long profile_length;
@@ -2591,8 +2591,8 @@ set_profile(VALUE self, const char *name, VALUE profile)
2591
2591
 
2592
2592
  profile_blob = rm_str2cstr(profile, &profile_length);
2593
2593
 
2594
- GetExceptionInfo(&exception);
2595
- m = GetMagickInfo(name, &exception);
2594
+ exception = AcquireExceptionInfo();
2595
+ m = GetMagickInfo(name, exception);
2596
2596
  CHECK_EXCEPTION()
2597
2597
 
2598
2598
  info = CloneImageInfo(NULL);
@@ -2604,10 +2604,10 @@ set_profile(VALUE self, const char *name, VALUE profile)
2604
2604
  strncpy(info->magick, m->name, MaxTextExtent);
2605
2605
  info->magick[MaxTextExtent-1] = '\0';
2606
2606
 
2607
- profile_image = BlobToImage(info, profile_blob, (size_t)profile_length, &exception);
2607
+ profile_image = BlobToImage(info, profile_blob, (size_t)profile_length, exception);
2608
2608
  (void) DestroyImageInfo(info);
2609
2609
  CHECK_EXCEPTION()
2610
- (void) DestroyExceptionInfo(&exception);
2610
+ (void) DestroyExceptionInfo(exception);
2611
2611
 
2612
2612
  ResetImageProfileIterator(profile_image);
2613
2613
  profile_name = GetNextImageProfile(profile_image);
@@ -2810,7 +2810,7 @@ Image_colorize(int argc, VALUE *argv, VALUE self)
2810
2810
  double red, green, blue, matte;
2811
2811
  char opacity[50];
2812
2812
  PixelPacket target;
2813
- ExceptionInfo exception;
2813
+ ExceptionInfo *exception;
2814
2814
 
2815
2815
  image = rm_check_destroyed(self);
2816
2816
 
@@ -2836,11 +2836,11 @@ Image_colorize(int argc, VALUE *argv, VALUE self)
2836
2836
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 4 or 5)", argc);
2837
2837
  }
2838
2838
 
2839
- GetExceptionInfo(&exception);
2840
- new_image = ColorizeImage(image, opacity, target, &exception);
2841
- rm_check_exception(&exception, new_image, DestroyOnError);
2839
+ exception = AcquireExceptionInfo();
2840
+ new_image = ColorizeImage(image, opacity, target, exception);
2841
+ rm_check_exception(exception, new_image, DestroyOnError);
2842
2842
 
2843
- (void) DestroyExceptionInfo(&exception);
2843
+ (void) DestroyExceptionInfo(exception);
2844
2844
 
2845
2845
  rm_ensure_result(new_image);
2846
2846
 
@@ -2993,7 +2993,11 @@ Image_colorspace_eq(VALUE self, VALUE colorspace)
2993
2993
 
2994
2994
  image = rm_check_frozen(self);
2995
2995
  VALUE_TO_ENUM(colorspace, new_cs, ColorspaceType);
2996
+ #if defined(HAVE_TRANSFORMIMAGECOLORSPACE)
2997
+ (void) TransformImageColorspace(image, new_cs);
2998
+ #else
2996
2999
  (void) SetImageColorspace(image, new_cs);
3000
+ #endif
2997
3001
 
2998
3002
  return self;
2999
3003
  }
@@ -3034,7 +3038,7 @@ VALUE Image_combine(int argc, VALUE *argv, VALUE self)
3034
3038
  {
3035
3039
  ChannelType channel = 0;
3036
3040
  Image *image, *images = NULL, *new_image;
3037
- ExceptionInfo exception;
3041
+ ExceptionInfo *exception;
3038
3042
 
3039
3043
  self = self; // defeat "unreferenced argument" message
3040
3044
 
@@ -3078,10 +3082,10 @@ VALUE Image_combine(int argc, VALUE *argv, VALUE self)
3078
3082
  rb_raise(rb_eArgError, "no images to combine");
3079
3083
  }
3080
3084
 
3081
- GetExceptionInfo(&exception);
3085
+ exception = AcquireExceptionInfo();
3082
3086
  ReverseImageList(&images);
3083
- new_image = CombineImages(images, channel, &exception);
3084
- rm_check_exception(&exception, images, RetainOnError);
3087
+ new_image = CombineImages(images, channel, exception);
3088
+ rm_check_exception(exception, images, RetainOnError);
3085
3089
  rm_split(images);
3086
3090
 
3087
3091
  rm_ensure_result(new_image);
@@ -3125,7 +3129,7 @@ Image_compare_channel(int argc, VALUE *argv, VALUE self)
3125
3129
  volatile VALUE ary, ref;
3126
3130
  MetricType metric_type;
3127
3131
  ChannelType channels;
3128
- ExceptionInfo exception;
3132
+ ExceptionInfo *exception;
3129
3133
 
3130
3134
  image = rm_check_destroyed(self);
3131
3135
 
@@ -3147,16 +3151,16 @@ Image_compare_channel(int argc, VALUE *argv, VALUE self)
3147
3151
 
3148
3152
  VALUE_TO_ENUM(argv[1], metric_type, MetricType);
3149
3153
 
3150
- GetExceptionInfo(&exception);
3154
+ exception = AcquireExceptionInfo();
3151
3155
  difference_image = CompareImageChannels(image
3152
3156
  , r_image
3153
3157
  , channels
3154
3158
  , metric_type
3155
3159
  , &distortion
3156
- , &exception);
3157
- rm_check_exception(&exception, difference_image, DestroyOnError);
3160
+ , exception);
3161
+ rm_check_exception(exception, difference_image, DestroyOnError);
3158
3162
 
3159
- (void) DestroyExceptionInfo(&exception);
3163
+ (void) DestroyExceptionInfo(exception);
3160
3164
 
3161
3165
  rm_ensure_result(difference_image);
3162
3166
 
@@ -3824,7 +3828,7 @@ Image_constitute(VALUE class, VALUE width_arg, VALUE height_arg
3824
3828
  , VALUE map_arg, VALUE pixels_arg)
3825
3829
  {
3826
3830
  Image *image;
3827
- ExceptionInfo exception;
3831
+ ExceptionInfo *exception;
3828
3832
  volatile VALUE pixel, pixel0;
3829
3833
  unsigned long width, height;
3830
3834
  long x, npixels;
@@ -3909,7 +3913,7 @@ Image_constitute(VALUE class, VALUE width_arg, VALUE height_arg
3909
3913
  }
3910
3914
  }
3911
3915
 
3912
- GetExceptionInfo(&exception);
3916
+ exception = AcquireExceptionInfo();
3913
3917
 
3914
3918
  // This is based on ConstituteImage in IM 5.5.7
3915
3919
  image = AcquireImage(NULL);
@@ -3928,8 +3932,10 @@ Image_constitute(VALUE class, VALUE width_arg, VALUE height_arg
3928
3932
  xfree(pixels.v);
3929
3933
  rm_check_image_exception(image, DestroyOnError);
3930
3934
 
3931
- (void) DestroyExceptionInfo(&exception);
3935
+ (void) DestroyExceptionInfo(exception);
3936
+ #if defined(HAVE_DESTROYCONSTITUTE) || defined(HAVE_CONSTITUTECOMPONENTTERMINUS)
3932
3937
  DestroyConstitute();
3938
+ #endif
3933
3939
 
3934
3940
  return rm_image_new(image);
3935
3941
  }
@@ -4101,7 +4107,7 @@ Image_convolve(VALUE self, VALUE order_arg, VALUE kernel_arg)
4101
4107
  Image *image, *new_image;
4102
4108
  double *kernel;
4103
4109
  unsigned int x, order;
4104
- ExceptionInfo exception;
4110
+ ExceptionInfo *exception;
4105
4111
 
4106
4112
  image = rm_check_destroyed(self);
4107
4113
 
@@ -4118,13 +4124,13 @@ Image_convolve(VALUE self, VALUE order_arg, VALUE kernel_arg)
4118
4124
  kernel[x] = NUM2DBL(rb_ary_entry(kernel_arg, (long)x));
4119
4125
  }
4120
4126
 
4121
- GetExceptionInfo(&exception);
4127
+ exception = AcquireExceptionInfo();
4122
4128
 
4123
- new_image = ConvolveImage((const Image *)image, order, (double *)kernel, &exception);
4129
+ new_image = ConvolveImage((const Image *)image, order, (double *)kernel, exception);
4124
4130
  xfree((void *)kernel);
4125
- rm_check_exception(&exception, new_image, DestroyOnError);
4131
+ rm_check_exception(exception, new_image, DestroyOnError);
4126
4132
 
4127
- (void) DestroyExceptionInfo(&exception);
4133
+ (void) DestroyExceptionInfo(exception);
4128
4134
 
4129
4135
  rm_ensure_result(new_image);
4130
4136
 
@@ -4153,7 +4159,7 @@ Image_convolve_channel(int argc, VALUE *argv, VALUE self)
4153
4159
  volatile VALUE ary;
4154
4160
  unsigned int x, order;
4155
4161
  ChannelType channels;
4156
- ExceptionInfo exception;
4162
+ ExceptionInfo *exception;
4157
4163
 
4158
4164
  image = rm_check_destroyed(self);
4159
4165
 
@@ -4182,13 +4188,13 @@ Image_convolve_channel(int argc, VALUE *argv, VALUE self)
4182
4188
  kernel[x] = NUM2DBL(rb_ary_entry(ary, (long)x));
4183
4189
  }
4184
4190
 
4185
- GetExceptionInfo(&exception);
4191
+ exception = AcquireExceptionInfo();
4186
4192
 
4187
- new_image = ConvolveImageChannel(image, channels, order, kernel, &exception);
4193
+ new_image = ConvolveImageChannel(image, channels, order, kernel, exception);
4188
4194
  xfree((void *)kernel);
4189
- rm_check_exception(&exception, new_image, DestroyOnError);
4195
+ rm_check_exception(exception, new_image, DestroyOnError);
4190
4196
 
4191
- (void) DestroyExceptionInfo(&exception);
4197
+ (void) DestroyExceptionInfo(exception);
4192
4198
 
4193
4199
  rm_ensure_result(new_image);
4194
4200
 
@@ -4420,24 +4426,24 @@ Image_decipher(VALUE self, VALUE passphrase)
4420
4426
  #if defined(HAVE_ENCIPHERIMAGE)
4421
4427
  Image *image, *new_image;
4422
4428
  char *pf;
4423
- ExceptionInfo exception;
4429
+ ExceptionInfo *exception;
4424
4430
  MagickBooleanType okay;
4425
4431
 
4426
4432
  image = rm_check_destroyed(self);
4427
4433
  pf = StringValuePtr(passphrase); // ensure passphrase is a string
4428
- GetExceptionInfo(&exception);
4434
+ exception = AcquireExceptionInfo();
4429
4435
 
4430
4436
  new_image = rm_clone_image(image);
4431
4437
 
4432
- okay = DecipherImage(new_image, pf, &exception);
4433
- rm_check_exception(&exception, new_image, DestroyOnError);
4438
+ okay = DecipherImage(new_image, pf, exception);
4439
+ rm_check_exception(exception, new_image, DestroyOnError);
4434
4440
  if (!okay)
4435
4441
  {
4436
4442
  new_image = DestroyImage(new_image);
4437
4443
  rb_raise(rb_eRuntimeError, "DecipherImage failed for unknown reason.");
4438
4444
  }
4439
4445
 
4440
- DestroyExceptionInfo(&exception);
4446
+ DestroyExceptionInfo(exception);
4441
4447
 
4442
4448
  return rm_image_new(new_image);
4443
4449
  #else
@@ -4571,15 +4577,15 @@ Image_depth(VALUE self)
4571
4577
  {
4572
4578
  Image *image;
4573
4579
  unsigned long depth = 0;
4574
- ExceptionInfo exception;
4580
+ ExceptionInfo *exception;
4575
4581
 
4576
4582
  image = rm_check_destroyed(self);
4577
- GetExceptionInfo(&exception);
4583
+ exception = AcquireExceptionInfo();
4578
4584
 
4579
- depth = GetImageDepth(image, &exception);
4585
+ depth = GetImageDepth(image, exception);
4580
4586
  CHECK_EXCEPTION()
4581
4587
 
4582
- (void) DestroyExceptionInfo(&exception);
4588
+ (void) DestroyExceptionInfo(exception);
4583
4589
 
4584
4590
  return INT2FIX(depth);
4585
4591
  }
@@ -4610,7 +4616,7 @@ Image_deskew(int argc, VALUE *argv, VALUE self)
4610
4616
  double threshold = 40.0 * QuantumRange / 100.0;
4611
4617
  unsigned long width;
4612
4618
  char auto_crop_width[20];
4613
- ExceptionInfo exception;
4619
+ ExceptionInfo *exception;
4614
4620
 
4615
4621
  image = rm_check_destroyed(self);
4616
4622
 
@@ -4630,12 +4636,12 @@ Image_deskew(int argc, VALUE *argv, VALUE self)
4630
4636
  break;
4631
4637
  }
4632
4638
 
4633
- GetExceptionInfo(&exception);
4634
- new_image = DeskewImage(image, threshold, &exception);
4639
+ exception = AcquireExceptionInfo();
4640
+ new_image = DeskewImage(image, threshold, exception);
4635
4641
  CHECK_EXCEPTION()
4636
4642
  rm_ensure_result(new_image);
4637
4643
 
4638
- (void) DestroyExceptionInfo(&exception);
4644
+ (void) DestroyExceptionInfo(exception);
4639
4645
 
4640
4646
  return rm_image_new(new_image);
4641
4647
  #else
@@ -4662,15 +4668,15 @@ VALUE
4662
4668
  Image_despeckle(VALUE self)
4663
4669
  {
4664
4670
  Image *image, *new_image;
4665
- ExceptionInfo exception;
4671
+ ExceptionInfo *exception;
4666
4672
 
4667
4673
  image = rm_check_destroyed(self);
4668
- GetExceptionInfo(&exception);
4674
+ exception = AcquireExceptionInfo();
4669
4675
 
4670
- new_image = DespeckleImage(image, &exception);
4671
- rm_check_exception(&exception, new_image, DestroyOnError);
4676
+ new_image = DespeckleImage(image, exception);
4677
+ rm_check_exception(exception, new_image, DestroyOnError);
4672
4678
 
4673
- (void) DestroyExceptionInfo(&exception);
4679
+ (void) DestroyExceptionInfo(exception);
4674
4680
 
4675
4681
  rm_ensure_result(new_image);
4676
4682
 
@@ -4862,7 +4868,7 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
4862
4868
  char *map;
4863
4869
  long mapL;
4864
4870
  MagickBooleanType okay;
4865
- ExceptionInfo exception;
4871
+ ExceptionInfo *exception;
4866
4872
  volatile union
4867
4873
  {
4868
4874
  Quantum *i;
@@ -4897,8 +4903,8 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
4897
4903
 
4898
4904
  Data_Get_Struct(self, Image, image);
4899
4905
 
4900
- GetExceptionInfo(&exception);
4901
- okay = ExportImagePixels(image, x, y, columns, rows, map, stg_type, (void *)pixels.v, &exception);
4906
+ exception = AcquireExceptionInfo();
4907
+ okay = ExportImagePixels(image, x, y, columns, rows, map, stg_type, (void *)pixels.v, exception);
4902
4908
 
4903
4909
  if (!okay)
4904
4910
  {
@@ -4907,7 +4913,7 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
4907
4913
 
4908
4914
  CHECK_EXCEPTION()
4909
4915
 
4910
- (void) DestroyExceptionInfo(&exception);
4916
+ (void) DestroyExceptionInfo(exception);
4911
4917
 
4912
4918
  // Convert the pixel data to the appropriate Ruby type
4913
4919
  if (stg_type == QuantumPixel)
@@ -5098,7 +5104,7 @@ Image_distort(int argc, VALUE *argv, VALUE self)
5098
5104
  DistortImageMethod distortion_method;
5099
5105
  double *points;
5100
5106
  MagickBooleanType bestfit = MagickFalse;
5101
- ExceptionInfo exception;
5107
+ ExceptionInfo *exception;
5102
5108
 
5103
5109
  image = rm_check_destroyed(self);
5104
5110
  rm_get_optional_arguments(self);
@@ -5127,11 +5133,11 @@ Image_distort(int argc, VALUE *argv, VALUE self)
5127
5133
  points[n] = NUM2DBL(rb_ary_entry(pts, n));
5128
5134
  }
5129
5135
 
5130
- GetExceptionInfo(&exception);
5131
- new_image = DistortImage(image, distortion_method, npoints, points, bestfit, &exception);
5136
+ exception = AcquireExceptionInfo();
5137
+ new_image = DistortImage(image, distortion_method, npoints, points, bestfit, exception);
5132
5138
  xfree(points);
5133
- rm_check_exception(&exception, new_image, DestroyOnError);
5134
- (void) DestroyExceptionInfo(&exception);
5139
+ rm_check_exception(exception, new_image, DestroyOnError);
5140
+ (void) DestroyExceptionInfo(exception);
5135
5141
  rm_ensure_result(new_image);
5136
5142
 
5137
5143
  return rm_image_new(new_image);
@@ -5159,7 +5165,7 @@ Image_distortion_channel(int argc, VALUE *argv, VALUE self)
5159
5165
  {
5160
5166
  Image *image, *reconstruct;
5161
5167
  ChannelType channels;
5162
- ExceptionInfo exception;
5168
+ ExceptionInfo *exception;
5163
5169
  MetricType metric;
5164
5170
  volatile VALUE rec;
5165
5171
  double distortion;
@@ -5178,12 +5184,12 @@ Image_distortion_channel(int argc, VALUE *argv, VALUE self)
5178
5184
  rec = rm_cur_image(argv[0]);
5179
5185
  reconstruct = rm_check_destroyed(rec);
5180
5186
  VALUE_TO_ENUM(argv[1], metric, MetricType);
5181
- GetExceptionInfo(&exception);
5187
+ exception = AcquireExceptionInfo();
5182
5188
  (void) GetImageChannelDistortion(image, reconstruct, channels
5183
- , metric, &distortion, &exception);
5189
+ , metric, &distortion, exception);
5184
5190
  CHECK_EXCEPTION()
5185
5191
 
5186
- (void) DestroyExceptionInfo(&exception);
5192
+ (void) DestroyExceptionInfo(exception);
5187
5193
 
5188
5194
  return rb_float_new(distortion);
5189
5195
  }
@@ -5212,7 +5218,7 @@ Image__dump(VALUE self, VALUE depth)
5212
5218
  size_t length;
5213
5219
  DumpedImage mi;
5214
5220
  volatile VALUE str;
5215
- ExceptionInfo exception;
5221
+ ExceptionInfo *exception;
5216
5222
 
5217
5223
  depth = depth; // Suppress "never referenced" message from icc
5218
5224
 
@@ -5225,15 +5231,15 @@ Image__dump(VALUE self, VALUE depth)
5225
5231
  }
5226
5232
  strcpy(info->magick, image->magick);
5227
5233
 
5228
- GetExceptionInfo(&exception);
5229
- blob = ImageToBlob(info, image, &length, &exception);
5234
+ exception = AcquireExceptionInfo();
5235
+ blob = ImageToBlob(info, image, &length, exception);
5230
5236
 
5231
5237
  // Free ImageInfo first - error handling may raise an exception
5232
5238
  (void) DestroyImageInfo(info);
5233
5239
 
5234
5240
  CHECK_EXCEPTION()
5235
5241
 
5236
- (void) DestroyExceptionInfo(&exception);
5242
+ (void) DestroyExceptionInfo(exception);
5237
5243
 
5238
5244
  if (!blob)
5239
5245
  {
@@ -5352,7 +5358,7 @@ Image_edge(int argc, VALUE *argv, VALUE self)
5352
5358
  {
5353
5359
  Image *image, *new_image;
5354
5360
  double radius = 0.0;
5355
- ExceptionInfo exception;
5361
+ ExceptionInfo *exception;
5356
5362
 
5357
5363
  image = rm_check_destroyed(self);
5358
5364
  switch (argc)
@@ -5366,12 +5372,12 @@ Image_edge(int argc, VALUE *argv, VALUE self)
5366
5372
  break;
5367
5373
  }
5368
5374
 
5369
- GetExceptionInfo(&exception);
5375
+ exception = AcquireExceptionInfo();
5370
5376
 
5371
- new_image = EdgeImage(image, radius, &exception);
5372
- rm_check_exception(&exception, new_image, DestroyOnError);
5377
+ new_image = EdgeImage(image, radius, exception);
5378
+ rm_check_exception(exception, new_image, DestroyOnError);
5373
5379
 
5374
- (void) DestroyExceptionInfo(&exception);
5380
+ (void) DestroyExceptionInfo(exception);
5375
5381
 
5376
5382
  rm_ensure_result(new_image);
5377
5383
 
@@ -5394,7 +5400,7 @@ static VALUE
5394
5400
  effect_image(VALUE self, int argc, VALUE *argv, effector_t effector)
5395
5401
  {
5396
5402
  Image *image, *new_image;
5397
- ExceptionInfo exception;
5403
+ ExceptionInfo *exception;
5398
5404
  double radius = 0.0, sigma = 1.0;
5399
5405
 
5400
5406
  image = rm_check_destroyed(self);
@@ -5417,11 +5423,11 @@ effect_image(VALUE self, int argc, VALUE *argv, effector_t effector)
5417
5423
  rb_raise(rb_eArgError, "sigma must be != 0.0");
5418
5424
  }
5419
5425
 
5420
- GetExceptionInfo(&exception);
5421
- new_image = (effector)(image, radius, sigma, &exception);
5422
- rm_check_exception(&exception, new_image, DestroyOnError);
5426
+ exception = AcquireExceptionInfo();
5427
+ new_image = (effector)(image, radius, sigma, exception);
5428
+ rm_check_exception(exception, new_image, DestroyOnError);
5423
5429
 
5424
- (void) DestroyExceptionInfo(&exception);
5430
+ (void) DestroyExceptionInfo(exception);
5425
5431
 
5426
5432
  rm_ensure_result(new_image);
5427
5433
 
@@ -5470,24 +5476,24 @@ Image_encipher(VALUE self, VALUE passphrase)
5470
5476
  #if defined(HAVE_ENCIPHERIMAGE)
5471
5477
  Image *image, *new_image;
5472
5478
  char *pf;
5473
- ExceptionInfo exception;
5479
+ ExceptionInfo *exception;
5474
5480
  MagickBooleanType okay;
5475
5481
 
5476
5482
  image = rm_check_destroyed(self);
5477
5483
  pf = StringValuePtr(passphrase); // ensure passphrase is a string
5478
- GetExceptionInfo(&exception);
5484
+ exception = AcquireExceptionInfo();
5479
5485
 
5480
5486
  new_image = rm_clone_image(image);
5481
5487
 
5482
- okay = EncipherImage(new_image, pf, &exception);
5483
- rm_check_exception(&exception, new_image, DestroyOnError);
5488
+ okay = EncipherImage(new_image, pf, exception);
5489
+ rm_check_exception(exception, new_image, DestroyOnError);
5484
5490
  if (!okay)
5485
5491
  {
5486
5492
  new_image = DestroyImage(new_image);
5487
5493
  rb_raise(rb_eRuntimeError, "EncipherImage failed for unknown reason.");
5488
5494
  }
5489
5495
 
5490
- DestroyExceptionInfo(&exception);
5496
+ DestroyExceptionInfo(exception);
5491
5497
 
5492
5498
  return rm_image_new(new_image);
5493
5499
  #else
@@ -5548,15 +5554,15 @@ VALUE
5548
5554
  Image_enhance(VALUE self)
5549
5555
  {
5550
5556
  Image *image, *new_image;
5551
- ExceptionInfo exception;
5557
+ ExceptionInfo *exception;
5552
5558
 
5553
5559
  image = rm_check_destroyed(self);
5554
- GetExceptionInfo(&exception);
5560
+ exception = AcquireExceptionInfo();
5555
5561
 
5556
- new_image = EnhanceImage(image, &exception);
5557
- rm_check_exception(&exception, new_image, DestroyOnError);
5562
+ new_image = EnhanceImage(image, exception);
5563
+ rm_check_exception(exception, new_image, DestroyOnError);
5558
5564
 
5559
- (void) DestroyExceptionInfo(&exception);
5565
+ (void) DestroyExceptionInfo(exception);
5560
5566
 
5561
5567
  rm_ensure_result(new_image);
5562
5568
 
@@ -5577,16 +5583,16 @@ VALUE
5577
5583
  Image_equalize(VALUE self)
5578
5584
  {
5579
5585
  Image *image, *new_image;
5580
- ExceptionInfo exception;
5586
+ ExceptionInfo *exception;
5581
5587
 
5582
5588
  image = rm_check_destroyed(self);
5583
- GetExceptionInfo(&exception);
5589
+ exception = AcquireExceptionInfo();
5584
5590
  new_image = rm_clone_image(image);
5585
5591
 
5586
5592
  (void) EqualizeImage(new_image);
5587
5593
  rm_check_image_exception(new_image, DestroyOnError);
5588
5594
 
5589
- (void) DestroyExceptionInfo(&exception);
5595
+ (void) DestroyExceptionInfo(exception);
5590
5596
 
5591
5597
  return rm_image_new(new_image);
5592
5598
  }
@@ -5613,7 +5619,7 @@ Image_equalize_channel(int argc, VALUE *argv, VALUE self)
5613
5619
  {
5614
5620
  #if defined(HAVE_EQUALIZEIMAGECHANNEL)
5615
5621
  Image *image, *new_image;
5616
- ExceptionInfo exception;
5622
+ ExceptionInfo *exception;
5617
5623
  ChannelType channels;
5618
5624
 
5619
5625
  image = rm_check_destroyed(self);
@@ -5625,12 +5631,12 @@ Image_equalize_channel(int argc, VALUE *argv, VALUE self)
5625
5631
 
5626
5632
  new_image = rm_clone_image(image);
5627
5633
 
5628
- GetExceptionInfo(&exception);
5634
+ exception = AcquireExceptionInfo();
5629
5635
 
5630
5636
  (void) EqualizeImageChannel(new_image, channels);
5631
5637
 
5632
5638
  rm_check_image_exception(new_image, DestroyOnError);
5633
- (void) DestroyExceptionInfo(&exception);
5639
+ (void) DestroyExceptionInfo(exception);
5634
5640
 
5635
5641
  return rm_image_new(new_image);
5636
5642
  #else
@@ -5693,7 +5699,7 @@ excerpt(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
5693
5699
  {
5694
5700
  Image *image, *new_image;
5695
5701
  RectangleInfo rect;
5696
- ExceptionInfo exception;
5702
+ ExceptionInfo *exception;
5697
5703
 
5698
5704
  memset(&rect,'\0', sizeof(rect));
5699
5705
  rect.x = NUM2LONG(x);
@@ -5703,10 +5709,10 @@ excerpt(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
5703
5709
 
5704
5710
  Data_Get_Struct(self, Image, image);
5705
5711
 
5706
- GetExceptionInfo(&exception);
5707
- new_image = ExcerptImage(image, &rect, &exception);
5708
- rm_check_exception(&exception, new_image, DestroyOnError);
5709
- DestroyExceptionInfo(&exception);
5712
+ exception = AcquireExceptionInfo();
5713
+ new_image = ExcerptImage(image, &rect, exception);
5714
+ rm_check_exception(exception, new_image, DestroyOnError);
5715
+ DestroyExceptionInfo(exception);
5710
5716
  rm_ensure_result(new_image);
5711
5717
 
5712
5718
  if (bang)
@@ -5804,7 +5810,7 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self)
5804
5810
  const char *map = "RGB";
5805
5811
  Quantum *pixels;
5806
5812
  volatile VALUE ary;
5807
- ExceptionInfo exception;
5813
+ ExceptionInfo *exception;
5808
5814
 
5809
5815
 
5810
5816
  image = rm_check_destroyed(self);
@@ -5845,9 +5851,9 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self)
5845
5851
  return rb_ary_new2(0L);
5846
5852
  }
5847
5853
 
5848
- GetExceptionInfo(&exception);
5854
+ exception = AcquireExceptionInfo();
5849
5855
 
5850
- okay = ExportImagePixels(image, x_off, y_off, cols, rows, map, QuantumPixel, (void *)pixels, &exception);
5856
+ okay = ExportImagePixels(image, x_off, y_off, cols, rows, map, QuantumPixel, (void *)pixels, exception);
5851
5857
  if (!okay)
5852
5858
  {
5853
5859
  xfree((void *)pixels);
@@ -5857,7 +5863,7 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self)
5857
5863
  rm_magick_error("ExportImagePixels failed with no explanation.", NULL);
5858
5864
  }
5859
5865
 
5860
- (void) DestroyExceptionInfo(&exception);
5866
+ (void) DestroyExceptionInfo(exception);
5861
5867
 
5862
5868
  ary = rb_ary_new2(npixels);
5863
5869
  for (n = 0; n < npixels; n++)
@@ -5894,7 +5900,7 @@ Image_extent(int argc, VALUE *argv, VALUE self)
5894
5900
  Image *image, *new_image;
5895
5901
  RectangleInfo geometry;
5896
5902
  long height, width;
5897
- ExceptionInfo exception;
5903
+ ExceptionInfo *exception;
5898
5904
 
5899
5905
  (void) rm_check_destroyed(self);
5900
5906
 
@@ -5932,11 +5938,11 @@ Image_extent(int argc, VALUE *argv, VALUE self)
5932
5938
 
5933
5939
 
5934
5940
  Data_Get_Struct(self, Image, image);
5935
- GetExceptionInfo(&exception);
5941
+ exception = AcquireExceptionInfo();
5936
5942
 
5937
- new_image = ExtentImage(image, &geometry, &exception);
5938
- rm_check_exception(&exception, new_image, DestroyOnError);
5939
- (void) DestroyExceptionInfo(&exception);
5943
+ new_image = ExtentImage(image, &geometry, exception);
5944
+ rm_check_exception(exception, new_image, DestroyOnError);
5945
+ (void) DestroyExceptionInfo(exception);
5940
5946
  rm_ensure_result(new_image);
5941
5947
  return rm_image_new(new_image);
5942
5948
  }
@@ -5980,7 +5986,7 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
5980
5986
  StorageType type = CharPixel;
5981
5987
  volatile VALUE string;
5982
5988
  char *str;
5983
- ExceptionInfo exception;
5989
+ ExceptionInfo *exception;
5984
5990
 
5985
5991
  image = rm_check_destroyed(self);
5986
5992
  cols = image->columns;
@@ -6051,9 +6057,9 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
6051
6057
  (void) rb_str_resize(string, (long)(sz * npixels));
6052
6058
  str = StringValuePtr(string);
6053
6059
 
6054
- GetExceptionInfo(&exception);
6060
+ exception = AcquireExceptionInfo();
6055
6061
 
6056
- okay = ExportImagePixels(image, x_off, y_off, cols, rows, map, type, (void *)str, &exception);
6062
+ okay = ExportImagePixels(image, x_off, y_off, cols, rows, map, type, (void *)str, exception);
6057
6063
  if (!okay)
6058
6064
  {
6059
6065
  // Let GC have the string buffer.
@@ -6064,7 +6070,7 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
6064
6070
  rm_magick_error("ExportImagePixels failed with no explanation.", NULL);
6065
6071
  }
6066
6072
 
6067
- (void) DestroyExceptionInfo(&exception);
6073
+ (void) DestroyExceptionInfo(exception);
6068
6074
 
6069
6075
  return string;
6070
6076
  }
@@ -6192,8 +6198,8 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self)
6192
6198
  {
6193
6199
  Image *image, *target;
6194
6200
  volatile VALUE region, targ;
6195
- long x = 0L, y = 0L;
6196
- ExceptionInfo exception;
6201
+ ssize_t x = 0L, y = 0L;
6202
+ ExceptionInfo *exception;
6197
6203
  unsigned int okay;
6198
6204
 
6199
6205
  image = rm_check_destroyed(self);
@@ -6213,10 +6219,10 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self)
6213
6219
  break;
6214
6220
  }
6215
6221
 
6216
- GetExceptionInfo(&exception);
6217
- okay = IsImageSimilar(image, target, &x, &y, &exception);
6222
+ exception = AcquireExceptionInfo();
6223
+ okay = IsImageSimilar(image, target, &x, &y, exception);
6218
6224
  CHECK_EXCEPTION();
6219
- (void) DestroyExceptionInfo(&exception);
6225
+ (void) DestroyExceptionInfo(exception);
6220
6226
 
6221
6227
  if (!okay)
6222
6228
  {
@@ -6249,15 +6255,15 @@ static VALUE
6249
6255
  flipflop(int bang, VALUE self, flipper_t flipflopper)
6250
6256
  {
6251
6257
  Image *image, *new_image;
6252
- ExceptionInfo exception;
6258
+ ExceptionInfo *exception;
6253
6259
 
6254
6260
  Data_Get_Struct(self, Image, image);
6255
- GetExceptionInfo(&exception);
6261
+ exception = AcquireExceptionInfo();
6256
6262
 
6257
- new_image = (flipflopper)(image, &exception);
6258
- rm_check_exception(&exception, new_image, DestroyOnError);
6263
+ new_image = (flipflopper)(image, exception);
6264
+ rm_check_exception(exception, new_image, DestroyOnError);
6259
6265
 
6260
- (void) DestroyExceptionInfo(&exception);
6266
+ (void) DestroyExceptionInfo(exception);
6261
6267
 
6262
6268
  rm_ensure_result(new_image);
6263
6269
 
@@ -6377,16 +6383,16 @@ Image_format(VALUE self)
6377
6383
  {
6378
6384
  Image *image;
6379
6385
  const MagickInfo *magick_info;
6380
- ExceptionInfo exception;
6386
+ ExceptionInfo *exception;
6381
6387
 
6382
6388
  image = rm_check_destroyed(self);
6383
6389
 
6384
6390
  if (*image->magick)
6385
6391
  {
6386
6392
  // Deliberately ignore the exception info!
6387
- GetExceptionInfo(&exception);
6388
- magick_info = GetMagickInfo(image->magick, &exception);
6389
- (void) DestroyExceptionInfo(&exception);
6393
+ exception = AcquireExceptionInfo();
6394
+ magick_info = GetMagickInfo(image->magick, exception);
6395
+ (void) DestroyExceptionInfo(exception);
6390
6396
  return magick_info ? rb_str_new2(magick_info->name) : Qnil;
6391
6397
  }
6392
6398
 
@@ -6410,17 +6416,17 @@ Image_format_eq(VALUE self, VALUE magick)
6410
6416
  Image *image;
6411
6417
  const MagickInfo *m;
6412
6418
  char *mgk;
6413
- ExceptionInfo exception;
6419
+ ExceptionInfo *exception;
6414
6420
 
6415
6421
  image = rm_check_frozen(self);
6416
6422
 
6417
- GetExceptionInfo(&exception);
6423
+ exception = AcquireExceptionInfo();
6418
6424
 
6419
6425
  mgk = StringValuePtr(magick);
6420
- m = GetMagickInfo(mgk, &exception);
6426
+ m = GetMagickInfo(mgk, exception);
6421
6427
  CHECK_EXCEPTION()
6422
6428
 
6423
- (void) DestroyExceptionInfo(&exception);
6429
+ (void) DestroyExceptionInfo(exception);
6424
6430
 
6425
6431
  if (!m)
6426
6432
  {
@@ -6473,7 +6479,7 @@ VALUE
6473
6479
  Image_frame(int argc, VALUE *argv, VALUE self)
6474
6480
  {
6475
6481
  Image *image, *new_image;
6476
- ExceptionInfo exception;
6482
+ ExceptionInfo *exception;
6477
6483
  FrameInfo frame_info;
6478
6484
 
6479
6485
  image = rm_check_destroyed(self);
@@ -6508,11 +6514,11 @@ Image_frame(int argc, VALUE *argv, VALUE self)
6508
6514
  break;
6509
6515
  }
6510
6516
 
6511
- GetExceptionInfo(&exception);
6512
- new_image = FrameImage(image, &frame_info, &exception);
6513
- rm_check_exception(&exception, new_image, DestroyOnError);
6517
+ exception = AcquireExceptionInfo();
6518
+ new_image = FrameImage(image, &frame_info, exception);
6519
+ rm_check_exception(exception, new_image, DestroyOnError);
6514
6520
 
6515
- (void) DestroyExceptionInfo(&exception);
6521
+ (void) DestroyExceptionInfo(exception);
6516
6522
 
6517
6523
  rm_ensure_result(new_image);
6518
6524
 
@@ -6536,7 +6542,7 @@ Image_from_blob(VALUE class, VALUE blob_arg)
6536
6542
  Image *images;
6537
6543
  Info *info;
6538
6544
  volatile VALUE info_obj;
6539
- ExceptionInfo exception;
6545
+ ExceptionInfo *exception;
6540
6546
  void *blob;
6541
6547
  long length;
6542
6548
 
@@ -6549,11 +6555,11 @@ Image_from_blob(VALUE class, VALUE blob_arg)
6549
6555
  info_obj = rm_info_new();
6550
6556
  Data_Get_Struct(info_obj, Info, info);
6551
6557
 
6552
- GetExceptionInfo(&exception);
6553
- images = BlobToImage(info, blob, (size_t)length, &exception);
6554
- rm_check_exception(&exception, images, DestroyOnError);
6558
+ exception = AcquireExceptionInfo();
6559
+ images = BlobToImage(info, blob, (size_t)length, exception);
6560
+ rm_check_exception(exception, images, DestroyOnError);
6555
6561
 
6556
- (void) DestroyExceptionInfo(&exception);
6562
+ (void) DestroyExceptionInfo(exception);
6557
6563
 
6558
6564
  rm_ensure_result(images);
6559
6565
  rm_set_user_artifact(images, info);
@@ -6588,7 +6594,7 @@ Image_function_channel(int argc, VALUE *argv, VALUE self)
6588
6594
  volatile double *parameters;
6589
6595
  double *parms;
6590
6596
  ChannelType channels;
6591
- ExceptionInfo exception;
6597
+ ExceptionInfo *exception;
6592
6598
 
6593
6599
  image = rm_check_destroyed(self);
6594
6600
  channels = extract_channels(&argc, argv);
@@ -6640,12 +6646,12 @@ Image_function_channel(int argc, VALUE *argv, VALUE self)
6640
6646
  parms[n] = NUM2DBL(argv[n]);
6641
6647
  }
6642
6648
 
6643
- GetExceptionInfo(&exception);
6649
+ exception = AcquireExceptionInfo();
6644
6650
  new_image = rm_clone_image(image);
6645
- (void) FunctionImageChannel(new_image, channels, function, nparms, parms, &exception);
6651
+ (void) FunctionImageChannel(new_image, channels, function, nparms, parms, exception);
6646
6652
  (void) xfree(parms);
6647
- rm_check_exception(&exception, new_image, DestroyOnError);
6648
- DestroyExceptionInfo(&exception);
6653
+ rm_check_exception(exception, new_image, DestroyOnError);
6654
+ DestroyExceptionInfo(exception);
6649
6655
 
6650
6656
  return rm_image_new(new_image);
6651
6657
  #else
@@ -6852,7 +6858,7 @@ Image_gaussian_blur_channel(int argc, VALUE *argv, VALUE self)
6852
6858
  {
6853
6859
  Image *image, *new_image;
6854
6860
  ChannelType channels;
6855
- ExceptionInfo exception;
6861
+ ExceptionInfo *exception;
6856
6862
  double radius = 0.0, sigma = 1.0;
6857
6863
 
6858
6864
  image = rm_check_destroyed(self);
@@ -6873,11 +6879,11 @@ Image_gaussian_blur_channel(int argc, VALUE *argv, VALUE self)
6873
6879
  raise_ChannelType_error(argv[argc-1]);
6874
6880
  }
6875
6881
 
6876
- GetExceptionInfo(&exception);
6877
- new_image = GaussianBlurImageChannel(image, channels, radius, sigma, &exception);
6878
- rm_check_exception(&exception, new_image, DestroyOnError);
6882
+ exception = AcquireExceptionInfo();
6883
+ new_image = GaussianBlurImageChannel(image, channels, radius, sigma, exception);
6884
+ rm_check_exception(exception, new_image, DestroyOnError);
6879
6885
 
6880
- (void) DestroyExceptionInfo(&exception);
6886
+ (void) DestroyExceptionInfo(exception);
6881
6887
 
6882
6888
  return rm_image_new(new_image);
6883
6889
  }
@@ -6960,7 +6966,7 @@ Image_get_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, VALUE row
6960
6966
  {
6961
6967
  Image *image;
6962
6968
  const PixelPacket *pixels;
6963
- ExceptionInfo exception;
6969
+ ExceptionInfo *exception;
6964
6970
  long x, y;
6965
6971
  unsigned long columns, rows;
6966
6972
  long size, n;
@@ -6980,15 +6986,15 @@ Image_get_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, VALUE row
6980
6986
 
6981
6987
  // Cast AcquireImagePixels to get rid of the const qualifier. We're not going
6982
6988
  // to change the pixels but I don't want to make "pixels" const.
6983
- GetExceptionInfo(&exception);
6989
+ exception = AcquireExceptionInfo();
6984
6990
  #if defined(HAVE_GETVIRTUALPIXELS)
6985
- pixels = GetVirtualPixels(image, x, y, columns, rows, &exception);
6991
+ pixels = GetVirtualPixels(image, x, y, columns, rows, exception);
6986
6992
  #else
6987
- pixels = AcquireImagePixels(image, x, y, columns, rows, &exception);
6993
+ pixels = AcquireImagePixels(image, x, y, columns, rows, exception);
6988
6994
  #endif
6989
6995
  CHECK_EXCEPTION()
6990
6996
 
6991
- (void) DestroyExceptionInfo(&exception);
6997
+ (void) DestroyExceptionInfo(exception);
6992
6998
 
6993
6999
  // If the function failed, return a 0-length array.
6994
7000
  if (!pixels)
@@ -7023,13 +7029,13 @@ static VALUE
7023
7029
  has_attribute(VALUE self, MagickBooleanType (attr_test)(const Image *, ExceptionInfo *))
7024
7030
  {
7025
7031
  Image *image;
7026
- ExceptionInfo exception;
7032
+ ExceptionInfo *exception;
7027
7033
  MagickBooleanType r;
7028
7034
 
7029
7035
  image = rm_check_destroyed(self);
7030
- GetExceptionInfo(&exception);
7036
+ exception = AcquireExceptionInfo();
7031
7037
 
7032
- r = (attr_test)(image, &exception);
7038
+ r = (attr_test)(image, exception);
7033
7039
  CHECK_EXCEPTION()
7034
7040
 
7035
7041
  return r ? Qtrue : Qfalse;
@@ -7091,7 +7097,7 @@ Image_implode(int argc, VALUE *argv, VALUE self)
7091
7097
  {
7092
7098
  Image *image, *new_image;
7093
7099
  double amount = 0.50;
7094
- ExceptionInfo exception;
7100
+ ExceptionInfo *exception;
7095
7101
 
7096
7102
  switch (argc)
7097
7103
  {
@@ -7104,11 +7110,11 @@ Image_implode(int argc, VALUE *argv, VALUE self)
7104
7110
  }
7105
7111
 
7106
7112
  image = rm_check_destroyed(self);
7107
- GetExceptionInfo(&exception);
7113
+ exception = AcquireExceptionInfo();
7108
7114
 
7109
- new_image = ImplodeImage(image, amount, &exception);
7110
- rm_check_exception(&exception, new_image, DestroyOnError);
7111
- (void) DestroyExceptionInfo(&exception);
7115
+ new_image = ImplodeImage(image, amount, exception);
7116
+ rm_check_exception(exception, new_image, DestroyOnError);
7117
+ (void) DestroyExceptionInfo(exception);
7112
7118
 
7113
7119
  rm_ensure_result(new_image);
7114
7120
 
@@ -7708,7 +7714,7 @@ Image_level_colors(int argc, VALUE *argv, VALUE self)
7708
7714
  Image *image, *new_image;
7709
7715
  MagickPixelPacket black_color, white_color;
7710
7716
  ChannelType channels;
7711
- ExceptionInfo exception;
7717
+ ExceptionInfo *exception;
7712
7718
  MagickBooleanType invert = MagickTrue;
7713
7719
  MagickBooleanType status;
7714
7720
 
@@ -7728,26 +7734,26 @@ Image_level_colors(int argc, VALUE *argv, VALUE self)
7728
7734
 
7729
7735
  case 1:
7730
7736
  Color_to_MagickPixelPacket(image, &black_color, argv[0]);
7731
- GetExceptionInfo(&exception);
7737
+ exception = AcquireExceptionInfo();
7732
7738
 
7733
7739
  GetMagickPixelPacket(image, &white_color);
7734
- (void) QueryMagickColor("white", &white_color, &exception);
7740
+ (void) QueryMagickColor("white", &white_color, exception);
7735
7741
  CHECK_EXCEPTION()
7736
7742
 
7737
- DestroyExceptionInfo(&exception);
7743
+ DestroyExceptionInfo(exception);
7738
7744
 
7739
7745
  case 0:
7740
- GetExceptionInfo(&exception);
7746
+ exception = AcquireExceptionInfo();
7741
7747
 
7742
7748
  GetMagickPixelPacket(image, &white_color);
7743
- (void) QueryMagickColor("white", &white_color, &exception);
7749
+ (void) QueryMagickColor("white", &white_color, exception);
7744
7750
  CHECK_EXCEPTION()
7745
7751
 
7746
7752
  GetMagickPixelPacket(image, &black_color);
7747
- (void) QueryMagickColor("black", &black_color, &exception);
7753
+ (void) QueryMagickColor("black", &black_color, exception);
7748
7754
  CHECK_EXCEPTION()
7749
7755
 
7750
- DestroyExceptionInfo(&exception);
7756
+ DestroyExceptionInfo(exception);
7751
7757
  break;
7752
7758
 
7753
7759
  default:
@@ -7913,7 +7919,7 @@ Image_liquid_rescale(int argc, VALUE *argv, VALUE self)
7913
7919
  unsigned long cols, rows;
7914
7920
  double delta_x = 0.0;
7915
7921
  double rigidity = 0.0;
7916
- ExceptionInfo exception;
7922
+ ExceptionInfo *exception;
7917
7923
 
7918
7924
  image = rm_check_destroyed(self);
7919
7925
 
@@ -7932,10 +7938,10 @@ Image_liquid_rescale(int argc, VALUE *argv, VALUE self)
7932
7938
  break;
7933
7939
  }
7934
7940
 
7935
- GetExceptionInfo(&exception);
7936
- new_image = LiquidRescaleImage(image, cols, rows, delta_x, rigidity, &exception);
7937
- rm_check_exception(&exception, new_image, DestroyOnError);
7938
- DestroyExceptionInfo(&exception);
7941
+ exception = AcquireExceptionInfo();
7942
+ new_image = LiquidRescaleImage(image, cols, rows, delta_x, rigidity, exception);
7943
+ rm_check_exception(exception, new_image, DestroyOnError);
7944
+ DestroyExceptionInfo(exception);
7939
7945
  rm_ensure_result(new_image);
7940
7946
 
7941
7947
  return rm_image_new(new_image);
@@ -7969,7 +7975,7 @@ Image__load(VALUE class, VALUE str)
7969
7975
  Image *image;
7970
7976
  ImageInfo *info;
7971
7977
  DumpedImage mi;
7972
- ExceptionInfo exception;
7978
+ ExceptionInfo *exception;
7973
7979
  char *blob;
7974
7980
  long length;
7975
7981
 
@@ -8014,16 +8020,16 @@ Image__load(VALUE class, VALUE str)
8014
8020
  memcpy(info->magick, ((DumpedImage *)blob)->magick, mi.len);
8015
8021
  info->magick[mi.len] = '\0';
8016
8022
 
8017
- GetExceptionInfo(&exception);
8023
+ exception = AcquireExceptionInfo();
8018
8024
 
8019
8025
  blob += offsetof(DumpedImage,magick) + mi.len;
8020
8026
  length -= offsetof(DumpedImage,magick) + mi.len;
8021
- image = BlobToImage(info, blob, (size_t) length, &exception);
8027
+ image = BlobToImage(info, blob, (size_t) length, exception);
8022
8028
  (void) DestroyImageInfo(info);
8023
8029
 
8024
- rm_check_exception(&exception, image, DestroyOnError);
8030
+ rm_check_exception(exception, image, DestroyOnError);
8025
8031
 
8026
- (void) DestroyExceptionInfo(&exception);
8032
+ (void) DestroyExceptionInfo(exception);
8027
8033
 
8028
8034
  rm_ensure_result(image);
8029
8035
 
@@ -8046,15 +8052,15 @@ magnify(int bang, VALUE self, magnifier_t magnifier)
8046
8052
  {
8047
8053
  Image *image;
8048
8054
  Image *new_image;
8049
- ExceptionInfo exception;
8055
+ ExceptionInfo *exception;
8050
8056
 
8051
8057
  Data_Get_Struct(self, Image, image);
8052
- GetExceptionInfo(&exception);
8058
+ exception = AcquireExceptionInfo();
8053
8059
 
8054
- new_image = (magnifier)(image, &exception);
8055
- rm_check_exception(&exception, new_image, DestroyOnError);
8060
+ new_image = (magnifier)(image, exception);
8061
+ rm_check_exception(exception, new_image, DestroyOnError);
8056
8062
 
8057
- (void) DestroyExceptionInfo(&exception);
8063
+ (void) DestroyExceptionInfo(exception);
8058
8064
 
8059
8065
  rm_ensure_result(new_image);
8060
8066
 
@@ -8130,12 +8136,13 @@ Image_map(int argc, VALUE *argv, VALUE self)
8130
8136
  volatile VALUE map_obj, map_arg;
8131
8137
  unsigned int dither = MagickFalse;
8132
8138
 
8133
- image = rm_check_destroyed(self);
8134
-
8135
8139
  #if defined(HAVE_REMAPIMAGE)
8140
+ QuantizeInfo quantize_info;
8136
8141
  rb_warning("Image#map is deprecated. Use Image#remap instead");
8137
8142
  #endif
8138
8143
 
8144
+ image = rm_check_destroyed(self);
8145
+
8139
8146
  switch (argc)
8140
8147
  {
8141
8148
  case 2:
@@ -8152,7 +8159,13 @@ Image_map(int argc, VALUE *argv, VALUE self)
8152
8159
 
8153
8160
  map_obj = rm_cur_image(map_arg);
8154
8161
  map = rm_check_destroyed(map_obj);
8162
+ #if defined(HAVE_REMAPIMAGE)
8163
+ GetQuantizeInfo(&quantize_info);
8164
+ quantize_info.dither=dither;
8165
+ (void) RemapImage(&quantize_info, new_image, map);
8166
+ #else
8155
8167
  (void) MapImage(new_image, map, dither);
8168
+ #endif
8156
8169
  rm_check_image_exception(new_image, DestroyOnError);
8157
8170
 
8158
8171
  return rm_image_new(new_image);
@@ -8176,7 +8189,7 @@ Image_marshal_dump(VALUE self)
8176
8189
  unsigned char *blob;
8177
8190
  size_t length;
8178
8191
  VALUE ary;
8179
- ExceptionInfo exception;
8192
+ ExceptionInfo *exception;
8180
8193
 
8181
8194
  image = rm_check_destroyed(self);
8182
8195
 
@@ -8196,13 +8209,13 @@ Image_marshal_dump(VALUE self)
8196
8209
  rb_ary_store(ary, 0, Qnil);
8197
8210
  }
8198
8211
 
8199
- GetExceptionInfo(&exception);
8200
- blob = ImageToBlob(info, image, &length, &exception);
8212
+ exception = AcquireExceptionInfo();
8213
+ blob = ImageToBlob(info, image, &length, exception);
8201
8214
 
8202
8215
  // Destroy info before raising an exception
8203
8216
  DestroyImageInfo(info);
8204
8217
  CHECK_EXCEPTION()
8205
- (void) DestroyExceptionInfo(&exception);
8218
+ (void) DestroyExceptionInfo(exception);
8206
8219
 
8207
8220
  rb_ary_store(ary, 1, rb_str_new((char *)blob, (long)length));
8208
8221
  magick_free((void*)blob);
@@ -8227,7 +8240,7 @@ Image_marshal_load(VALUE self, VALUE ary)
8227
8240
  VALUE blob, filename;
8228
8241
  Info *info;
8229
8242
  Image *image;
8230
- ExceptionInfo exception;
8243
+ ExceptionInfo *exception;
8231
8244
 
8232
8245
  info = CloneImageInfo(NULL);
8233
8246
  if (!info)
@@ -8238,17 +8251,17 @@ Image_marshal_load(VALUE self, VALUE ary)
8238
8251
  filename = rb_ary_shift(ary);
8239
8252
  blob = rb_ary_shift(ary);
8240
8253
 
8241
- GetExceptionInfo(&exception);
8254
+ exception = AcquireExceptionInfo();
8242
8255
  if (filename != Qnil)
8243
8256
  {
8244
8257
  strcpy(info->filename, RSTRING_PTR(filename));
8245
8258
  }
8246
- image = BlobToImage(info, RSTRING_PTR(blob), RSTRING_LEN(blob), &exception);
8259
+ image = BlobToImage(info, RSTRING_PTR(blob), RSTRING_LEN(blob), exception);
8247
8260
 
8248
8261
  // Destroy info before raising an exception
8249
8262
  DestroyImageInfo(info);
8250
8263
  CHECK_EXCEPTION();
8251
- (void) DestroyExceptionInfo(&exception);
8264
+ (void) DestroyExceptionInfo(exception);
8252
8265
 
8253
8266
  UPDATE_DATA_PTR(self, image);
8254
8267
 
@@ -8271,15 +8284,15 @@ static VALUE
8271
8284
  get_image_mask(Image *image)
8272
8285
  {
8273
8286
  Image *mask;
8274
- ExceptionInfo exception;
8287
+ ExceptionInfo *exception;
8275
8288
 
8276
- GetExceptionInfo(&exception);
8289
+ exception = AcquireExceptionInfo();
8277
8290
 
8278
8291
  // The returned clip mask is a clone, ours to keep.
8279
- mask = GetImageClipMask(image, &exception);
8280
- rm_check_exception(&exception, mask, DestroyOnError);
8292
+ mask = GetImageClipMask(image, exception);
8293
+ rm_check_exception(exception, mask, DestroyOnError);
8281
8294
 
8282
- (void) DestroyExceptionInfo(&exception);
8295
+ (void) DestroyExceptionInfo(exception);
8283
8296
 
8284
8297
  return mask ? rm_image_new(mask) : Qnil;
8285
8298
  }
@@ -8335,7 +8348,7 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8335
8348
  Image *clip_mask;
8336
8349
  long x, y;
8337
8350
  PixelPacket *q;
8338
- ExceptionInfo exception;
8351
+ ExceptionInfo *exception;
8339
8352
 
8340
8353
  image = rm_check_destroyed(self);
8341
8354
  if (argc == 0)
@@ -8359,11 +8372,11 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8359
8372
  // Resize if necessary
8360
8373
  if (clip_mask->columns != image->columns || clip_mask->rows != image->rows)
8361
8374
  {
8362
- GetExceptionInfo(&exception);
8375
+ exception = AcquireExceptionInfo();
8363
8376
  resized_image = ResizeImage(clip_mask, image->columns, image->rows
8364
- , UndefinedFilter, 0.0, &exception);
8365
- rm_check_exception(&exception, resized_image, DestroyOnError);
8366
- (void) DestroyExceptionInfo(&exception);
8377
+ , UndefinedFilter, 0.0, exception);
8378
+ rm_check_exception(exception, resized_image, DestroyOnError);
8379
+ (void) DestroyExceptionInfo(exception);
8367
8380
  rm_ensure_result(resized_image);
8368
8381
  (void) DestroyImage(clip_mask);
8369
8382
  clip_mask = resized_image;
@@ -8371,13 +8384,13 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8371
8384
 
8372
8385
  // The following section is copied from mogrify.c (6.2.8-8)
8373
8386
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
8374
- GetExceptionInfo(&exception);
8387
+ exception = AcquireExceptionInfo();
8375
8388
  #endif
8376
8389
  for (y = 0; y < (long) clip_mask->rows; y++)
8377
8390
  {
8378
8391
  #if defined(HAVE_GETAUTHENTICPIXELS)
8379
- q = GetAuthenticPixels(clip_mask, 0, y, clip_mask->columns, 1, &exception);
8380
- rm_check_exception(&exception, clip_mask, DestroyOnError);
8392
+ q = GetAuthenticPixels(clip_mask, 0, y, clip_mask->columns, 1, exception);
8393
+ rm_check_exception(exception, clip_mask, DestroyOnError);
8381
8394
  #else
8382
8395
  q = GetImagePixels(clip_mask, 0, y, clip_mask->columns, 1);
8383
8396
  rm_check_image_exception(clip_mask, DestroyOnError);
@@ -8399,15 +8412,15 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8399
8412
  }
8400
8413
 
8401
8414
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
8402
- SyncAuthenticPixels(clip_mask, &exception);
8403
- rm_check_exception(&exception, clip_mask, DestroyOnError);
8415
+ SyncAuthenticPixels(clip_mask, exception);
8416
+ rm_check_exception(exception, clip_mask, DestroyOnError);
8404
8417
  #else
8405
8418
  SyncImagePixels(clip_mask);
8406
8419
  rm_check_image_exception(clip_mask, DestroyOnError);
8407
8420
  #endif
8408
8421
  }
8409
8422
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
8410
- (void) DestroyExceptionInfo(&exception);
8423
+ (void) DestroyExceptionInfo(exception);
8411
8424
  #endif
8412
8425
 
8413
8426
  SetImageStorageClass(clip_mask, DirectClass);
@@ -8632,7 +8645,7 @@ Image_median_filter(int argc, VALUE *argv, VALUE self)
8632
8645
  {
8633
8646
  Image *image, *new_image;
8634
8647
  double radius = 0.0;
8635
- ExceptionInfo exception;
8648
+ ExceptionInfo *exception;
8636
8649
 
8637
8650
  image = rm_check_destroyed(self);
8638
8651
  switch (argc)
@@ -8646,12 +8659,15 @@ Image_median_filter(int argc, VALUE *argv, VALUE self)
8646
8659
  break;
8647
8660
  }
8648
8661
 
8649
- GetExceptionInfo(&exception);
8650
-
8651
- new_image = MedianFilterImage(image, radius, &exception);
8652
- rm_check_exception(&exception, new_image, DestroyOnError);
8662
+ exception = AcquireExceptionInfo();
8663
+ #if defined(HAVE_STATISTICIMAGE)
8664
+ new_image = StatisticImage(image, MedianStatistic, (size_t)radius, (size_t)radius, exception);
8665
+ #else
8666
+ new_image = MedianFilterImage(image, radius, exception);
8667
+ #endif
8668
+ rm_check_exception(exception, new_image, DestroyOnError);
8653
8669
 
8654
- (void) DestroyExceptionInfo(&exception);
8670
+ (void) DestroyExceptionInfo(exception);
8655
8671
 
8656
8672
  rm_ensure_result(new_image);
8657
8673
 
@@ -8885,7 +8901,7 @@ motion_blur(int argc, VALUE *argv, VALUE self
8885
8901
  double radius = 0.0;
8886
8902
  double sigma = 1.0;
8887
8903
  double angle = 0.0;
8888
- ExceptionInfo exception;
8904
+ ExceptionInfo *exception;
8889
8905
 
8890
8906
  switch (argc)
8891
8907
  {
@@ -8909,11 +8925,11 @@ motion_blur(int argc, VALUE *argv, VALUE self
8909
8925
 
8910
8926
  Data_Get_Struct(self, Image, image);
8911
8927
 
8912
- GetExceptionInfo(&exception);
8913
- new_image = (fp)(image, radius, sigma, angle, &exception);
8914
- rm_check_exception(&exception, new_image, DestroyOnError);
8928
+ exception = AcquireExceptionInfo();
8929
+ new_image = (fp)(image, radius, sigma, angle, exception);
8930
+ rm_check_exception(exception, new_image, DestroyOnError);
8915
8931
 
8916
- (void) DestroyExceptionInfo(&exception);
8932
+ (void) DestroyExceptionInfo(exception);
8917
8933
 
8918
8934
  rm_ensure_result(new_image);
8919
8935
 
@@ -9263,16 +9279,16 @@ VALUE
9263
9279
  Image_number_colors(VALUE self)
9264
9280
  {
9265
9281
  Image *image;
9266
- ExceptionInfo exception;
9282
+ ExceptionInfo *exception;
9267
9283
  unsigned long n = 0;
9268
9284
 
9269
9285
  image = rm_check_destroyed(self);
9270
- GetExceptionInfo(&exception);
9286
+ exception = AcquireExceptionInfo();
9271
9287
 
9272
- n = (unsigned long) GetNumberColors(image, NULL, &exception);
9288
+ n = (unsigned long) GetNumberColors(image, NULL, exception);
9273
9289
  CHECK_EXCEPTION()
9274
9290
 
9275
- (void) DestroyExceptionInfo(&exception);
9291
+ (void) DestroyExceptionInfo(exception);
9276
9292
 
9277
9293
  return ULONG2NUM(n);
9278
9294
  }
@@ -9301,7 +9317,7 @@ Image_oil_paint(int argc, VALUE *argv, VALUE self)
9301
9317
  {
9302
9318
  Image *image, *new_image;
9303
9319
  double radius = 3.0;
9304
- ExceptionInfo exception;
9320
+ ExceptionInfo *exception;
9305
9321
 
9306
9322
  image = rm_check_destroyed(self);
9307
9323
  switch (argc)
@@ -9315,12 +9331,12 @@ Image_oil_paint(int argc, VALUE *argv, VALUE self)
9315
9331
  break;
9316
9332
  }
9317
9333
 
9318
- GetExceptionInfo(&exception);
9334
+ exception = AcquireExceptionInfo();
9319
9335
 
9320
- new_image = OilPaintImage(image, radius, &exception);
9321
- rm_check_exception(&exception, new_image, DestroyOnError);
9336
+ new_image = OilPaintImage(image, radius, exception);
9337
+ rm_check_exception(exception, new_image, DestroyOnError);
9322
9338
 
9323
- (void) DestroyExceptionInfo(&exception);
9339
+ (void) DestroyExceptionInfo(exception);
9324
9340
 
9325
9341
  rm_ensure_result(new_image);
9326
9342
 
@@ -9512,7 +9528,7 @@ Image_ordered_dither(int argc, VALUE *argv, VALUE self)
9512
9528
  Image *image, *new_image;
9513
9529
  int order;
9514
9530
  const char *threshold_map = "2x2";
9515
- ExceptionInfo exception;
9531
+ ExceptionInfo *exception;
9516
9532
 
9517
9533
  image = rm_check_destroyed(self);
9518
9534
 
@@ -9546,13 +9562,13 @@ Image_ordered_dither(int argc, VALUE *argv, VALUE self)
9546
9562
 
9547
9563
  new_image = rm_clone_image(image);
9548
9564
 
9549
- GetExceptionInfo(&exception);
9565
+ exception = AcquireExceptionInfo();
9550
9566
 
9551
9567
  // ImageMagick >= 6.2.9
9552
- (void) OrderedPosterizeImage(new_image, threshold_map, &exception);
9553
- rm_check_exception(&exception, new_image, DestroyOnError);
9568
+ (void) OrderedPosterizeImage(new_image, threshold_map, exception);
9569
+ rm_check_exception(exception, new_image, DestroyOnError);
9554
9570
 
9555
- (void) DestroyExceptionInfo(&exception);
9571
+ (void) DestroyExceptionInfo(exception);
9556
9572
 
9557
9573
  return rm_image_new(new_image);
9558
9574
  }
@@ -9767,7 +9783,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9767
9783
  {
9768
9784
  Image *image;
9769
9785
  PixelPacket old_color, new_color, *pixel;
9770
- ExceptionInfo exception;
9786
+ ExceptionInfo *exception;
9771
9787
  long x, y;
9772
9788
  unsigned int set = False;
9773
9789
  MagickBooleanType okay;
@@ -9797,15 +9813,15 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9797
9813
  // Get the color of a pixel
9798
9814
  if (!set)
9799
9815
  {
9800
- GetExceptionInfo(&exception);
9816
+ exception = AcquireExceptionInfo();
9801
9817
  #if defined(HAVE_GETVIRTUALPIXELS)
9802
- old_color = *GetVirtualPixels(image, x, y, 1, 1, &exception);
9818
+ old_color = *GetVirtualPixels(image, x, y, 1, 1, exception);
9803
9819
  #else
9804
- old_color = *AcquireImagePixels(image, x, y, 1, 1, &exception);
9820
+ old_color = *AcquireImagePixels(image, x, y, 1, 1, exception);
9805
9821
  #endif
9806
9822
  CHECK_EXCEPTION()
9807
9823
 
9808
- (void) DestroyExceptionInfo(&exception);
9824
+ (void) DestroyExceptionInfo(exception);
9809
9825
 
9810
9826
  // PseudoClass
9811
9827
  if (image->storage_class == PseudoClass)
@@ -9815,7 +9831,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9815
9831
  #else
9816
9832
  IndexPacket *indexes = GetIndexes(image);
9817
9833
  #endif
9818
- old_color = image->colormap[*indexes];
9834
+ old_color = image->colormap[(unsigned long)*indexes];
9819
9835
  }
9820
9836
  if (!image->matte)
9821
9837
  {
@@ -9845,11 +9861,11 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9845
9861
 
9846
9862
 
9847
9863
  #if defined(HAVE_GETAUTHENTICPIXELS) || defined(HAVE_SYNCAUTHENTICPIXELS)
9848
- GetExceptionInfo(&exception);
9864
+ exception = AcquireExceptionInfo();
9849
9865
  #endif
9850
9866
 
9851
9867
  #if defined(HAVE_GETAUTHENTICPIXELS)
9852
- pixel = GetAuthenticPixels(image, x, y, 1, 1, &exception);
9868
+ pixel = GetAuthenticPixels(image, x, y, 1, 1, exception);
9853
9869
  CHECK_EXCEPTION()
9854
9870
  #else
9855
9871
  pixel = GetImagePixels(image, x, y, 1, 1);
@@ -9867,7 +9883,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9867
9883
  *pixel = new_color;
9868
9884
 
9869
9885
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
9870
- SyncAuthenticPixels(image, &exception);
9886
+ SyncAuthenticPixels(image, exception);
9871
9887
  CHECK_EXCEPTION()
9872
9888
  #else
9873
9889
  SyncImagePixels(image);
@@ -9875,7 +9891,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9875
9891
  #endif
9876
9892
 
9877
9893
  #if defined(HAVE_GETAUTHENTICPIXELS) || defined(HAVE_SYNCAUTHENTICPIXELS)
9878
- (void) DestroyExceptionInfo(&exception);
9894
+ (void) DestroyExceptionInfo(exception);
9879
9895
  #endif
9880
9896
 
9881
9897
  return Pixel_from_PixelPacket(&old_color);
@@ -9946,7 +9962,7 @@ Image_polaroid(int argc, VALUE *argv, VALUE self)
9946
9962
  volatile VALUE options;
9947
9963
  double angle = -5.0;
9948
9964
  Draw *draw;
9949
- ExceptionInfo exception;
9965
+ ExceptionInfo *exception;
9950
9966
 
9951
9967
  image = rm_check_destroyed(self);
9952
9968
 
@@ -9968,12 +9984,12 @@ Image_polaroid(int argc, VALUE *argv, VALUE self)
9968
9984
  clone->background_color = draw->shadow_color;
9969
9985
  clone->border_color = draw->info->border_color;
9970
9986
 
9971
- GetExceptionInfo(&exception);
9972
- new_image = PolaroidImage(clone, draw->info, angle, &exception);
9973
- rm_check_exception(&exception, clone, DestroyOnError);
9987
+ exception = AcquireExceptionInfo();
9988
+ new_image = PolaroidImage(clone, draw->info, angle, exception);
9989
+ rm_check_exception(exception, clone, DestroyOnError);
9974
9990
 
9975
9991
  (void) DestroyImage(clone);
9976
- (void) DestroyExceptionInfo(&exception);
9992
+ (void) DestroyExceptionInfo(exception);
9977
9993
 
9978
9994
  rm_ensure_result(new_image);
9979
9995
 
@@ -10042,16 +10058,16 @@ Image_preview(VALUE self, VALUE preview)
10042
10058
  {
10043
10059
  Image *image, *new_image;
10044
10060
  PreviewType preview_type;
10045
- ExceptionInfo exception;
10061
+ ExceptionInfo *exception;
10046
10062
 
10047
- GetExceptionInfo(&exception);
10063
+ exception = AcquireExceptionInfo();
10048
10064
  image = rm_check_destroyed(self);
10049
10065
  VALUE_TO_ENUM(preview, preview_type, PreviewType);
10050
10066
 
10051
- new_image = PreviewImage(image, preview_type, &exception);
10052
- rm_check_exception(&exception, new_image, DestroyOnError);
10067
+ new_image = PreviewImage(image, preview_type, exception);
10068
+ rm_check_exception(exception, new_image, DestroyOnError);
10053
10069
 
10054
- (void) DestroyExceptionInfo(&exception);
10070
+ (void) DestroyExceptionInfo(exception);
10055
10071
 
10056
10072
  rm_ensure_result(new_image);
10057
10073
 
@@ -10155,7 +10171,7 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self)
10155
10171
  MagickEvaluateOperator qop;
10156
10172
  double rvalue;
10157
10173
  ChannelType channel;
10158
- ExceptionInfo exception;
10174
+ ExceptionInfo *exception;
10159
10175
 
10160
10176
  image = rm_check_destroyed(self);
10161
10177
 
@@ -10293,11 +10309,11 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self)
10293
10309
  #endif
10294
10310
  }
10295
10311
 
10296
- GetExceptionInfo(&exception);
10297
- (void) EvaluateImageChannel(image, channel, qop, rvalue, &exception);
10312
+ exception = AcquireExceptionInfo();
10313
+ (void) EvaluateImageChannel(image, channel, qop, rvalue, exception);
10298
10314
  CHECK_EXCEPTION()
10299
10315
 
10300
- (void) DestroyExceptionInfo(&exception);
10316
+ (void) DestroyExceptionInfo(exception);
10301
10317
 
10302
10318
  return self;
10303
10319
  }
@@ -10385,15 +10401,19 @@ VALUE
10385
10401
  Image_radial_blur(VALUE self, VALUE angle)
10386
10402
  {
10387
10403
  Image *image, *new_image;
10388
- ExceptionInfo exception;
10404
+ ExceptionInfo *exception;
10389
10405
 
10390
10406
  image = rm_check_destroyed(self);
10391
- GetExceptionInfo(&exception);
10407
+ exception = AcquireExceptionInfo();
10392
10408
 
10393
- new_image = RadialBlurImage(image, NUM2DBL(angle), &exception);
10394
- rm_check_exception(&exception, new_image, DestroyOnError);
10409
+ #if defined(HAVE_ROTATIONALBLURIMAGE)
10410
+ new_image = RotationalBlurImage(image, NUM2DBL(angle), exception);
10411
+ #else
10412
+ new_image = RadialBlurImage(image, NUM2DBL(angle), exception);
10413
+ #endif
10414
+ rm_check_exception(exception, new_image, DestroyOnError);
10395
10415
 
10396
- (void) DestroyExceptionInfo(&exception);
10416
+ (void) DestroyExceptionInfo(exception);
10397
10417
 
10398
10418
  rm_ensure_result(new_image);
10399
10419
 
@@ -10422,7 +10442,7 @@ VALUE
10422
10442
  Image_radial_blur_channel(int argc, VALUE *argv, VALUE self)
10423
10443
  {
10424
10444
  Image *image, *new_image;
10425
- ExceptionInfo exception;
10445
+ ExceptionInfo *exception;
10426
10446
  ChannelType channels;
10427
10447
 
10428
10448
  image = rm_check_destroyed(self);
@@ -10438,12 +10458,15 @@ Image_radial_blur_channel(int argc, VALUE *argv, VALUE self)
10438
10458
  raise_ChannelType_error(argv[argc-1]);
10439
10459
  }
10440
10460
 
10441
- GetExceptionInfo(&exception);
10442
-
10443
- new_image = RadialBlurImageChannel(image, channels, NUM2DBL(argv[0]), &exception);
10461
+ exception = AcquireExceptionInfo();
10444
10462
 
10445
- rm_check_exception(&exception, new_image, DestroyOnError);
10446
- (void) DestroyExceptionInfo(&exception);
10463
+ #if defined(HAVE_ROTATIONALBLURIMAGECHANNEL)
10464
+ new_image = RotationalBlurImageChannel(image, channels, NUM2DBL(argv[0]), exception);
10465
+ #else
10466
+ new_image = RadialBlurImageChannel(image, channels, NUM2DBL(argv[0]), exception);
10467
+ #endif
10468
+ rm_check_exception(exception, new_image, DestroyOnError);
10469
+ (void) DestroyExceptionInfo(exception);
10447
10470
  rm_ensure_result(new_image);
10448
10471
 
10449
10472
  return rm_image_new(new_image);
@@ -10473,7 +10496,7 @@ Image_random_threshold_channel(int argc, VALUE *argv, VALUE self)
10473
10496
  ChannelType channels;
10474
10497
  char *thresholds;
10475
10498
  volatile VALUE geom_str;
10476
- ExceptionInfo exception;
10499
+ ExceptionInfo *exception;
10477
10500
 
10478
10501
  image = rm_check_destroyed(self);
10479
10502
 
@@ -10495,12 +10518,12 @@ Image_random_threshold_channel(int argc, VALUE *argv, VALUE self)
10495
10518
 
10496
10519
  new_image = rm_clone_image(image);
10497
10520
 
10498
- GetExceptionInfo(&exception);
10521
+ exception = AcquireExceptionInfo();
10499
10522
 
10500
- (void) RandomThresholdImageChannel(new_image, channels, thresholds, &exception);
10501
- rm_check_exception(&exception, new_image, DestroyOnError);
10523
+ (void) RandomThresholdImageChannel(new_image, channels, thresholds, exception);
10524
+ rm_check_exception(exception, new_image, DestroyOnError);
10502
10525
 
10503
- (void) DestroyExceptionInfo(&exception);
10526
+ (void) DestroyExceptionInfo(exception);
10504
10527
 
10505
10528
  return rm_image_new(new_image);
10506
10529
  }
@@ -10624,7 +10647,7 @@ rd_image(VALUE class, VALUE file, reader_t reader)
10624
10647
  Info *info;
10625
10648
  volatile VALUE info_obj;
10626
10649
  Image *images;
10627
- ExceptionInfo exception;
10650
+ ExceptionInfo *exception;
10628
10651
 
10629
10652
  class = class; // defeat gcc message
10630
10653
 
@@ -10653,12 +10676,12 @@ rd_image(VALUE class, VALUE file, reader_t reader)
10653
10676
  SetImageInfoFile(info, NULL);
10654
10677
  }
10655
10678
 
10656
- GetExceptionInfo(&exception);
10679
+ exception = AcquireExceptionInfo();
10657
10680
 
10658
- images = (reader)(info, &exception);
10659
- rm_check_exception(&exception, images, DestroyOnError);
10681
+ images = (reader)(info, exception);
10682
+ rm_check_exception(exception, images, DestroyOnError);
10660
10683
  rm_set_user_artifact(images, info);
10661
- (void) DestroyExceptionInfo(&exception);
10684
+ (void) DestroyExceptionInfo(exception);
10662
10685
 
10663
10686
  return array_from_images(images);
10664
10687
  }
@@ -10681,10 +10704,14 @@ Image_recolor(VALUE self, VALUE color_matrix)
10681
10704
  unsigned long order;
10682
10705
  long x, len;
10683
10706
  double *matrix;
10684
- ExceptionInfo exception;
10707
+ ExceptionInfo *exception;
10708
+
10709
+ #if defined(HAVE_COLORMATRIXIMAGE)
10710
+ KernelInfo *kernel_info;
10711
+ #endif
10685
10712
 
10686
10713
  image = rm_check_destroyed(self);
10687
- GetExceptionInfo(&exception);
10714
+ exception = AcquireExceptionInfo();
10688
10715
 
10689
10716
  // Allocate color matrix from Ruby's memory
10690
10717
  len = RARRAY_LEN(color_matrix);
@@ -10698,11 +10725,23 @@ Image_recolor(VALUE self, VALUE color_matrix)
10698
10725
  order = (unsigned long)sqrt((double)(len + 1.0));
10699
10726
 
10700
10727
  // RecolorImage sets the ExceptionInfo and returns a NULL image if an error occurs.
10701
- new_image = RecolorImage(image, order, matrix, &exception);
10728
+ #if defined(HAVE_COLORMATRIXIMAGE)
10729
+ kernel_info = AcquireKernelInfo("1");
10730
+ if (kernel_info == (KernelInfo *) NULL)
10731
+ return((Image *) NULL);
10732
+ kernel_info->width = order;
10733
+ kernel_info->height = order;
10734
+ kernel_info->values = (double *) matrix;
10735
+ new_image = ColorMatrixImage(image, kernel_info, exception);
10736
+ kernel_info->values = (double *) NULL;
10737
+ kernel_info = DestroyKernelInfo(kernel_info);
10738
+ #else
10739
+ new_image = RecolorImage(image, order, matrix, exception);
10740
+ #endif
10702
10741
  xfree((void *)matrix);
10703
10742
 
10704
- rm_check_exception(&exception, new_image, DestroyOnError);
10705
- (void) DestroyExceptionInfo(&exception);
10743
+ rm_check_exception(exception, new_image, DestroyOnError);
10744
+ (void) DestroyExceptionInfo(exception);
10706
10745
 
10707
10746
  return rm_image_new(new_image);
10708
10747
  }
@@ -10734,7 +10773,7 @@ Image_read_inline(VALUE self, VALUE content)
10734
10773
  long x, image_data_l;
10735
10774
  unsigned char *blob;
10736
10775
  size_t blob_l;
10737
- ExceptionInfo exception;
10776
+ ExceptionInfo *exception;
10738
10777
 
10739
10778
  self = self; // defeat gcc message
10740
10779
 
@@ -10761,19 +10800,19 @@ Image_read_inline(VALUE self, VALUE content)
10761
10800
  rb_raise(rb_eArgError, "can't decode image");
10762
10801
  }
10763
10802
 
10764
- GetExceptionInfo(&exception);
10803
+ exception = AcquireExceptionInfo();
10765
10804
 
10766
10805
  // Create a new Info structure for this read. About the
10767
10806
  // only useful attribute that can be set is `format'.
10768
10807
  info_obj = rm_info_new();
10769
10808
  Data_Get_Struct(info_obj, Info, info);
10770
10809
 
10771
- images = BlobToImage(info, blob, blob_l, &exception);
10810
+ images = BlobToImage(info, blob, blob_l, exception);
10772
10811
  magick_free((void *)blob);
10773
10812
 
10774
- rm_check_exception(&exception, images, DestroyOnError);
10813
+ rm_check_exception(exception, images, DestroyOnError);
10775
10814
 
10776
- (void) DestroyExceptionInfo(&exception);
10815
+ (void) DestroyExceptionInfo(exception);
10777
10816
  rm_set_user_artifact(images, info);
10778
10817
 
10779
10818
  return array_from_images(images);
@@ -10822,15 +10861,19 @@ VALUE
10822
10861
  Image_reduce_noise(VALUE self, VALUE radius)
10823
10862
  {
10824
10863
  Image *image, *new_image;
10825
- ExceptionInfo exception;
10864
+ ExceptionInfo *exception;
10826
10865
 
10827
10866
  image = rm_check_destroyed(self);
10828
10867
 
10829
- GetExceptionInfo(&exception);
10830
- new_image = ReduceNoiseImage(image, NUM2DBL(radius), &exception);
10831
- rm_check_exception(&exception, new_image, DestroyOnError);
10868
+ exception = AcquireExceptionInfo();
10869
+ #if defined(HAVE_STATISTICIMAGE)
10870
+ new_image = StatisticImage(image, NonpeakStatistic, (size_t)radius, (size_t)radius, exception);
10871
+ #else
10872
+ new_image = ReduceNoiseImage(image, NUM2DBL(radius), exception);
10873
+ #endif
10874
+ rm_check_exception(exception, new_image, DestroyOnError);
10832
10875
 
10833
- (void) DestroyExceptionInfo(&exception);
10876
+ (void) DestroyExceptionInfo(exception);
10834
10877
 
10835
10878
  return rm_image_new(new_image);
10836
10879
  }
@@ -10934,6 +10977,152 @@ Image_rendering_intent_eq(VALUE self, VALUE ri)
10934
10977
  }
10935
10978
 
10936
10979
 
10980
+ /**
10981
+ * Resample image to specified horizontal resolution, vertical resolution,
10982
+ * filter and blur factor.
10983
+ *
10984
+ * No Ruby usage (internal function)
10985
+ *
10986
+ * @param bang whether the bang (!) version of the method was called
10987
+ * @param argc number of input arguments
10988
+ * @param argv array of input arguments
10989
+ * @param self this object
10990
+ * @return self if bang, otherwise a new image
10991
+ * @see Image_resample
10992
+ * @see Image_resample_bang
10993
+ */
10994
+ static VALUE
10995
+ resample(int bang, int argc, VALUE *argv, VALUE self)
10996
+ {
10997
+ Image *image, *new_image;
10998
+ FilterTypes filter;
10999
+ double x_resolution, y_resolution, blur;
11000
+ double width, height;
11001
+ ExceptionInfo *exception;
11002
+
11003
+ Data_Get_Struct(self, Image, image);
11004
+
11005
+ // Set up defaults
11006
+ filter = image->filter;
11007
+ blur = image->blur;
11008
+ x_resolution = 72.0;
11009
+ y_resolution = 72.0;
11010
+
11011
+ switch (argc)
11012
+ {
11013
+ case 4:
11014
+ blur = NUM2DBL(argv[3]);
11015
+ case 3:
11016
+ VALUE_TO_ENUM(argv[2], filter, FilterTypes);
11017
+ case 2:
11018
+ y_resolution = NUM2DBL(argv[1]);
11019
+ if (y_resolution < 0.0)
11020
+ {
11021
+ rb_raise(rb_eArgError, "invalid y_resolution value (%lf given)", y_resolution);
11022
+ }
11023
+ case 1:
11024
+ x_resolution = NUM2DBL(argv[0]);
11025
+ if (x_resolution < 0.0)
11026
+ {
11027
+ rb_raise(rb_eArgError, "invalid x_resolution value (%lf given)", x_resolution);
11028
+ }
11029
+ if (argc == 1)
11030
+ {
11031
+ y_resolution = x_resolution;
11032
+ }
11033
+ width = (x_resolution * image->columns /
11034
+ (image->x_resolution == 0.0 ? 72.0 : image->x_resolution) + 0.5);
11035
+ height = (y_resolution * image->rows /
11036
+ (image->y_resolution == 0.0 ? 72.0 : image->y_resolution) + 0.5);
11037
+ if (width > (double)ULONG_MAX || height > (double)ULONG_MAX)
11038
+ {
11039
+ rb_raise(rb_eRangeError, "resampled image too big");
11040
+ }
11041
+ break;
11042
+ case 0:
11043
+ break;
11044
+ default:
11045
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 to 4)", argc);
11046
+ break;
11047
+ }
11048
+
11049
+ exception = AcquireExceptionInfo();
11050
+ new_image = ResampleImage(image, x_resolution, y_resolution, filter, blur, exception);
11051
+ rm_check_exception(exception, new_image, DestroyOnError);
11052
+
11053
+ (void) DestroyExceptionInfo(exception);
11054
+
11055
+ rm_ensure_result(new_image);
11056
+
11057
+ if (bang)
11058
+ {
11059
+ UPDATE_DATA_PTR(self, new_image);
11060
+ (void) rm_image_destroy(image);
11061
+ return self;
11062
+ }
11063
+ return rm_image_new(new_image);
11064
+ }
11065
+
11066
+ /**
11067
+ * Resample image to specified horizontal resolution, vertical resolution,
11068
+ * filter and blur factor.
11069
+ *
11070
+ * Ruby usage:
11071
+ * - @verbatim Image#resample @endverbatim
11072
+ * - @verbatim Image#resample(resolution) @endverbatim
11073
+ * - @verbatim Image#resample(x_resolution, y_resolution) @endverbatim
11074
+ * - @verbatim Image#resample(x_resolution, y_resolution, filter) @endverbatim
11075
+ * - @verbatim Image#resample(x_resolution, y_resolution, filter, blur) @endverbatim
11076
+ *
11077
+ * Notes:
11078
+ * - Default filter is image->filter
11079
+ * - Default blur is image->blur
11080
+ *
11081
+ * @param argc number of input arguments
11082
+ * @param argv array of input arguments
11083
+ * @param self this object
11084
+ * @return a new image
11085
+ * @see resample
11086
+ * @see Image_resample_bang
11087
+ */
11088
+ VALUE
11089
+ Image_resample(int argc, VALUE *argv, VALUE self)
11090
+ {
11091
+ (void) rm_check_destroyed(self);
11092
+ return resample(False, argc, argv, self);
11093
+ }
11094
+
11095
+
11096
+ /**
11097
+ * Resample image to specified horizontal resolution, vertical resolution,
11098
+ * filter and blur factor.
11099
+ *
11100
+ * Ruby usage:
11101
+ * - @verbatim Image#resample @endverbatim
11102
+ * - @verbatim Image#resample(resolution) @endverbatim
11103
+ * - @verbatim Image#resample(x_resolution, y_resolution) @endverbatim
11104
+ * - @verbatim Image#resample(x_resolution, y_resolution, filter) @endverbatim
11105
+ * - @verbatim Image#resample(x_resolution, y_resolution, filter, blur) @endverbatim
11106
+ *
11107
+ * Notes:
11108
+ * - Default filter is image->filter
11109
+ * - Default blur is image->blur
11110
+ *
11111
+ * @param argc number of input arguments
11112
+ * @param argv array of input arguments
11113
+ * @param self this object
11114
+ * @return a new image
11115
+ * @see resample
11116
+ * @see Image_resample
11117
+ */
11118
+ VALUE
11119
+ Image_resample_bang(int argc, VALUE *argv, VALUE self)
11120
+ {
11121
+ (void) rm_check_frozen(self);
11122
+ return resample(True, argc, argv, self);
11123
+ }
11124
+
11125
+
10937
11126
  /**
10938
11127
  * Scale an image to the desired dimensions using the specified filter and blur
10939
11128
  * factor.
@@ -10956,7 +11145,7 @@ resize(int bang, int argc, VALUE *argv, VALUE self)
10956
11145
  FilterTypes filter;
10957
11146
  unsigned long rows, columns;
10958
11147
  double blur, drows, dcols;
10959
- ExceptionInfo exception;
11148
+ ExceptionInfo *exception;
10960
11149
 
10961
11150
  Data_Get_Struct(self, Image, image);
10962
11151
 
@@ -11000,11 +11189,11 @@ resize(int bang, int argc, VALUE *argv, VALUE self)
11000
11189
  break;
11001
11190
  }
11002
11191
 
11003
- GetExceptionInfo(&exception);
11004
- new_image = ResizeImage(image, columns, rows, filter, blur, &exception);
11005
- rm_check_exception(&exception, new_image, DestroyOnError);
11192
+ exception = AcquireExceptionInfo();
11193
+ new_image = ResizeImage(image, columns, rows, filter, blur, exception);
11194
+ rm_check_exception(exception, new_image, DestroyOnError);
11006
11195
 
11007
- (void) DestroyExceptionInfo(&exception);
11196
+ (void) DestroyExceptionInfo(exception);
11008
11197
 
11009
11198
  rm_ensure_result(new_image);
11010
11199
 
@@ -11091,15 +11280,15 @@ VALUE
11091
11280
  Image_roll(VALUE self, VALUE x_offset, VALUE y_offset)
11092
11281
  {
11093
11282
  Image *image, *new_image;
11094
- ExceptionInfo exception;
11283
+ ExceptionInfo *exception;
11095
11284
 
11096
11285
  image = rm_check_destroyed(self);
11097
11286
 
11098
- GetExceptionInfo(&exception);
11099
- new_image = RollImage(image, NUM2LONG(x_offset), NUM2LONG(y_offset), &exception);
11100
- rm_check_exception(&exception, new_image, DestroyOnError);
11287
+ exception = AcquireExceptionInfo();
11288
+ new_image = RollImage(image, NUM2LONG(x_offset), NUM2LONG(y_offset), exception);
11289
+ rm_check_exception(exception, new_image, DestroyOnError);
11101
11290
 
11102
- (void) DestroyExceptionInfo(&exception);
11291
+ (void) DestroyExceptionInfo(exception);
11103
11292
 
11104
11293
  rm_ensure_result(new_image);
11105
11294
 
@@ -11127,7 +11316,7 @@ rotate(int bang, int argc, VALUE *argv, VALUE self)
11127
11316
  double degrees;
11128
11317
  char *arrow;
11129
11318
  long arrow_l;
11130
- ExceptionInfo exception;
11319
+ ExceptionInfo *exception;
11131
11320
 
11132
11321
  Data_Get_Struct(self, Image, image);
11133
11322
 
@@ -11155,12 +11344,12 @@ rotate(int bang, int argc, VALUE *argv, VALUE self)
11155
11344
  break;
11156
11345
  }
11157
11346
 
11158
- GetExceptionInfo(&exception);
11347
+ exception = AcquireExceptionInfo();
11159
11348
 
11160
- new_image = RotateImage(image, degrees, &exception);
11161
- rm_check_exception(&exception, new_image, DestroyOnError);
11349
+ new_image = RotateImage(image, degrees, exception);
11350
+ rm_check_exception(exception, new_image, DestroyOnError);
11162
11351
 
11163
- (void) DestroyExceptionInfo(&exception);
11352
+ (void) DestroyExceptionInfo(exception);
11164
11353
 
11165
11354
  rm_ensure_result(new_image);
11166
11355
 
@@ -11356,7 +11545,7 @@ scale(int bang, int argc, VALUE *argv, VALUE self, scaler_t scaler)
11356
11545
  Image *image, *new_image;
11357
11546
  unsigned long columns, rows;
11358
11547
  double scale_arg, drows, dcols;
11359
- ExceptionInfo exception;
11548
+ ExceptionInfo *exception;
11360
11549
 
11361
11550
  Data_Get_Struct(self, Image, image);
11362
11551
 
@@ -11390,11 +11579,11 @@ scale(int bang, int argc, VALUE *argv, VALUE self, scaler_t scaler)
11390
11579
  break;
11391
11580
  }
11392
11581
 
11393
- GetExceptionInfo(&exception);
11394
- new_image = (scaler)(image, columns, rows, &exception);
11395
- rm_check_exception(&exception, new_image, DestroyOnError);
11582
+ exception = AcquireExceptionInfo();
11583
+ new_image = (scaler)(image, columns, rows, exception);
11584
+ rm_check_exception(exception, new_image, DestroyOnError);
11396
11585
 
11397
- (void) DestroyExceptionInfo(&exception);
11586
+ (void) DestroyExceptionInfo(exception);
11398
11587
 
11399
11588
  rm_ensure_result(new_image);
11400
11589
 
@@ -11443,7 +11632,7 @@ Image_selective_blur_channel(int argc, VALUE *argv, VALUE self)
11443
11632
  #if defined(HAVE_SELECTIVEBLURIMAGECHANNEL)
11444
11633
  Image *image, *new_image;
11445
11634
  double radius, sigma, threshold;
11446
- ExceptionInfo exception;
11635
+ ExceptionInfo *exception;
11447
11636
  ChannelType channels;
11448
11637
 
11449
11638
  image = rm_check_destroyed(self);
@@ -11463,10 +11652,10 @@ Image_selective_blur_channel(int argc, VALUE *argv, VALUE self)
11463
11652
  // Either way it's supposed to represent a percentage of the QuantumRange.
11464
11653
  threshold = rm_percentage(argv[2],1.0) * QuantumRange;
11465
11654
 
11466
- GetExceptionInfo(&exception);
11467
- new_image = SelectiveBlurImageChannel(image, channels, radius, sigma, threshold, &exception);
11468
- rm_check_exception(&exception, new_image, DestroyOnError);
11469
- (void) DestroyExceptionInfo(&exception);
11655
+ exception = AcquireExceptionInfo();
11656
+ new_image = SelectiveBlurImageChannel(image, channels, radius, sigma, threshold, exception);
11657
+ rm_check_exception(exception, new_image, DestroyOnError);
11658
+ (void) DestroyExceptionInfo(exception);
11470
11659
  rm_ensure_result(new_image);
11471
11660
 
11472
11661
  return rm_image_new(new_image);
@@ -11532,7 +11721,7 @@ Image_separate(int argc, VALUE *argv, VALUE self)
11532
11721
  {
11533
11722
  Image *image, *new_images;
11534
11723
  ChannelType channels = 0;
11535
- ExceptionInfo exception;
11724
+ ExceptionInfo *exception;
11536
11725
 
11537
11726
  image = rm_check_destroyed(self);
11538
11727
  channels = extract_channels(&argc, argv);
@@ -11543,10 +11732,10 @@ Image_separate(int argc, VALUE *argv, VALUE self)
11543
11732
  raise_ChannelType_error(argv[argc-1]);
11544
11733
  }
11545
11734
 
11546
- GetExceptionInfo(&exception);
11547
- new_images = SeparateImages(image, channels, &exception);
11548
- rm_check_exception(&exception, new_images, DestroyOnError);
11549
- DestroyExceptionInfo(&exception);
11735
+ exception = AcquireExceptionInfo();
11736
+ new_images = SeparateImages(image, channels, exception);
11737
+ rm_check_exception(exception, new_images, DestroyOnError);
11738
+ DestroyExceptionInfo(exception);
11550
11739
  rm_ensure_result(new_images);
11551
11740
 
11552
11741
  return rm_imagelist_from_images(new_images);
@@ -11573,7 +11762,7 @@ Image_sepiatone(int argc, VALUE *argv, VALUE self)
11573
11762
  {
11574
11763
  Image *image, *new_image;
11575
11764
  double threshold = (double) QuantumRange;
11576
- ExceptionInfo exception;
11765
+ ExceptionInfo *exception;
11577
11766
 
11578
11767
  image = rm_check_destroyed(self);
11579
11768
 
@@ -11588,11 +11777,11 @@ Image_sepiatone(int argc, VALUE *argv, VALUE self)
11588
11777
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 or 1)", argc);
11589
11778
  }
11590
11779
 
11591
- GetExceptionInfo(&exception);
11592
- new_image = SepiaToneImage(image, threshold, &exception);
11593
- rm_check_exception(&exception, new_image, DestroyOnError);
11780
+ exception = AcquireExceptionInfo();
11781
+ new_image = SepiaToneImage(image, threshold, exception);
11782
+ rm_check_exception(exception, new_image, DestroyOnError);
11594
11783
 
11595
- (void) DestroyExceptionInfo(&exception);
11784
+ (void) DestroyExceptionInfo(exception);
11596
11785
  rm_ensure_result(new_image);
11597
11786
 
11598
11787
  return rm_image_new(new_image);
@@ -11772,7 +11961,7 @@ Image_shade(int argc, VALUE *argv, VALUE self)
11772
11961
  Image *image, *new_image;
11773
11962
  double azimuth = 30.0, elevation = 30.0;
11774
11963
  unsigned int shading=MagickFalse;
11775
- ExceptionInfo exception;
11964
+ ExceptionInfo *exception;
11776
11965
 
11777
11966
  image = rm_check_destroyed(self);
11778
11967
  switch (argc)
@@ -11790,11 +11979,11 @@ Image_shade(int argc, VALUE *argv, VALUE self)
11790
11979
  break;
11791
11980
  }
11792
11981
 
11793
- GetExceptionInfo(&exception);
11794
- new_image = ShadeImage(image, shading, azimuth, elevation, &exception);
11795
- rm_check_exception(&exception, new_image, DestroyOnError);
11982
+ exception = AcquireExceptionInfo();
11983
+ new_image = ShadeImage(image, shading, azimuth, elevation, exception);
11984
+ rm_check_exception(exception, new_image, DestroyOnError);
11796
11985
 
11797
- (void) DestroyExceptionInfo(&exception);
11986
+ (void) DestroyExceptionInfo(exception);
11798
11987
  rm_ensure_result(new_image);
11799
11988
 
11800
11989
  return rm_image_new(new_image);
@@ -11835,7 +12024,7 @@ Image_shadow(int argc, VALUE *argv, VALUE self)
11835
12024
  double sigma = 4.0;
11836
12025
  long x_offset = 4L;
11837
12026
  long y_offset = 4L;
11838
- ExceptionInfo exception;
12027
+ ExceptionInfo *exception;
11839
12028
 
11840
12029
  image = rm_check_destroyed(self);
11841
12030
  switch (argc)
@@ -11862,11 +12051,11 @@ Image_shadow(int argc, VALUE *argv, VALUE self)
11862
12051
  break;
11863
12052
  }
11864
12053
 
11865
- GetExceptionInfo(&exception);
11866
- new_image = ShadowImage(image, opacity, sigma, x_offset, y_offset, &exception);
11867
- rm_check_exception(&exception, new_image, DestroyOnError);
12054
+ exception = AcquireExceptionInfo();
12055
+ new_image = ShadowImage(image, opacity, sigma, x_offset, y_offset, exception);
12056
+ rm_check_exception(exception, new_image, DestroyOnError);
11868
12057
 
11869
- (void) DestroyExceptionInfo(&exception);
12058
+ (void) DestroyExceptionInfo(exception);
11870
12059
  rm_ensure_result(new_image);
11871
12060
 
11872
12061
  return rm_image_new(new_image);
@@ -11923,7 +12112,7 @@ Image_sharpen_channel(int argc, VALUE *argv, VALUE self)
11923
12112
  {
11924
12113
  Image *image, *new_image;
11925
12114
  ChannelType channels;
11926
- ExceptionInfo exception;
12115
+ ExceptionInfo *exception;
11927
12116
  double radius = 0.0, sigma = 1.0;
11928
12117
 
11929
12118
  image = rm_check_destroyed(self);
@@ -11946,11 +12135,11 @@ Image_sharpen_channel(int argc, VALUE *argv, VALUE self)
11946
12135
 
11947
12136
  new_image = rm_clone_image(image);
11948
12137
 
11949
- GetExceptionInfo(&exception);
11950
- (void) SharpenImageChannel(new_image, channels, radius, sigma, &exception);
12138
+ exception = AcquireExceptionInfo();
12139
+ (void) SharpenImageChannel(new_image, channels, radius, sigma, exception);
11951
12140
 
11952
- rm_check_exception(&exception, new_image, DestroyOnError);
11953
- (void) DestroyExceptionInfo(&exception);
12141
+ rm_check_exception(exception, new_image, DestroyOnError);
12142
+ (void) DestroyExceptionInfo(exception);
11954
12143
 
11955
12144
  return rm_image_new(new_image);
11956
12145
  }
@@ -12015,15 +12204,15 @@ VALUE
12015
12204
  Image_shear(VALUE self, VALUE x_shear, VALUE y_shear)
12016
12205
  {
12017
12206
  Image *image, *new_image;
12018
- ExceptionInfo exception;
12207
+ ExceptionInfo *exception;
12019
12208
 
12020
12209
  image = rm_check_destroyed(self);
12021
12210
 
12022
- GetExceptionInfo(&exception);
12023
- new_image = ShearImage(image, NUM2DBL(x_shear), NUM2DBL(y_shear), &exception);
12024
- rm_check_exception(&exception, new_image, DestroyOnError);
12211
+ exception = AcquireExceptionInfo();
12212
+ new_image = ShearImage(image, NUM2DBL(x_shear), NUM2DBL(y_shear), exception);
12213
+ rm_check_exception(exception, new_image, DestroyOnError);
12025
12214
 
12026
- (void) DestroyExceptionInfo(&exception);
12215
+ (void) DestroyExceptionInfo(exception);
12027
12216
  rm_ensure_result(new_image);
12028
12217
 
12029
12218
  return rm_image_new(new_image);
@@ -12322,7 +12511,7 @@ Image_sparse_color(int argc, VALUE *argv, VALUE self)
12322
12511
  double * volatile args;
12323
12512
  ChannelType channels;
12324
12513
  MagickPixelPacket pp;
12325
- ExceptionInfo exception;
12514
+ ExceptionInfo *exception;
12326
12515
 
12327
12516
  image = rm_check_destroyed(self);
12328
12517
 
@@ -12383,8 +12572,8 @@ Image_sparse_color(int argc, VALUE *argv, VALUE self)
12383
12572
  }
12384
12573
  }
12385
12574
 
12386
- GetExceptionInfo(&exception);
12387
- new_image = SparseColorImage(image, channels, method, nargs, args, &exception);
12575
+ exception = AcquireExceptionInfo();
12576
+ new_image = SparseColorImage(image, channels, method, nargs, args, exception);
12388
12577
  xfree(args);
12389
12578
  CHECK_EXCEPTION();
12390
12579
  rm_ensure_result(new_image);
@@ -12426,7 +12615,7 @@ Image_splice(int argc, VALUE *argv, VALUE self)
12426
12615
  Image *image, *new_image;
12427
12616
  PixelPacket color, old_color;
12428
12617
  RectangleInfo rectangle;
12429
- ExceptionInfo exception;
12618
+ ExceptionInfo *exception;
12430
12619
 
12431
12620
  image = rm_check_destroyed(self);
12432
12621
 
@@ -12450,17 +12639,17 @@ Image_splice(int argc, VALUE *argv, VALUE self)
12450
12639
  rectangle.width = NUM2ULONG(argv[2]);
12451
12640
  rectangle.height = NUM2ULONG(argv[3]);
12452
12641
 
12453
- GetExceptionInfo(&exception);
12642
+ exception = AcquireExceptionInfo();
12454
12643
 
12455
12644
  // Swap in color for the duration of this call.
12456
12645
  old_color = image->background_color;
12457
12646
  image->background_color = color;
12458
- new_image = SpliceImage(image, &rectangle, &exception);
12647
+ new_image = SpliceImage(image, &rectangle, exception);
12459
12648
  image->background_color = old_color;
12460
12649
 
12461
- rm_check_exception(&exception, new_image, DestroyOnError);
12650
+ rm_check_exception(exception, new_image, DestroyOnError);
12462
12651
 
12463
- (void) DestroyExceptionInfo(&exception);
12652
+ (void) DestroyExceptionInfo(exception);
12464
12653
 
12465
12654
  rm_ensure_result(new_image);
12466
12655
 
@@ -12488,7 +12677,7 @@ Image_spread(int argc, VALUE *argv, VALUE self)
12488
12677
  {
12489
12678
  Image *image, *new_image;
12490
12679
  double radius = 3.0;
12491
- ExceptionInfo exception;
12680
+ ExceptionInfo *exception;
12492
12681
 
12493
12682
  image = rm_check_destroyed(self);
12494
12683
  switch (argc)
@@ -12502,12 +12691,12 @@ Image_spread(int argc, VALUE *argv, VALUE self)
12502
12691
  break;
12503
12692
  }
12504
12693
 
12505
- GetExceptionInfo(&exception);
12506
- new_image = SpreadImage(image, radius, &exception);
12507
- rm_check_exception(&exception, new_image, DestroyOnError);
12694
+ exception = AcquireExceptionInfo();
12695
+ new_image = SpreadImage(image, radius, exception);
12696
+ rm_check_exception(exception, new_image, DestroyOnError);
12508
12697
  rm_ensure_result(new_image);
12509
12698
 
12510
- (void) DestroyExceptionInfo(&exception);
12699
+ (void) DestroyExceptionInfo(exception);
12511
12700
 
12512
12701
  return rm_image_new(new_image);
12513
12702
  }
@@ -12534,7 +12723,7 @@ Image_stegano(VALUE self, VALUE watermark_image, VALUE offset)
12534
12723
  Image *image, *new_image;
12535
12724
  volatile VALUE wm_image;
12536
12725
  Image *watermark;
12537
- ExceptionInfo exception;
12726
+ ExceptionInfo *exception;
12538
12727
 
12539
12728
  image = rm_check_destroyed(self);
12540
12729
 
@@ -12543,11 +12732,11 @@ Image_stegano(VALUE self, VALUE watermark_image, VALUE offset)
12543
12732
 
12544
12733
  image->offset = NUM2LONG(offset);
12545
12734
 
12546
- GetExceptionInfo(&exception);
12547
- new_image = SteganoImage(image, watermark, &exception);
12548
- rm_check_exception(&exception, new_image, DestroyOnError);
12735
+ exception = AcquireExceptionInfo();
12736
+ new_image = SteganoImage(image, watermark, exception);
12737
+ rm_check_exception(exception, new_image, DestroyOnError);
12549
12738
 
12550
- (void) DestroyExceptionInfo(&exception);
12739
+ (void) DestroyExceptionInfo(exception);
12551
12740
 
12552
12741
  rm_ensure_result(new_image);
12553
12742
 
@@ -12573,18 +12762,18 @@ Image_stereo(VALUE self, VALUE offset_image_arg)
12573
12762
  Image *image, *new_image;
12574
12763
  volatile VALUE offset_image;
12575
12764
  Image *offset;
12576
- ExceptionInfo exception;
12765
+ ExceptionInfo *exception;
12577
12766
 
12578
12767
  image = rm_check_destroyed(self);
12579
12768
 
12580
12769
  offset_image = rm_cur_image(offset_image_arg);
12581
12770
  offset = rm_check_destroyed(offset_image);
12582
12771
 
12583
- GetExceptionInfo(&exception);
12584
- new_image = StereoImage(image, offset, &exception);
12585
- rm_check_exception(&exception, new_image, DestroyOnError);
12772
+ exception = AcquireExceptionInfo();
12773
+ new_image = StereoImage(image, offset, exception);
12774
+ rm_check_exception(exception, new_image, DestroyOnError);
12586
12775
 
12587
- (void) DestroyExceptionInfo(&exception);
12776
+ (void) DestroyExceptionInfo(exception);
12588
12777
 
12589
12778
  rm_ensure_result(new_image);
12590
12779
 
@@ -12711,12 +12900,12 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg
12711
12900
  // from the pixels argument.
12712
12901
  {
12713
12902
  #if defined(HAVE_SYNCAUTHENTICPIXELS) || defined(HAVE_GETAUTHENTICPIXELS)
12714
- ExceptionInfo exception;
12715
- GetExceptionInfo(&exception);
12903
+ ExceptionInfo *exception;
12904
+ exception = AcquireExceptionInfo();
12716
12905
  #endif
12717
12906
 
12718
12907
  #if defined(HAVE_GETAUTHENTICPIXELS)
12719
- pixels = GetAuthenticPixels(image, x, y, cols, rows, &exception);
12908
+ pixels = GetAuthenticPixels(image, x, y, cols, rows, exception);
12720
12909
  CHECK_EXCEPTION()
12721
12910
  #else
12722
12911
  pixels = GetImagePixels(image, x, y, cols, rows);
@@ -12732,7 +12921,7 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg
12732
12921
  pixels[n] = *pixel;
12733
12922
  }
12734
12923
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
12735
- SyncAuthenticPixels(image, &exception);
12924
+ SyncAuthenticPixels(image, exception);
12736
12925
  CHECK_EXCEPTION()
12737
12926
  #else
12738
12927
  SyncImagePixels(image);
@@ -12741,7 +12930,7 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg
12741
12930
  }
12742
12931
 
12743
12932
  #if defined(HAVE_SYNCAUTHENTICPIXELS) || defined(HAVE_GETAUTHENTICPIXELS)
12744
- DestroyExceptionInfo(&exception);
12933
+ DestroyExceptionInfo(exception);
12745
12934
  #endif
12746
12935
  }
12747
12936
 
@@ -12784,15 +12973,15 @@ VALUE
12784
12973
  Image_swirl(VALUE self, VALUE degrees)
12785
12974
  {
12786
12975
  Image *image, *new_image;
12787
- ExceptionInfo exception;
12976
+ ExceptionInfo *exception;
12788
12977
 
12789
12978
  image = rm_check_destroyed(self);
12790
12979
 
12791
- GetExceptionInfo(&exception);
12792
- new_image = SwirlImage(image, NUM2DBL(degrees), &exception);
12793
- rm_check_exception(&exception, new_image, DestroyOnError);
12980
+ exception = AcquireExceptionInfo();
12981
+ new_image = SwirlImage(image, NUM2DBL(degrees), exception);
12982
+ rm_check_exception(exception, new_image, DestroyOnError);
12794
12983
 
12795
- (void) DestroyExceptionInfo(&exception);
12984
+ (void) DestroyExceptionInfo(exception);
12796
12985
 
12797
12986
  rm_ensure_result(new_image);
12798
12987
 
@@ -13025,7 +13214,7 @@ thumbnail(int bang, int argc, VALUE *argv, VALUE self)
13025
13214
  Image *image, *new_image;
13026
13215
  unsigned long columns, rows;
13027
13216
  double scale_arg, drows, dcols;
13028
- ExceptionInfo exception;
13217
+ ExceptionInfo *exception;
13029
13218
 
13030
13219
  Data_Get_Struct(self, Image, image);
13031
13220
 
@@ -13059,11 +13248,11 @@ thumbnail(int bang, int argc, VALUE *argv, VALUE self)
13059
13248
  break;
13060
13249
  }
13061
13250
 
13062
- GetExceptionInfo(&exception);
13063
- new_image = ThumbnailImage(image, columns, rows, &exception);
13064
- rm_check_exception(&exception, new_image, DestroyOnError);
13251
+ exception = AcquireExceptionInfo();
13252
+ new_image = ThumbnailImage(image, columns, rows, exception);
13253
+ rm_check_exception(exception, new_image, DestroyOnError);
13065
13254
 
13066
- (void) DestroyExceptionInfo(&exception);
13255
+ (void) DestroyExceptionInfo(exception);
13067
13256
 
13068
13257
  rm_ensure_result(new_image);
13069
13258
 
@@ -13186,7 +13375,7 @@ Image_tint(int argc, VALUE *argv, VALUE self)
13186
13375
  double red_pct_opaque, green_pct_opaque, blue_pct_opaque;
13187
13376
  double alpha_pct_opaque = 1.0;
13188
13377
  char opacity[50];
13189
- ExceptionInfo exception;
13378
+ ExceptionInfo *exception;
13190
13379
 
13191
13380
  image = rm_check_destroyed(self);
13192
13381
 
@@ -13232,12 +13421,12 @@ Image_tint(int argc, VALUE *argv, VALUE self)
13232
13421
  , blue_pct_opaque*100.0, alpha_pct_opaque*100.0);
13233
13422
 
13234
13423
  Data_Get_Struct(argv[0], Pixel, tint);
13235
- GetExceptionInfo(&exception);
13424
+ exception = AcquireExceptionInfo();
13236
13425
 
13237
- new_image = TintImage(image, opacity, *tint, &exception);
13238
- rm_check_exception(&exception, new_image, DestroyOnError);
13426
+ new_image = TintImage(image, opacity, *tint, exception);
13427
+ rm_check_exception(exception, new_image, DestroyOnError);
13239
13428
 
13240
- (void) DestroyExceptionInfo(&exception);
13429
+ (void) DestroyExceptionInfo(exception);
13241
13430
 
13242
13431
  rm_ensure_result(new_image);
13243
13432
 
@@ -13268,7 +13457,7 @@ Image_to_blob(VALUE self)
13268
13457
  volatile VALUE blob_str;
13269
13458
  void *blob = NULL;
13270
13459
  size_t length = 2048; // Do what Magick++ does
13271
- ExceptionInfo exception;
13460
+ ExceptionInfo *exception;
13272
13461
 
13273
13462
  // The user can specify the depth (8 or 16, if the format supports
13274
13463
  // both) and the image format by setting the depth and format
@@ -13285,10 +13474,10 @@ Image_to_blob(VALUE self)
13285
13474
  rm_check_image_exception(image, RetainOnError);
13286
13475
  }
13287
13476
 
13288
- GetExceptionInfo(&exception);
13477
+ exception = AcquireExceptionInfo();
13289
13478
  if (*info->magick)
13290
13479
  {
13291
- (void) SetImageInfo(info, MagickTrue, &exception);
13480
+ (void) SetImageInfo(info, MagickTrue, exception);
13292
13481
  CHECK_EXCEPTION()
13293
13482
 
13294
13483
  if (*info->magick == '\0')
@@ -13299,7 +13488,7 @@ Image_to_blob(VALUE self)
13299
13488
  }
13300
13489
 
13301
13490
  // Fix #2844 - libjpeg exits when image is 0x0
13302
- magick_info = GetMagickInfo(image->magick, &exception);
13491
+ magick_info = GetMagickInfo(image->magick, exception);
13303
13492
  CHECK_EXCEPTION()
13304
13493
 
13305
13494
  if (magick_info)
@@ -13315,10 +13504,10 @@ Image_to_blob(VALUE self)
13315
13504
 
13316
13505
  rm_sync_image_options(image, info);
13317
13506
 
13318
- blob = ImageToBlob(info, image, &length, &exception);
13507
+ blob = ImageToBlob(info, image, &length, exception);
13319
13508
  CHECK_EXCEPTION()
13320
13509
 
13321
- (void) DestroyExceptionInfo(&exception);
13510
+ (void) DestroyExceptionInfo(exception);
13322
13511
 
13323
13512
  if (length == 0 || !blob)
13324
13513
  {
@@ -13352,22 +13541,22 @@ Image_to_color(VALUE self, VALUE pixel_arg)
13352
13541
  {
13353
13542
  Image *image;
13354
13543
  Pixel *pixel;
13355
- ExceptionInfo exception;
13544
+ ExceptionInfo *exception;
13356
13545
  char name[MaxTextExtent];
13357
13546
 
13358
13547
  image = rm_check_destroyed(self);
13359
13548
  Data_Get_Struct(pixel_arg, Pixel, pixel);
13360
- GetExceptionInfo(&exception);
13549
+ exception = AcquireExceptionInfo();
13361
13550
 
13362
13551
  // QueryColorname returns False if the color represented by the PixelPacket
13363
13552
  // doesn't have a "real" name, just a sequence of hex digits. We don't care
13364
13553
  // about that.
13365
13554
 
13366
13555
  name[0] = '\0';
13367
- (void) QueryColorname(image, pixel, AllCompliance, name, &exception);
13556
+ (void) QueryColorname(image, pixel, AllCompliance, name, exception);
13368
13557
  CHECK_EXCEPTION()
13369
13558
 
13370
- (void) DestroyExceptionInfo(&exception);
13559
+ (void) DestroyExceptionInfo(exception);
13371
13560
 
13372
13561
  return rb_str_new2(name);
13373
13562
 
@@ -13679,7 +13868,7 @@ static VALUE
13679
13868
  trimmer(int bang, int argc, VALUE *argv, VALUE self)
13680
13869
  {
13681
13870
  Image *image, *new_image;
13682
- ExceptionInfo exception;
13871
+ ExceptionInfo *exception;
13683
13872
  int reset_page = 0;
13684
13873
 
13685
13874
  switch (argc)
@@ -13695,11 +13884,11 @@ trimmer(int bang, int argc, VALUE *argv, VALUE self)
13695
13884
 
13696
13885
  Data_Get_Struct(self, Image, image);
13697
13886
 
13698
- GetExceptionInfo(&exception);
13699
- new_image = TrimImage(image, &exception);
13700
- rm_check_exception(&exception, new_image, DestroyOnError);
13887
+ exception = AcquireExceptionInfo();
13888
+ new_image = TrimImage(image, exception);
13889
+ rm_check_exception(exception, new_image, DestroyOnError);
13701
13890
 
13702
- (void) DestroyExceptionInfo(&exception);
13891
+ (void) DestroyExceptionInfo(exception);
13703
13892
 
13704
13893
  rm_ensure_result(new_image);
13705
13894
 
@@ -13818,14 +14007,14 @@ VALUE Image_image_type(VALUE self)
13818
14007
  {
13819
14008
  Image *image;
13820
14009
  ImageType type;
13821
- ExceptionInfo exception;
14010
+ ExceptionInfo *exception;
13822
14011
 
13823
14012
  image = rm_check_destroyed(self);
13824
- GetExceptionInfo(&exception);
13825
- type = GetImageType(image, &exception);
14013
+ exception = AcquireExceptionInfo();
14014
+ type = GetImageType(image, exception);
13826
14015
  CHECK_EXCEPTION()
13827
14016
 
13828
- (void) DestroyExceptionInfo(&exception);
14017
+ (void) DestroyExceptionInfo(exception);
13829
14018
 
13830
14019
  return ImageType_new(type);
13831
14020
  }
@@ -13901,14 +14090,14 @@ VALUE
13901
14090
  Image_unique_colors(VALUE self)
13902
14091
  {
13903
14092
  Image *image, *new_image;
13904
- ExceptionInfo exception;
14093
+ ExceptionInfo *exception;
13905
14094
 
13906
14095
  image = rm_check_destroyed(self);
13907
- GetExceptionInfo(&exception);
14096
+ exception = AcquireExceptionInfo();
13908
14097
 
13909
- new_image = UniqueImageColors(image, &exception);
13910
- rm_check_exception(&exception, new_image, DestroyOnError);
13911
- (void) DestroyExceptionInfo(&exception);
14098
+ new_image = UniqueImageColors(image, exception);
14099
+ rm_check_exception(exception, new_image, DestroyOnError);
14100
+ (void) DestroyExceptionInfo(exception);
13912
14101
 
13913
14102
  rm_ensure_result(new_image);
13914
14103
 
@@ -14070,17 +14259,17 @@ Image_unsharp_mask(int argc, VALUE *argv, VALUE self)
14070
14259
  {
14071
14260
  Image *image, *new_image;
14072
14261
  double radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05;
14073
- ExceptionInfo exception;
14262
+ ExceptionInfo *exception;
14074
14263
 
14075
14264
  image = rm_check_destroyed(self);
14076
14265
 
14077
14266
  unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);
14078
14267
 
14079
- GetExceptionInfo(&exception);
14080
- new_image = UnsharpMaskImage(image, radius, sigma, amount, threshold, &exception);
14081
- rm_check_exception(&exception, new_image, DestroyOnError);
14268
+ exception = AcquireExceptionInfo();
14269
+ new_image = UnsharpMaskImage(image, radius, sigma, amount, threshold, exception);
14270
+ rm_check_exception(exception, new_image, DestroyOnError);
14082
14271
 
14083
- (void) DestroyExceptionInfo(&exception);
14272
+ (void) DestroyExceptionInfo(exception);
14084
14273
 
14085
14274
  rm_ensure_result(new_image);
14086
14275
 
@@ -14119,7 +14308,7 @@ Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self)
14119
14308
  Image *image, *new_image;
14120
14309
  ChannelType channels;
14121
14310
  double radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05;
14122
- ExceptionInfo exception;
14311
+ ExceptionInfo *exception;
14123
14312
 
14124
14313
  image = rm_check_destroyed(self);
14125
14314
  channels = extract_channels(&argc, argv);
@@ -14130,12 +14319,12 @@ Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self)
14130
14319
 
14131
14320
  unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);
14132
14321
 
14133
- GetExceptionInfo(&exception);
14322
+ exception = AcquireExceptionInfo();
14134
14323
  new_image = UnsharpMaskImageChannel(image, channels, radius, sigma, amount
14135
- , threshold, &exception);
14136
- rm_check_exception(&exception, new_image, DestroyOnError);
14324
+ , threshold, exception);
14325
+ rm_check_exception(exception, new_image, DestroyOnError);
14137
14326
 
14138
- (void) DestroyExceptionInfo(&exception);
14327
+ (void) DestroyExceptionInfo(exception);
14139
14328
 
14140
14329
  rm_ensure_result(new_image);
14141
14330
 
@@ -14171,7 +14360,7 @@ Image_vignette(int argc, VALUE *argv, VALUE self)
14171
14360
  Image *image, *new_image;
14172
14361
  long horz_radius, vert_radius;
14173
14362
  double radius = 0.0, sigma = 10.0;
14174
- ExceptionInfo exception;
14363
+ ExceptionInfo *exception;
14175
14364
 
14176
14365
  image = rm_check_destroyed(self);
14177
14366
 
@@ -14195,12 +14384,12 @@ Image_vignette(int argc, VALUE *argv, VALUE self)
14195
14384
  break;
14196
14385
  }
14197
14386
 
14198
- GetExceptionInfo(&exception);
14387
+ exception = AcquireExceptionInfo();
14199
14388
 
14200
- new_image = VignetteImage(image, radius, sigma, horz_radius, vert_radius, &exception);
14201
- rm_check_exception(&exception, new_image, DestroyOnError);
14389
+ new_image = VignetteImage(image, radius, sigma, horz_radius, vert_radius, exception);
14390
+ rm_check_exception(exception, new_image, DestroyOnError);
14202
14391
 
14203
- (void) DestroyExceptionInfo(&exception);
14392
+ (void) DestroyExceptionInfo(exception);
14204
14393
 
14205
14394
  rm_ensure_result(new_image);
14206
14395
 
@@ -14354,7 +14543,7 @@ Image_wave(int argc, VALUE *argv, VALUE self)
14354
14543
  {
14355
14544
  Image *image, *new_image;
14356
14545
  double amplitude = 25.0, wavelength = 150.0;
14357
- ExceptionInfo exception;
14546
+ ExceptionInfo *exception;
14358
14547
 
14359
14548
  image = rm_check_destroyed(self);
14360
14549
  switch (argc)
@@ -14370,11 +14559,11 @@ Image_wave(int argc, VALUE *argv, VALUE self)
14370
14559
  break;
14371
14560
  }
14372
14561
 
14373
- GetExceptionInfo(&exception);
14374
- new_image = WaveImage(image, amplitude, wavelength, &exception);
14375
- rm_check_exception(&exception, new_image, DestroyOnError);
14562
+ exception = AcquireExceptionInfo();
14563
+ new_image = WaveImage(image, amplitude, wavelength, exception);
14564
+ rm_check_exception(exception, new_image, DestroyOnError);
14376
14565
 
14377
- (void) DestroyExceptionInfo(&exception);
14566
+ (void) DestroyExceptionInfo(exception);
14378
14567
 
14379
14568
  rm_ensure_result(new_image);
14380
14569
 
@@ -14421,7 +14610,7 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14421
14610
  double rate = 1.0;
14422
14611
  double opacity, step;
14423
14612
  const char *func;
14424
- ExceptionInfo exception;
14613
+ ExceptionInfo *exception;
14425
14614
 
14426
14615
  image = rm_check_destroyed(self);
14427
14616
  switch (argc)
@@ -14464,8 +14653,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14464
14653
  }
14465
14654
 
14466
14655
 
14467
- GetExceptionInfo(&exception);
14468
- flip_image = FlipImage(image, &exception);
14656
+ exception = AcquireExceptionInfo();
14657
+ flip_image = FlipImage(image, exception);
14469
14658
  CHECK_EXCEPTION();
14470
14659
 
14471
14660
 
@@ -14473,7 +14662,7 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14473
14662
  geometry.y = 0;
14474
14663
  geometry.width = image->columns;
14475
14664
  geometry.height = max_rows;
14476
- reflection = CropImage(flip_image, &geometry, &exception);
14665
+ reflection = CropImage(flip_image, &geometry, exception);
14477
14666
  DestroyImage(flip_image);
14478
14667
  CHECK_EXCEPTION();
14479
14668
 
@@ -14494,11 +14683,11 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14494
14683
 
14495
14684
 
14496
14685
  #if defined(HAVE_GETVIRTUALPIXELS)
14497
- p = GetVirtualPixels(reflection, 0, y, image->columns, 1, &exception);
14686
+ p = GetVirtualPixels(reflection, 0, y, image->columns, 1, exception);
14498
14687
  #else
14499
- p = AcquireImagePixels(reflection, 0, y, image->columns, 1, &exception);
14688
+ p = AcquireImagePixels(reflection, 0, y, image->columns, 1, exception);
14500
14689
  #endif
14501
- rm_check_exception(&exception, reflection, DestroyOnError);
14690
+ rm_check_exception(exception, reflection, DestroyOnError);
14502
14691
  if (!p)
14503
14692
  {
14504
14693
  func = "AcquireImagePixels";
@@ -14506,11 +14695,11 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14506
14695
  }
14507
14696
 
14508
14697
  #if defined(HAVE_QUEUEAUTHENTICPIXELS)
14509
- q = QueueAuthenticPixels(reflection, 0, y, image->columns, 1, &exception);
14698
+ q = QueueAuthenticPixels(reflection, 0, y, image->columns, 1, exception);
14510
14699
  #else
14511
14700
  q = SetImagePixels(reflection, 0, y, image->columns, 1);
14512
14701
  #endif
14513
- rm_check_exception(&exception, reflection, DestroyOnError);
14702
+ rm_check_exception(exception, reflection, DestroyOnError);
14514
14703
  if (!q)
14515
14704
  {
14516
14705
  func = "SetImagePixels";
@@ -14526,8 +14715,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14526
14715
 
14527
14716
 
14528
14717
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
14529
- SyncAuthenticPixels(reflection, &exception);
14530
- rm_check_exception(&exception, reflection, DestroyOnError);
14718
+ SyncAuthenticPixels(reflection, exception);
14719
+ rm_check_exception(exception, reflection, DestroyOnError);
14531
14720
  #else
14532
14721
  SyncImagePixels(reflection);
14533
14722
  rm_check_image_exception(reflection, DestroyOnError);
@@ -14537,11 +14726,11 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14537
14726
  }
14538
14727
 
14539
14728
 
14540
- (void) DestroyExceptionInfo(&exception);
14729
+ (void) DestroyExceptionInfo(exception);
14541
14730
  return rm_image_new(reflection);
14542
14731
 
14543
14732
  error:
14544
- (void) DestroyExceptionInfo(&exception);
14733
+ (void) DestroyExceptionInfo(exception);
14545
14734
  (void) DestroyImage(reflection);
14546
14735
  rb_raise(rb_eRuntimeError, "%s failed on row %lu", func, y);
14547
14736
  return(VALUE)0;
@@ -14587,7 +14776,7 @@ void add_format_prefix(Info *info, VALUE file)
14587
14776
  char *filename;
14588
14777
  long filename_l;
14589
14778
  const MagickInfo *magick_info, *magick_info2;
14590
- ExceptionInfo exception;
14779
+ ExceptionInfo *exception;
14591
14780
  char magic[MaxTextExtent];
14592
14781
  size_t magic_l;
14593
14782
  size_t prefix_l;
@@ -14615,19 +14804,19 @@ void add_format_prefix(Info *info, VALUE file)
14615
14804
  magic_l = p - filename;
14616
14805
  memcpy(magic, filename, magic_l);
14617
14806
 
14618
- GetExceptionInfo(&exception);
14619
- magick_info = GetMagickInfo(magic, &exception);
14807
+ exception = AcquireExceptionInfo();
14808
+ magick_info = GetMagickInfo(magic, exception);
14620
14809
  CHECK_EXCEPTION();
14621
- DestroyExceptionInfo(&exception);
14810
+ DestroyExceptionInfo(exception);
14622
14811
 
14623
14812
  if (magick_info && magick_info->module)
14624
14813
  {
14625
14814
  // We have to compare the module names because some formats have
14626
14815
  // more than one name. JPG and JPEG, for example.
14627
- GetExceptionInfo(&exception);
14628
- magick_info2 = GetMagickInfo(info->magick, &exception);
14816
+ exception = AcquireExceptionInfo();
14817
+ magick_info2 = GetMagickInfo(info->magick, exception);
14629
14818
  CHECK_EXCEPTION();
14630
- DestroyExceptionInfo(&exception);
14819
+ DestroyExceptionInfo(exception);
14631
14820
 
14632
14821
  if (magick_info2->module && strcmp(magick_info->module, magick_info2->module) != 0)
14633
14822
  {
@@ -14690,8 +14879,14 @@ Image_write(VALUE self, VALUE file)
14690
14879
  // Ensure file is open - raise error if not
14691
14880
  GetOpenFile(file, fptr);
14692
14881
  rb_io_check_writable(fptr);
14882
+ #if defined(_WIN32)
14883
+ add_format_prefix(info, fptr->pathv);
14884
+ strcpy(image->filename, info->filename);
14885
+ SetImageInfoFile(info, NULL);
14886
+ #else
14693
14887
  SetImageInfoFile(info, GetWriteFile(fptr));
14694
14888
  memset(image->filename, 0, sizeof(image->filename));
14889
+ #endif
14695
14890
  }
14696
14891
  else
14697
14892
  {
@@ -14926,7 +15121,7 @@ xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, x
14926
15121
  {
14927
15122
  Image *image, *new_image;
14928
15123
  RectangleInfo rect;
14929
- ExceptionInfo exception;
15124
+ ExceptionInfo *exception;
14930
15125
 
14931
15126
  Data_Get_Struct(self, Image, image);
14932
15127
  rect.x = NUM2LONG(x);
@@ -14934,15 +15129,15 @@ xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, x
14934
15129
  rect.width = NUM2ULONG(width);
14935
15130
  rect.height = NUM2ULONG(height);
14936
15131
 
14937
- GetExceptionInfo(&exception);
15132
+ exception = AcquireExceptionInfo();
14938
15133
 
14939
- new_image = (xformer)(image, &rect, &exception);
15134
+ new_image = (xformer)(image, &rect, exception);
14940
15135
 
14941
15136
  // An exception can occur in either the old or the new images
14942
15137
  rm_check_image_exception(image, RetainOnError);
14943
- rm_check_exception(&exception, new_image, DestroyOnError);
15138
+ rm_check_exception(exception, new_image, DestroyOnError);
14944
15139
 
14945
- (void) DestroyExceptionInfo(&exception);
15140
+ (void) DestroyExceptionInfo(exception);
14946
15141
 
14947
15142
  rm_ensure_result(new_image);
14948
15143