rmagick 2.13.3 → 2.13.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +21 -0
  3. data/.travis.yml +57 -0
  4. data/CONTRIBUTING.md +22 -0
  5. data/ChangeLog +47 -4
  6. data/Gemfile +7 -0
  7. data/{README.rc → README.textile} +34 -104
  8. data/Rakefile +160 -24
  9. data/before_install_linux.sh +12 -0
  10. data/before_install_osx.sh +2 -0
  11. data/doc/.cvsignore +1 -0
  12. data/doc/ex/images/image_with_profile.jpg +0 -0
  13. data/doc/ex/mask.rb +1 -1
  14. data/examples/identify.rb +1 -1
  15. data/ext/RMagick/extconf.rb +60 -23
  16. data/ext/RMagick/rmagick.c +15 -15
  17. data/ext/RMagick/rmagick.h +9 -7
  18. data/ext/RMagick/rmdraw.c +12 -12
  19. data/ext/RMagick/rmenum.c +2 -2
  20. data/ext/RMagick/rmfill.c +25 -25
  21. data/ext/RMagick/rmilist.c +121 -104
  22. data/ext/RMagick/rmimage.c +737 -546
  23. data/ext/RMagick/rminfo.c +15 -15
  24. data/ext/RMagick/rmmain.c +27 -3
  25. data/ext/RMagick/rmpixel.c +25 -27
  26. data/ext/RMagick/rmstruct.c +1 -1
  27. data/ext/RMagick/rmutil.c +18 -18
  28. data/lib/RMagick.rb +1 -1962
  29. data/lib/rmagick.rb +1 -0
  30. data/lib/rmagick/version.rb +3 -1
  31. data/lib/rmagick_internal.rb +1964 -0
  32. data/rmagick.gemspec +14 -5
  33. data/test/Image2.rb +7 -3
  34. data/test/Image3.rb +54 -23
  35. data/test/ImageList2.rb +1 -1
  36. data/test/Image_attributes.rb +27 -10
  37. data/test/Import_Export.rb +11 -1
  38. data/test/Info.rb +4 -4
  39. data/test/Magick.rb +14 -54
  40. data/test/Pixel.rb +3 -4
  41. data/test/{all_basic.rb → test_all_basic.rb} +9 -17
  42. data/test/tmpnam_test.rb +50 -0
  43. metadata +50 -21
  44. data/README +0 -15
  45. data/README-Mac-OSX.txt +0 -1
  46. data/build_tarball.rake +0 -215
  47. data/lib/rvg/to_c.rb +0 -103
  48. data/metaconfig +0 -7
  49. data/pkg/rmagick-2.13.3.rc1.gem +0 -0
  50. data/post-clean.rb +0 -12
  51. data/post-install.rb +0 -50
  52. data/post-setup.rb +0 -254
  53. data/setup.rb +0 -1585
  54. data/uninstall.rb +0 -76
@@ -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
 
@@ -3038,7 +3038,7 @@ VALUE Image_combine(int argc, VALUE *argv, VALUE self)
3038
3038
  {
3039
3039
  ChannelType channel = 0;
3040
3040
  Image *image, *images = NULL, *new_image;
3041
- ExceptionInfo exception;
3041
+ ExceptionInfo *exception;
3042
3042
 
3043
3043
  self = self; // defeat "unreferenced argument" message
3044
3044
 
@@ -3082,10 +3082,10 @@ VALUE Image_combine(int argc, VALUE *argv, VALUE self)
3082
3082
  rb_raise(rb_eArgError, "no images to combine");
3083
3083
  }
3084
3084
 
3085
- GetExceptionInfo(&exception);
3085
+ exception = AcquireExceptionInfo();
3086
3086
  ReverseImageList(&images);
3087
- new_image = CombineImages(images, channel, &exception);
3088
- rm_check_exception(&exception, images, RetainOnError);
3087
+ new_image = CombineImages(images, channel, exception);
3088
+ rm_check_exception(exception, images, RetainOnError);
3089
3089
  rm_split(images);
3090
3090
 
3091
3091
  rm_ensure_result(new_image);
@@ -3129,7 +3129,7 @@ Image_compare_channel(int argc, VALUE *argv, VALUE self)
3129
3129
  volatile VALUE ary, ref;
3130
3130
  MetricType metric_type;
3131
3131
  ChannelType channels;
3132
- ExceptionInfo exception;
3132
+ ExceptionInfo *exception;
3133
3133
 
3134
3134
  image = rm_check_destroyed(self);
3135
3135
 
@@ -3151,16 +3151,16 @@ Image_compare_channel(int argc, VALUE *argv, VALUE self)
3151
3151
 
3152
3152
  VALUE_TO_ENUM(argv[1], metric_type, MetricType);
3153
3153
 
3154
- GetExceptionInfo(&exception);
3154
+ exception = AcquireExceptionInfo();
3155
3155
  difference_image = CompareImageChannels(image
3156
3156
  , r_image
3157
3157
  , channels
3158
3158
  , metric_type
3159
3159
  , &distortion
3160
- , &exception);
3161
- rm_check_exception(&exception, difference_image, DestroyOnError);
3160
+ , exception);
3161
+ rm_check_exception(exception, difference_image, DestroyOnError);
3162
3162
 
3163
- (void) DestroyExceptionInfo(&exception);
3163
+ (void) DestroyExceptionInfo(exception);
3164
3164
 
3165
3165
  rm_ensure_result(difference_image);
3166
3166
 
@@ -3828,7 +3828,7 @@ Image_constitute(VALUE class, VALUE width_arg, VALUE height_arg
3828
3828
  , VALUE map_arg, VALUE pixels_arg)
3829
3829
  {
3830
3830
  Image *image;
3831
- ExceptionInfo exception;
3831
+ ExceptionInfo *exception;
3832
3832
  volatile VALUE pixel, pixel0;
3833
3833
  unsigned long width, height;
3834
3834
  long x, npixels;
@@ -3913,7 +3913,7 @@ Image_constitute(VALUE class, VALUE width_arg, VALUE height_arg
3913
3913
  }
3914
3914
  }
3915
3915
 
3916
- GetExceptionInfo(&exception);
3916
+ exception = AcquireExceptionInfo();
3917
3917
 
3918
3918
  // This is based on ConstituteImage in IM 5.5.7
3919
3919
  image = AcquireImage(NULL);
@@ -3932,8 +3932,10 @@ Image_constitute(VALUE class, VALUE width_arg, VALUE height_arg
3932
3932
  xfree(pixels.v);
3933
3933
  rm_check_image_exception(image, DestroyOnError);
3934
3934
 
3935
- (void) DestroyExceptionInfo(&exception);
3935
+ (void) DestroyExceptionInfo(exception);
3936
+ #if defined(HAVE_DESTROYCONSTITUTE) || defined(HAVE_CONSTITUTECOMPONENTTERMINUS)
3936
3937
  DestroyConstitute();
3938
+ #endif
3937
3939
 
3938
3940
  return rm_image_new(image);
3939
3941
  }
@@ -4105,7 +4107,7 @@ Image_convolve(VALUE self, VALUE order_arg, VALUE kernel_arg)
4105
4107
  Image *image, *new_image;
4106
4108
  double *kernel;
4107
4109
  unsigned int x, order;
4108
- ExceptionInfo exception;
4110
+ ExceptionInfo *exception;
4109
4111
 
4110
4112
  image = rm_check_destroyed(self);
4111
4113
 
@@ -4122,13 +4124,13 @@ Image_convolve(VALUE self, VALUE order_arg, VALUE kernel_arg)
4122
4124
  kernel[x] = NUM2DBL(rb_ary_entry(kernel_arg, (long)x));
4123
4125
  }
4124
4126
 
4125
- GetExceptionInfo(&exception);
4127
+ exception = AcquireExceptionInfo();
4126
4128
 
4127
- new_image = ConvolveImage((const Image *)image, order, (double *)kernel, &exception);
4129
+ new_image = ConvolveImage((const Image *)image, order, (double *)kernel, exception);
4128
4130
  xfree((void *)kernel);
4129
- rm_check_exception(&exception, new_image, DestroyOnError);
4131
+ rm_check_exception(exception, new_image, DestroyOnError);
4130
4132
 
4131
- (void) DestroyExceptionInfo(&exception);
4133
+ (void) DestroyExceptionInfo(exception);
4132
4134
 
4133
4135
  rm_ensure_result(new_image);
4134
4136
 
@@ -4157,7 +4159,7 @@ Image_convolve_channel(int argc, VALUE *argv, VALUE self)
4157
4159
  volatile VALUE ary;
4158
4160
  unsigned int x, order;
4159
4161
  ChannelType channels;
4160
- ExceptionInfo exception;
4162
+ ExceptionInfo *exception;
4161
4163
 
4162
4164
  image = rm_check_destroyed(self);
4163
4165
 
@@ -4186,13 +4188,13 @@ Image_convolve_channel(int argc, VALUE *argv, VALUE self)
4186
4188
  kernel[x] = NUM2DBL(rb_ary_entry(ary, (long)x));
4187
4189
  }
4188
4190
 
4189
- GetExceptionInfo(&exception);
4191
+ exception = AcquireExceptionInfo();
4190
4192
 
4191
- new_image = ConvolveImageChannel(image, channels, order, kernel, &exception);
4193
+ new_image = ConvolveImageChannel(image, channels, order, kernel, exception);
4192
4194
  xfree((void *)kernel);
4193
- rm_check_exception(&exception, new_image, DestroyOnError);
4195
+ rm_check_exception(exception, new_image, DestroyOnError);
4194
4196
 
4195
- (void) DestroyExceptionInfo(&exception);
4197
+ (void) DestroyExceptionInfo(exception);
4196
4198
 
4197
4199
  rm_ensure_result(new_image);
4198
4200
 
@@ -4424,24 +4426,24 @@ Image_decipher(VALUE self, VALUE passphrase)
4424
4426
  #if defined(HAVE_ENCIPHERIMAGE)
4425
4427
  Image *image, *new_image;
4426
4428
  char *pf;
4427
- ExceptionInfo exception;
4429
+ ExceptionInfo *exception;
4428
4430
  MagickBooleanType okay;
4429
4431
 
4430
4432
  image = rm_check_destroyed(self);
4431
4433
  pf = StringValuePtr(passphrase); // ensure passphrase is a string
4432
- GetExceptionInfo(&exception);
4434
+ exception = AcquireExceptionInfo();
4433
4435
 
4434
4436
  new_image = rm_clone_image(image);
4435
4437
 
4436
- okay = DecipherImage(new_image, pf, &exception);
4437
- rm_check_exception(&exception, new_image, DestroyOnError);
4438
+ okay = DecipherImage(new_image, pf, exception);
4439
+ rm_check_exception(exception, new_image, DestroyOnError);
4438
4440
  if (!okay)
4439
4441
  {
4440
4442
  new_image = DestroyImage(new_image);
4441
4443
  rb_raise(rb_eRuntimeError, "DecipherImage failed for unknown reason.");
4442
4444
  }
4443
4445
 
4444
- DestroyExceptionInfo(&exception);
4446
+ DestroyExceptionInfo(exception);
4445
4447
 
4446
4448
  return rm_image_new(new_image);
4447
4449
  #else
@@ -4575,15 +4577,15 @@ Image_depth(VALUE self)
4575
4577
  {
4576
4578
  Image *image;
4577
4579
  unsigned long depth = 0;
4578
- ExceptionInfo exception;
4580
+ ExceptionInfo *exception;
4579
4581
 
4580
4582
  image = rm_check_destroyed(self);
4581
- GetExceptionInfo(&exception);
4583
+ exception = AcquireExceptionInfo();
4582
4584
 
4583
- depth = GetImageDepth(image, &exception);
4585
+ depth = GetImageDepth(image, exception);
4584
4586
  CHECK_EXCEPTION()
4585
4587
 
4586
- (void) DestroyExceptionInfo(&exception);
4588
+ (void) DestroyExceptionInfo(exception);
4587
4589
 
4588
4590
  return INT2FIX(depth);
4589
4591
  }
@@ -4614,7 +4616,7 @@ Image_deskew(int argc, VALUE *argv, VALUE self)
4614
4616
  double threshold = 40.0 * QuantumRange / 100.0;
4615
4617
  unsigned long width;
4616
4618
  char auto_crop_width[20];
4617
- ExceptionInfo exception;
4619
+ ExceptionInfo *exception;
4618
4620
 
4619
4621
  image = rm_check_destroyed(self);
4620
4622
 
@@ -4634,12 +4636,12 @@ Image_deskew(int argc, VALUE *argv, VALUE self)
4634
4636
  break;
4635
4637
  }
4636
4638
 
4637
- GetExceptionInfo(&exception);
4638
- new_image = DeskewImage(image, threshold, &exception);
4639
+ exception = AcquireExceptionInfo();
4640
+ new_image = DeskewImage(image, threshold, exception);
4639
4641
  CHECK_EXCEPTION()
4640
4642
  rm_ensure_result(new_image);
4641
4643
 
4642
- (void) DestroyExceptionInfo(&exception);
4644
+ (void) DestroyExceptionInfo(exception);
4643
4645
 
4644
4646
  return rm_image_new(new_image);
4645
4647
  #else
@@ -4666,15 +4668,15 @@ VALUE
4666
4668
  Image_despeckle(VALUE self)
4667
4669
  {
4668
4670
  Image *image, *new_image;
4669
- ExceptionInfo exception;
4671
+ ExceptionInfo *exception;
4670
4672
 
4671
4673
  image = rm_check_destroyed(self);
4672
- GetExceptionInfo(&exception);
4674
+ exception = AcquireExceptionInfo();
4673
4675
 
4674
- new_image = DespeckleImage(image, &exception);
4675
- rm_check_exception(&exception, new_image, DestroyOnError);
4676
+ new_image = DespeckleImage(image, exception);
4677
+ rm_check_exception(exception, new_image, DestroyOnError);
4676
4678
 
4677
- (void) DestroyExceptionInfo(&exception);
4679
+ (void) DestroyExceptionInfo(exception);
4678
4680
 
4679
4681
  rm_ensure_result(new_image);
4680
4682
 
@@ -4866,7 +4868,7 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
4866
4868
  char *map;
4867
4869
  long mapL;
4868
4870
  MagickBooleanType okay;
4869
- ExceptionInfo exception;
4871
+ ExceptionInfo *exception;
4870
4872
  volatile union
4871
4873
  {
4872
4874
  Quantum *i;
@@ -4901,8 +4903,8 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
4901
4903
 
4902
4904
  Data_Get_Struct(self, Image, image);
4903
4905
 
4904
- GetExceptionInfo(&exception);
4905
- 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);
4906
4908
 
4907
4909
  if (!okay)
4908
4910
  {
@@ -4911,7 +4913,7 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
4911
4913
 
4912
4914
  CHECK_EXCEPTION()
4913
4915
 
4914
- (void) DestroyExceptionInfo(&exception);
4916
+ (void) DestroyExceptionInfo(exception);
4915
4917
 
4916
4918
  // Convert the pixel data to the appropriate Ruby type
4917
4919
  if (stg_type == QuantumPixel)
@@ -5102,7 +5104,7 @@ Image_distort(int argc, VALUE *argv, VALUE self)
5102
5104
  DistortImageMethod distortion_method;
5103
5105
  double *points;
5104
5106
  MagickBooleanType bestfit = MagickFalse;
5105
- ExceptionInfo exception;
5107
+ ExceptionInfo *exception;
5106
5108
 
5107
5109
  image = rm_check_destroyed(self);
5108
5110
  rm_get_optional_arguments(self);
@@ -5131,11 +5133,11 @@ Image_distort(int argc, VALUE *argv, VALUE self)
5131
5133
  points[n] = NUM2DBL(rb_ary_entry(pts, n));
5132
5134
  }
5133
5135
 
5134
- GetExceptionInfo(&exception);
5135
- new_image = DistortImage(image, distortion_method, npoints, points, bestfit, &exception);
5136
+ exception = AcquireExceptionInfo();
5137
+ new_image = DistortImage(image, distortion_method, npoints, points, bestfit, exception);
5136
5138
  xfree(points);
5137
- rm_check_exception(&exception, new_image, DestroyOnError);
5138
- (void) DestroyExceptionInfo(&exception);
5139
+ rm_check_exception(exception, new_image, DestroyOnError);
5140
+ (void) DestroyExceptionInfo(exception);
5139
5141
  rm_ensure_result(new_image);
5140
5142
 
5141
5143
  return rm_image_new(new_image);
@@ -5163,7 +5165,7 @@ Image_distortion_channel(int argc, VALUE *argv, VALUE self)
5163
5165
  {
5164
5166
  Image *image, *reconstruct;
5165
5167
  ChannelType channels;
5166
- ExceptionInfo exception;
5168
+ ExceptionInfo *exception;
5167
5169
  MetricType metric;
5168
5170
  volatile VALUE rec;
5169
5171
  double distortion;
@@ -5182,12 +5184,12 @@ Image_distortion_channel(int argc, VALUE *argv, VALUE self)
5182
5184
  rec = rm_cur_image(argv[0]);
5183
5185
  reconstruct = rm_check_destroyed(rec);
5184
5186
  VALUE_TO_ENUM(argv[1], metric, MetricType);
5185
- GetExceptionInfo(&exception);
5187
+ exception = AcquireExceptionInfo();
5186
5188
  (void) GetImageChannelDistortion(image, reconstruct, channels
5187
- , metric, &distortion, &exception);
5189
+ , metric, &distortion, exception);
5188
5190
  CHECK_EXCEPTION()
5189
5191
 
5190
- (void) DestroyExceptionInfo(&exception);
5192
+ (void) DestroyExceptionInfo(exception);
5191
5193
 
5192
5194
  return rb_float_new(distortion);
5193
5195
  }
@@ -5216,7 +5218,7 @@ Image__dump(VALUE self, VALUE depth)
5216
5218
  size_t length;
5217
5219
  DumpedImage mi;
5218
5220
  volatile VALUE str;
5219
- ExceptionInfo exception;
5221
+ ExceptionInfo *exception;
5220
5222
 
5221
5223
  depth = depth; // Suppress "never referenced" message from icc
5222
5224
 
@@ -5229,15 +5231,15 @@ Image__dump(VALUE self, VALUE depth)
5229
5231
  }
5230
5232
  strcpy(info->magick, image->magick);
5231
5233
 
5232
- GetExceptionInfo(&exception);
5233
- blob = ImageToBlob(info, image, &length, &exception);
5234
+ exception = AcquireExceptionInfo();
5235
+ blob = ImageToBlob(info, image, &length, exception);
5234
5236
 
5235
5237
  // Free ImageInfo first - error handling may raise an exception
5236
5238
  (void) DestroyImageInfo(info);
5237
5239
 
5238
5240
  CHECK_EXCEPTION()
5239
5241
 
5240
- (void) DestroyExceptionInfo(&exception);
5242
+ (void) DestroyExceptionInfo(exception);
5241
5243
 
5242
5244
  if (!blob)
5243
5245
  {
@@ -5356,7 +5358,7 @@ Image_edge(int argc, VALUE *argv, VALUE self)
5356
5358
  {
5357
5359
  Image *image, *new_image;
5358
5360
  double radius = 0.0;
5359
- ExceptionInfo exception;
5361
+ ExceptionInfo *exception;
5360
5362
 
5361
5363
  image = rm_check_destroyed(self);
5362
5364
  switch (argc)
@@ -5370,12 +5372,12 @@ Image_edge(int argc, VALUE *argv, VALUE self)
5370
5372
  break;
5371
5373
  }
5372
5374
 
5373
- GetExceptionInfo(&exception);
5375
+ exception = AcquireExceptionInfo();
5374
5376
 
5375
- new_image = EdgeImage(image, radius, &exception);
5376
- rm_check_exception(&exception, new_image, DestroyOnError);
5377
+ new_image = EdgeImage(image, radius, exception);
5378
+ rm_check_exception(exception, new_image, DestroyOnError);
5377
5379
 
5378
- (void) DestroyExceptionInfo(&exception);
5380
+ (void) DestroyExceptionInfo(exception);
5379
5381
 
5380
5382
  rm_ensure_result(new_image);
5381
5383
 
@@ -5398,7 +5400,7 @@ static VALUE
5398
5400
  effect_image(VALUE self, int argc, VALUE *argv, effector_t effector)
5399
5401
  {
5400
5402
  Image *image, *new_image;
5401
- ExceptionInfo exception;
5403
+ ExceptionInfo *exception;
5402
5404
  double radius = 0.0, sigma = 1.0;
5403
5405
 
5404
5406
  image = rm_check_destroyed(self);
@@ -5421,11 +5423,11 @@ effect_image(VALUE self, int argc, VALUE *argv, effector_t effector)
5421
5423
  rb_raise(rb_eArgError, "sigma must be != 0.0");
5422
5424
  }
5423
5425
 
5424
- GetExceptionInfo(&exception);
5425
- new_image = (effector)(image, radius, sigma, &exception);
5426
- 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);
5427
5429
 
5428
- (void) DestroyExceptionInfo(&exception);
5430
+ (void) DestroyExceptionInfo(exception);
5429
5431
 
5430
5432
  rm_ensure_result(new_image);
5431
5433
 
@@ -5474,24 +5476,24 @@ Image_encipher(VALUE self, VALUE passphrase)
5474
5476
  #if defined(HAVE_ENCIPHERIMAGE)
5475
5477
  Image *image, *new_image;
5476
5478
  char *pf;
5477
- ExceptionInfo exception;
5479
+ ExceptionInfo *exception;
5478
5480
  MagickBooleanType okay;
5479
5481
 
5480
5482
  image = rm_check_destroyed(self);
5481
5483
  pf = StringValuePtr(passphrase); // ensure passphrase is a string
5482
- GetExceptionInfo(&exception);
5484
+ exception = AcquireExceptionInfo();
5483
5485
 
5484
5486
  new_image = rm_clone_image(image);
5485
5487
 
5486
- okay = EncipherImage(new_image, pf, &exception);
5487
- rm_check_exception(&exception, new_image, DestroyOnError);
5488
+ okay = EncipherImage(new_image, pf, exception);
5489
+ rm_check_exception(exception, new_image, DestroyOnError);
5488
5490
  if (!okay)
5489
5491
  {
5490
5492
  new_image = DestroyImage(new_image);
5491
5493
  rb_raise(rb_eRuntimeError, "EncipherImage failed for unknown reason.");
5492
5494
  }
5493
5495
 
5494
- DestroyExceptionInfo(&exception);
5496
+ DestroyExceptionInfo(exception);
5495
5497
 
5496
5498
  return rm_image_new(new_image);
5497
5499
  #else
@@ -5552,15 +5554,15 @@ VALUE
5552
5554
  Image_enhance(VALUE self)
5553
5555
  {
5554
5556
  Image *image, *new_image;
5555
- ExceptionInfo exception;
5557
+ ExceptionInfo *exception;
5556
5558
 
5557
5559
  image = rm_check_destroyed(self);
5558
- GetExceptionInfo(&exception);
5560
+ exception = AcquireExceptionInfo();
5559
5561
 
5560
- new_image = EnhanceImage(image, &exception);
5561
- rm_check_exception(&exception, new_image, DestroyOnError);
5562
+ new_image = EnhanceImage(image, exception);
5563
+ rm_check_exception(exception, new_image, DestroyOnError);
5562
5564
 
5563
- (void) DestroyExceptionInfo(&exception);
5565
+ (void) DestroyExceptionInfo(exception);
5564
5566
 
5565
5567
  rm_ensure_result(new_image);
5566
5568
 
@@ -5581,16 +5583,16 @@ VALUE
5581
5583
  Image_equalize(VALUE self)
5582
5584
  {
5583
5585
  Image *image, *new_image;
5584
- ExceptionInfo exception;
5586
+ ExceptionInfo *exception;
5585
5587
 
5586
5588
  image = rm_check_destroyed(self);
5587
- GetExceptionInfo(&exception);
5589
+ exception = AcquireExceptionInfo();
5588
5590
  new_image = rm_clone_image(image);
5589
5591
 
5590
5592
  (void) EqualizeImage(new_image);
5591
5593
  rm_check_image_exception(new_image, DestroyOnError);
5592
5594
 
5593
- (void) DestroyExceptionInfo(&exception);
5595
+ (void) DestroyExceptionInfo(exception);
5594
5596
 
5595
5597
  return rm_image_new(new_image);
5596
5598
  }
@@ -5617,7 +5619,7 @@ Image_equalize_channel(int argc, VALUE *argv, VALUE self)
5617
5619
  {
5618
5620
  #if defined(HAVE_EQUALIZEIMAGECHANNEL)
5619
5621
  Image *image, *new_image;
5620
- ExceptionInfo exception;
5622
+ ExceptionInfo *exception;
5621
5623
  ChannelType channels;
5622
5624
 
5623
5625
  image = rm_check_destroyed(self);
@@ -5629,12 +5631,12 @@ Image_equalize_channel(int argc, VALUE *argv, VALUE self)
5629
5631
 
5630
5632
  new_image = rm_clone_image(image);
5631
5633
 
5632
- GetExceptionInfo(&exception);
5634
+ exception = AcquireExceptionInfo();
5633
5635
 
5634
5636
  (void) EqualizeImageChannel(new_image, channels);
5635
5637
 
5636
5638
  rm_check_image_exception(new_image, DestroyOnError);
5637
- (void) DestroyExceptionInfo(&exception);
5639
+ (void) DestroyExceptionInfo(exception);
5638
5640
 
5639
5641
  return rm_image_new(new_image);
5640
5642
  #else
@@ -5697,7 +5699,7 @@ excerpt(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
5697
5699
  {
5698
5700
  Image *image, *new_image;
5699
5701
  RectangleInfo rect;
5700
- ExceptionInfo exception;
5702
+ ExceptionInfo *exception;
5701
5703
 
5702
5704
  memset(&rect,'\0', sizeof(rect));
5703
5705
  rect.x = NUM2LONG(x);
@@ -5707,10 +5709,10 @@ excerpt(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
5707
5709
 
5708
5710
  Data_Get_Struct(self, Image, image);
5709
5711
 
5710
- GetExceptionInfo(&exception);
5711
- new_image = ExcerptImage(image, &rect, &exception);
5712
- rm_check_exception(&exception, new_image, DestroyOnError);
5713
- DestroyExceptionInfo(&exception);
5712
+ exception = AcquireExceptionInfo();
5713
+ new_image = ExcerptImage(image, &rect, exception);
5714
+ rm_check_exception(exception, new_image, DestroyOnError);
5715
+ DestroyExceptionInfo(exception);
5714
5716
  rm_ensure_result(new_image);
5715
5717
 
5716
5718
  if (bang)
@@ -5808,7 +5810,7 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self)
5808
5810
  const char *map = "RGB";
5809
5811
  Quantum *pixels;
5810
5812
  volatile VALUE ary;
5811
- ExceptionInfo exception;
5813
+ ExceptionInfo *exception;
5812
5814
 
5813
5815
 
5814
5816
  image = rm_check_destroyed(self);
@@ -5849,9 +5851,9 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self)
5849
5851
  return rb_ary_new2(0L);
5850
5852
  }
5851
5853
 
5852
- GetExceptionInfo(&exception);
5854
+ exception = AcquireExceptionInfo();
5853
5855
 
5854
- 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);
5855
5857
  if (!okay)
5856
5858
  {
5857
5859
  xfree((void *)pixels);
@@ -5861,7 +5863,7 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self)
5861
5863
  rm_magick_error("ExportImagePixels failed with no explanation.", NULL);
5862
5864
  }
5863
5865
 
5864
- (void) DestroyExceptionInfo(&exception);
5866
+ (void) DestroyExceptionInfo(exception);
5865
5867
 
5866
5868
  ary = rb_ary_new2(npixels);
5867
5869
  for (n = 0; n < npixels; n++)
@@ -5898,7 +5900,7 @@ Image_extent(int argc, VALUE *argv, VALUE self)
5898
5900
  Image *image, *new_image;
5899
5901
  RectangleInfo geometry;
5900
5902
  long height, width;
5901
- ExceptionInfo exception;
5903
+ ExceptionInfo *exception;
5902
5904
 
5903
5905
  (void) rm_check_destroyed(self);
5904
5906
 
@@ -5936,11 +5938,11 @@ Image_extent(int argc, VALUE *argv, VALUE self)
5936
5938
 
5937
5939
 
5938
5940
  Data_Get_Struct(self, Image, image);
5939
- GetExceptionInfo(&exception);
5941
+ exception = AcquireExceptionInfo();
5940
5942
 
5941
- new_image = ExtentImage(image, &geometry, &exception);
5942
- rm_check_exception(&exception, new_image, DestroyOnError);
5943
- (void) DestroyExceptionInfo(&exception);
5943
+ new_image = ExtentImage(image, &geometry, exception);
5944
+ rm_check_exception(exception, new_image, DestroyOnError);
5945
+ (void) DestroyExceptionInfo(exception);
5944
5946
  rm_ensure_result(new_image);
5945
5947
  return rm_image_new(new_image);
5946
5948
  }
@@ -5984,7 +5986,7 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
5984
5986
  StorageType type = CharPixel;
5985
5987
  volatile VALUE string;
5986
5988
  char *str;
5987
- ExceptionInfo exception;
5989
+ ExceptionInfo *exception;
5988
5990
 
5989
5991
  image = rm_check_destroyed(self);
5990
5992
  cols = image->columns;
@@ -6055,9 +6057,9 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
6055
6057
  (void) rb_str_resize(string, (long)(sz * npixels));
6056
6058
  str = StringValuePtr(string);
6057
6059
 
6058
- GetExceptionInfo(&exception);
6060
+ exception = AcquireExceptionInfo();
6059
6061
 
6060
- 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);
6061
6063
  if (!okay)
6062
6064
  {
6063
6065
  // Let GC have the string buffer.
@@ -6068,7 +6070,7 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
6068
6070
  rm_magick_error("ExportImagePixels failed with no explanation.", NULL);
6069
6071
  }
6070
6072
 
6071
- (void) DestroyExceptionInfo(&exception);
6073
+ (void) DestroyExceptionInfo(exception);
6072
6074
 
6073
6075
  return string;
6074
6076
  }
@@ -6196,8 +6198,8 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self)
6196
6198
  {
6197
6199
  Image *image, *target;
6198
6200
  volatile VALUE region, targ;
6199
- long x = 0L, y = 0L;
6200
- ExceptionInfo exception;
6201
+ ssize_t x = 0L, y = 0L;
6202
+ ExceptionInfo *exception;
6201
6203
  unsigned int okay;
6202
6204
 
6203
6205
  image = rm_check_destroyed(self);
@@ -6217,10 +6219,10 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self)
6217
6219
  break;
6218
6220
  }
6219
6221
 
6220
- GetExceptionInfo(&exception);
6221
- okay = IsImageSimilar(image, target, &x, &y, &exception);
6222
+ exception = AcquireExceptionInfo();
6223
+ okay = IsImageSimilar(image, target, &x, &y, exception);
6222
6224
  CHECK_EXCEPTION();
6223
- (void) DestroyExceptionInfo(&exception);
6225
+ (void) DestroyExceptionInfo(exception);
6224
6226
 
6225
6227
  if (!okay)
6226
6228
  {
@@ -6253,15 +6255,15 @@ static VALUE
6253
6255
  flipflop(int bang, VALUE self, flipper_t flipflopper)
6254
6256
  {
6255
6257
  Image *image, *new_image;
6256
- ExceptionInfo exception;
6258
+ ExceptionInfo *exception;
6257
6259
 
6258
6260
  Data_Get_Struct(self, Image, image);
6259
- GetExceptionInfo(&exception);
6261
+ exception = AcquireExceptionInfo();
6260
6262
 
6261
- new_image = (flipflopper)(image, &exception);
6262
- rm_check_exception(&exception, new_image, DestroyOnError);
6263
+ new_image = (flipflopper)(image, exception);
6264
+ rm_check_exception(exception, new_image, DestroyOnError);
6263
6265
 
6264
- (void) DestroyExceptionInfo(&exception);
6266
+ (void) DestroyExceptionInfo(exception);
6265
6267
 
6266
6268
  rm_ensure_result(new_image);
6267
6269
 
@@ -6381,16 +6383,16 @@ Image_format(VALUE self)
6381
6383
  {
6382
6384
  Image *image;
6383
6385
  const MagickInfo *magick_info;
6384
- ExceptionInfo exception;
6386
+ ExceptionInfo *exception;
6385
6387
 
6386
6388
  image = rm_check_destroyed(self);
6387
6389
 
6388
6390
  if (*image->magick)
6389
6391
  {
6390
6392
  // Deliberately ignore the exception info!
6391
- GetExceptionInfo(&exception);
6392
- magick_info = GetMagickInfo(image->magick, &exception);
6393
- (void) DestroyExceptionInfo(&exception);
6393
+ exception = AcquireExceptionInfo();
6394
+ magick_info = GetMagickInfo(image->magick, exception);
6395
+ (void) DestroyExceptionInfo(exception);
6394
6396
  return magick_info ? rb_str_new2(magick_info->name) : Qnil;
6395
6397
  }
6396
6398
 
@@ -6414,17 +6416,17 @@ Image_format_eq(VALUE self, VALUE magick)
6414
6416
  Image *image;
6415
6417
  const MagickInfo *m;
6416
6418
  char *mgk;
6417
- ExceptionInfo exception;
6419
+ ExceptionInfo *exception;
6418
6420
 
6419
6421
  image = rm_check_frozen(self);
6420
6422
 
6421
- GetExceptionInfo(&exception);
6423
+ exception = AcquireExceptionInfo();
6422
6424
 
6423
6425
  mgk = StringValuePtr(magick);
6424
- m = GetMagickInfo(mgk, &exception);
6426
+ m = GetMagickInfo(mgk, exception);
6425
6427
  CHECK_EXCEPTION()
6426
6428
 
6427
- (void) DestroyExceptionInfo(&exception);
6429
+ (void) DestroyExceptionInfo(exception);
6428
6430
 
6429
6431
  if (!m)
6430
6432
  {
@@ -6477,7 +6479,7 @@ VALUE
6477
6479
  Image_frame(int argc, VALUE *argv, VALUE self)
6478
6480
  {
6479
6481
  Image *image, *new_image;
6480
- ExceptionInfo exception;
6482
+ ExceptionInfo *exception;
6481
6483
  FrameInfo frame_info;
6482
6484
 
6483
6485
  image = rm_check_destroyed(self);
@@ -6512,11 +6514,11 @@ Image_frame(int argc, VALUE *argv, VALUE self)
6512
6514
  break;
6513
6515
  }
6514
6516
 
6515
- GetExceptionInfo(&exception);
6516
- new_image = FrameImage(image, &frame_info, &exception);
6517
- 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);
6518
6520
 
6519
- (void) DestroyExceptionInfo(&exception);
6521
+ (void) DestroyExceptionInfo(exception);
6520
6522
 
6521
6523
  rm_ensure_result(new_image);
6522
6524
 
@@ -6540,7 +6542,7 @@ Image_from_blob(VALUE class, VALUE blob_arg)
6540
6542
  Image *images;
6541
6543
  Info *info;
6542
6544
  volatile VALUE info_obj;
6543
- ExceptionInfo exception;
6545
+ ExceptionInfo *exception;
6544
6546
  void *blob;
6545
6547
  long length;
6546
6548
 
@@ -6553,11 +6555,11 @@ Image_from_blob(VALUE class, VALUE blob_arg)
6553
6555
  info_obj = rm_info_new();
6554
6556
  Data_Get_Struct(info_obj, Info, info);
6555
6557
 
6556
- GetExceptionInfo(&exception);
6557
- images = BlobToImage(info, blob, (size_t)length, &exception);
6558
- 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);
6559
6561
 
6560
- (void) DestroyExceptionInfo(&exception);
6562
+ (void) DestroyExceptionInfo(exception);
6561
6563
 
6562
6564
  rm_ensure_result(images);
6563
6565
  rm_set_user_artifact(images, info);
@@ -6592,7 +6594,7 @@ Image_function_channel(int argc, VALUE *argv, VALUE self)
6592
6594
  volatile double *parameters;
6593
6595
  double *parms;
6594
6596
  ChannelType channels;
6595
- ExceptionInfo exception;
6597
+ ExceptionInfo *exception;
6596
6598
 
6597
6599
  image = rm_check_destroyed(self);
6598
6600
  channels = extract_channels(&argc, argv);
@@ -6644,12 +6646,12 @@ Image_function_channel(int argc, VALUE *argv, VALUE self)
6644
6646
  parms[n] = NUM2DBL(argv[n]);
6645
6647
  }
6646
6648
 
6647
- GetExceptionInfo(&exception);
6649
+ exception = AcquireExceptionInfo();
6648
6650
  new_image = rm_clone_image(image);
6649
- (void) FunctionImageChannel(new_image, channels, function, nparms, parms, &exception);
6651
+ (void) FunctionImageChannel(new_image, channels, function, nparms, parms, exception);
6650
6652
  (void) xfree(parms);
6651
- rm_check_exception(&exception, new_image, DestroyOnError);
6652
- DestroyExceptionInfo(&exception);
6653
+ rm_check_exception(exception, new_image, DestroyOnError);
6654
+ DestroyExceptionInfo(exception);
6653
6655
 
6654
6656
  return rm_image_new(new_image);
6655
6657
  #else
@@ -6856,7 +6858,7 @@ Image_gaussian_blur_channel(int argc, VALUE *argv, VALUE self)
6856
6858
  {
6857
6859
  Image *image, *new_image;
6858
6860
  ChannelType channels;
6859
- ExceptionInfo exception;
6861
+ ExceptionInfo *exception;
6860
6862
  double radius = 0.0, sigma = 1.0;
6861
6863
 
6862
6864
  image = rm_check_destroyed(self);
@@ -6877,11 +6879,11 @@ Image_gaussian_blur_channel(int argc, VALUE *argv, VALUE self)
6877
6879
  raise_ChannelType_error(argv[argc-1]);
6878
6880
  }
6879
6881
 
6880
- GetExceptionInfo(&exception);
6881
- new_image = GaussianBlurImageChannel(image, channels, radius, sigma, &exception);
6882
- 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);
6883
6885
 
6884
- (void) DestroyExceptionInfo(&exception);
6886
+ (void) DestroyExceptionInfo(exception);
6885
6887
 
6886
6888
  return rm_image_new(new_image);
6887
6889
  }
@@ -6964,7 +6966,7 @@ Image_get_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, VALUE row
6964
6966
  {
6965
6967
  Image *image;
6966
6968
  const PixelPacket *pixels;
6967
- ExceptionInfo exception;
6969
+ ExceptionInfo *exception;
6968
6970
  long x, y;
6969
6971
  unsigned long columns, rows;
6970
6972
  long size, n;
@@ -6984,15 +6986,15 @@ Image_get_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, VALUE row
6984
6986
 
6985
6987
  // Cast AcquireImagePixels to get rid of the const qualifier. We're not going
6986
6988
  // to change the pixels but I don't want to make "pixels" const.
6987
- GetExceptionInfo(&exception);
6989
+ exception = AcquireExceptionInfo();
6988
6990
  #if defined(HAVE_GETVIRTUALPIXELS)
6989
- pixels = GetVirtualPixels(image, x, y, columns, rows, &exception);
6991
+ pixels = GetVirtualPixels(image, x, y, columns, rows, exception);
6990
6992
  #else
6991
- pixels = AcquireImagePixels(image, x, y, columns, rows, &exception);
6993
+ pixels = AcquireImagePixels(image, x, y, columns, rows, exception);
6992
6994
  #endif
6993
6995
  CHECK_EXCEPTION()
6994
6996
 
6995
- (void) DestroyExceptionInfo(&exception);
6997
+ (void) DestroyExceptionInfo(exception);
6996
6998
 
6997
6999
  // If the function failed, return a 0-length array.
6998
7000
  if (!pixels)
@@ -7027,13 +7029,13 @@ static VALUE
7027
7029
  has_attribute(VALUE self, MagickBooleanType (attr_test)(const Image *, ExceptionInfo *))
7028
7030
  {
7029
7031
  Image *image;
7030
- ExceptionInfo exception;
7032
+ ExceptionInfo *exception;
7031
7033
  MagickBooleanType r;
7032
7034
 
7033
7035
  image = rm_check_destroyed(self);
7034
- GetExceptionInfo(&exception);
7036
+ exception = AcquireExceptionInfo();
7035
7037
 
7036
- r = (attr_test)(image, &exception);
7038
+ r = (attr_test)(image, exception);
7037
7039
  CHECK_EXCEPTION()
7038
7040
 
7039
7041
  return r ? Qtrue : Qfalse;
@@ -7095,7 +7097,7 @@ Image_implode(int argc, VALUE *argv, VALUE self)
7095
7097
  {
7096
7098
  Image *image, *new_image;
7097
7099
  double amount = 0.50;
7098
- ExceptionInfo exception;
7100
+ ExceptionInfo *exception;
7099
7101
 
7100
7102
  switch (argc)
7101
7103
  {
@@ -7108,11 +7110,11 @@ Image_implode(int argc, VALUE *argv, VALUE self)
7108
7110
  }
7109
7111
 
7110
7112
  image = rm_check_destroyed(self);
7111
- GetExceptionInfo(&exception);
7113
+ exception = AcquireExceptionInfo();
7112
7114
 
7113
- new_image = ImplodeImage(image, amount, &exception);
7114
- rm_check_exception(&exception, new_image, DestroyOnError);
7115
- (void) DestroyExceptionInfo(&exception);
7115
+ new_image = ImplodeImage(image, amount, exception);
7116
+ rm_check_exception(exception, new_image, DestroyOnError);
7117
+ (void) DestroyExceptionInfo(exception);
7116
7118
 
7117
7119
  rm_ensure_result(new_image);
7118
7120
 
@@ -7712,7 +7714,7 @@ Image_level_colors(int argc, VALUE *argv, VALUE self)
7712
7714
  Image *image, *new_image;
7713
7715
  MagickPixelPacket black_color, white_color;
7714
7716
  ChannelType channels;
7715
- ExceptionInfo exception;
7717
+ ExceptionInfo *exception;
7716
7718
  MagickBooleanType invert = MagickTrue;
7717
7719
  MagickBooleanType status;
7718
7720
 
@@ -7732,26 +7734,26 @@ Image_level_colors(int argc, VALUE *argv, VALUE self)
7732
7734
 
7733
7735
  case 1:
7734
7736
  Color_to_MagickPixelPacket(image, &black_color, argv[0]);
7735
- GetExceptionInfo(&exception);
7737
+ exception = AcquireExceptionInfo();
7736
7738
 
7737
7739
  GetMagickPixelPacket(image, &white_color);
7738
- (void) QueryMagickColor("white", &white_color, &exception);
7740
+ (void) QueryMagickColor("white", &white_color, exception);
7739
7741
  CHECK_EXCEPTION()
7740
7742
 
7741
- DestroyExceptionInfo(&exception);
7743
+ DestroyExceptionInfo(exception);
7742
7744
 
7743
7745
  case 0:
7744
- GetExceptionInfo(&exception);
7746
+ exception = AcquireExceptionInfo();
7745
7747
 
7746
7748
  GetMagickPixelPacket(image, &white_color);
7747
- (void) QueryMagickColor("white", &white_color, &exception);
7749
+ (void) QueryMagickColor("white", &white_color, exception);
7748
7750
  CHECK_EXCEPTION()
7749
7751
 
7750
7752
  GetMagickPixelPacket(image, &black_color);
7751
- (void) QueryMagickColor("black", &black_color, &exception);
7753
+ (void) QueryMagickColor("black", &black_color, exception);
7752
7754
  CHECK_EXCEPTION()
7753
7755
 
7754
- DestroyExceptionInfo(&exception);
7756
+ DestroyExceptionInfo(exception);
7755
7757
  break;
7756
7758
 
7757
7759
  default:
@@ -7917,7 +7919,7 @@ Image_liquid_rescale(int argc, VALUE *argv, VALUE self)
7917
7919
  unsigned long cols, rows;
7918
7920
  double delta_x = 0.0;
7919
7921
  double rigidity = 0.0;
7920
- ExceptionInfo exception;
7922
+ ExceptionInfo *exception;
7921
7923
 
7922
7924
  image = rm_check_destroyed(self);
7923
7925
 
@@ -7936,10 +7938,10 @@ Image_liquid_rescale(int argc, VALUE *argv, VALUE self)
7936
7938
  break;
7937
7939
  }
7938
7940
 
7939
- GetExceptionInfo(&exception);
7940
- new_image = LiquidRescaleImage(image, cols, rows, delta_x, rigidity, &exception);
7941
- rm_check_exception(&exception, new_image, DestroyOnError);
7942
- 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);
7943
7945
  rm_ensure_result(new_image);
7944
7946
 
7945
7947
  return rm_image_new(new_image);
@@ -7973,7 +7975,7 @@ Image__load(VALUE class, VALUE str)
7973
7975
  Image *image;
7974
7976
  ImageInfo *info;
7975
7977
  DumpedImage mi;
7976
- ExceptionInfo exception;
7978
+ ExceptionInfo *exception;
7977
7979
  char *blob;
7978
7980
  long length;
7979
7981
 
@@ -8018,16 +8020,16 @@ Image__load(VALUE class, VALUE str)
8018
8020
  memcpy(info->magick, ((DumpedImage *)blob)->magick, mi.len);
8019
8021
  info->magick[mi.len] = '\0';
8020
8022
 
8021
- GetExceptionInfo(&exception);
8023
+ exception = AcquireExceptionInfo();
8022
8024
 
8023
8025
  blob += offsetof(DumpedImage,magick) + mi.len;
8024
8026
  length -= offsetof(DumpedImage,magick) + mi.len;
8025
- image = BlobToImage(info, blob, (size_t) length, &exception);
8027
+ image = BlobToImage(info, blob, (size_t) length, exception);
8026
8028
  (void) DestroyImageInfo(info);
8027
8029
 
8028
- rm_check_exception(&exception, image, DestroyOnError);
8030
+ rm_check_exception(exception, image, DestroyOnError);
8029
8031
 
8030
- (void) DestroyExceptionInfo(&exception);
8032
+ (void) DestroyExceptionInfo(exception);
8031
8033
 
8032
8034
  rm_ensure_result(image);
8033
8035
 
@@ -8050,15 +8052,15 @@ magnify(int bang, VALUE self, magnifier_t magnifier)
8050
8052
  {
8051
8053
  Image *image;
8052
8054
  Image *new_image;
8053
- ExceptionInfo exception;
8055
+ ExceptionInfo *exception;
8054
8056
 
8055
8057
  Data_Get_Struct(self, Image, image);
8056
- GetExceptionInfo(&exception);
8058
+ exception = AcquireExceptionInfo();
8057
8059
 
8058
- new_image = (magnifier)(image, &exception);
8059
- rm_check_exception(&exception, new_image, DestroyOnError);
8060
+ new_image = (magnifier)(image, exception);
8061
+ rm_check_exception(exception, new_image, DestroyOnError);
8060
8062
 
8061
- (void) DestroyExceptionInfo(&exception);
8063
+ (void) DestroyExceptionInfo(exception);
8062
8064
 
8063
8065
  rm_ensure_result(new_image);
8064
8066
 
@@ -8134,12 +8136,13 @@ Image_map(int argc, VALUE *argv, VALUE self)
8134
8136
  volatile VALUE map_obj, map_arg;
8135
8137
  unsigned int dither = MagickFalse;
8136
8138
 
8137
- image = rm_check_destroyed(self);
8138
-
8139
8139
  #if defined(HAVE_REMAPIMAGE)
8140
+ QuantizeInfo quantize_info;
8140
8141
  rb_warning("Image#map is deprecated. Use Image#remap instead");
8141
8142
  #endif
8142
8143
 
8144
+ image = rm_check_destroyed(self);
8145
+
8143
8146
  switch (argc)
8144
8147
  {
8145
8148
  case 2:
@@ -8156,7 +8159,13 @@ Image_map(int argc, VALUE *argv, VALUE self)
8156
8159
 
8157
8160
  map_obj = rm_cur_image(map_arg);
8158
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
8159
8167
  (void) MapImage(new_image, map, dither);
8168
+ #endif
8160
8169
  rm_check_image_exception(new_image, DestroyOnError);
8161
8170
 
8162
8171
  return rm_image_new(new_image);
@@ -8180,7 +8189,7 @@ Image_marshal_dump(VALUE self)
8180
8189
  unsigned char *blob;
8181
8190
  size_t length;
8182
8191
  VALUE ary;
8183
- ExceptionInfo exception;
8192
+ ExceptionInfo *exception;
8184
8193
 
8185
8194
  image = rm_check_destroyed(self);
8186
8195
 
@@ -8200,13 +8209,13 @@ Image_marshal_dump(VALUE self)
8200
8209
  rb_ary_store(ary, 0, Qnil);
8201
8210
  }
8202
8211
 
8203
- GetExceptionInfo(&exception);
8204
- blob = ImageToBlob(info, image, &length, &exception);
8212
+ exception = AcquireExceptionInfo();
8213
+ blob = ImageToBlob(info, image, &length, exception);
8205
8214
 
8206
8215
  // Destroy info before raising an exception
8207
8216
  DestroyImageInfo(info);
8208
8217
  CHECK_EXCEPTION()
8209
- (void) DestroyExceptionInfo(&exception);
8218
+ (void) DestroyExceptionInfo(exception);
8210
8219
 
8211
8220
  rb_ary_store(ary, 1, rb_str_new((char *)blob, (long)length));
8212
8221
  magick_free((void*)blob);
@@ -8231,7 +8240,7 @@ Image_marshal_load(VALUE self, VALUE ary)
8231
8240
  VALUE blob, filename;
8232
8241
  Info *info;
8233
8242
  Image *image;
8234
- ExceptionInfo exception;
8243
+ ExceptionInfo *exception;
8235
8244
 
8236
8245
  info = CloneImageInfo(NULL);
8237
8246
  if (!info)
@@ -8242,17 +8251,17 @@ Image_marshal_load(VALUE self, VALUE ary)
8242
8251
  filename = rb_ary_shift(ary);
8243
8252
  blob = rb_ary_shift(ary);
8244
8253
 
8245
- GetExceptionInfo(&exception);
8254
+ exception = AcquireExceptionInfo();
8246
8255
  if (filename != Qnil)
8247
8256
  {
8248
8257
  strcpy(info->filename, RSTRING_PTR(filename));
8249
8258
  }
8250
- image = BlobToImage(info, RSTRING_PTR(blob), RSTRING_LEN(blob), &exception);
8259
+ image = BlobToImage(info, RSTRING_PTR(blob), RSTRING_LEN(blob), exception);
8251
8260
 
8252
8261
  // Destroy info before raising an exception
8253
8262
  DestroyImageInfo(info);
8254
8263
  CHECK_EXCEPTION();
8255
- (void) DestroyExceptionInfo(&exception);
8264
+ (void) DestroyExceptionInfo(exception);
8256
8265
 
8257
8266
  UPDATE_DATA_PTR(self, image);
8258
8267
 
@@ -8275,15 +8284,15 @@ static VALUE
8275
8284
  get_image_mask(Image *image)
8276
8285
  {
8277
8286
  Image *mask;
8278
- ExceptionInfo exception;
8287
+ ExceptionInfo *exception;
8279
8288
 
8280
- GetExceptionInfo(&exception);
8289
+ exception = AcquireExceptionInfo();
8281
8290
 
8282
8291
  // The returned clip mask is a clone, ours to keep.
8283
- mask = GetImageClipMask(image, &exception);
8284
- rm_check_exception(&exception, mask, DestroyOnError);
8292
+ mask = GetImageClipMask(image, exception);
8293
+ rm_check_exception(exception, mask, DestroyOnError);
8285
8294
 
8286
- (void) DestroyExceptionInfo(&exception);
8295
+ (void) DestroyExceptionInfo(exception);
8287
8296
 
8288
8297
  return mask ? rm_image_new(mask) : Qnil;
8289
8298
  }
@@ -8339,7 +8348,7 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8339
8348
  Image *clip_mask;
8340
8349
  long x, y;
8341
8350
  PixelPacket *q;
8342
- ExceptionInfo exception;
8351
+ ExceptionInfo *exception;
8343
8352
 
8344
8353
  image = rm_check_destroyed(self);
8345
8354
  if (argc == 0)
@@ -8363,11 +8372,11 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8363
8372
  // Resize if necessary
8364
8373
  if (clip_mask->columns != image->columns || clip_mask->rows != image->rows)
8365
8374
  {
8366
- GetExceptionInfo(&exception);
8375
+ exception = AcquireExceptionInfo();
8367
8376
  resized_image = ResizeImage(clip_mask, image->columns, image->rows
8368
- , UndefinedFilter, 0.0, &exception);
8369
- rm_check_exception(&exception, resized_image, DestroyOnError);
8370
- (void) DestroyExceptionInfo(&exception);
8377
+ , UndefinedFilter, 0.0, exception);
8378
+ rm_check_exception(exception, resized_image, DestroyOnError);
8379
+ (void) DestroyExceptionInfo(exception);
8371
8380
  rm_ensure_result(resized_image);
8372
8381
  (void) DestroyImage(clip_mask);
8373
8382
  clip_mask = resized_image;
@@ -8375,13 +8384,13 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8375
8384
 
8376
8385
  // The following section is copied from mogrify.c (6.2.8-8)
8377
8386
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
8378
- GetExceptionInfo(&exception);
8387
+ exception = AcquireExceptionInfo();
8379
8388
  #endif
8380
8389
  for (y = 0; y < (long) clip_mask->rows; y++)
8381
8390
  {
8382
8391
  #if defined(HAVE_GETAUTHENTICPIXELS)
8383
- q = GetAuthenticPixels(clip_mask, 0, y, clip_mask->columns, 1, &exception);
8384
- 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);
8385
8394
  #else
8386
8395
  q = GetImagePixels(clip_mask, 0, y, clip_mask->columns, 1);
8387
8396
  rm_check_image_exception(clip_mask, DestroyOnError);
@@ -8403,15 +8412,15 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8403
8412
  }
8404
8413
 
8405
8414
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
8406
- SyncAuthenticPixels(clip_mask, &exception);
8407
- rm_check_exception(&exception, clip_mask, DestroyOnError);
8415
+ SyncAuthenticPixels(clip_mask, exception);
8416
+ rm_check_exception(exception, clip_mask, DestroyOnError);
8408
8417
  #else
8409
8418
  SyncImagePixels(clip_mask);
8410
8419
  rm_check_image_exception(clip_mask, DestroyOnError);
8411
8420
  #endif
8412
8421
  }
8413
8422
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
8414
- (void) DestroyExceptionInfo(&exception);
8423
+ (void) DestroyExceptionInfo(exception);
8415
8424
  #endif
8416
8425
 
8417
8426
  SetImageStorageClass(clip_mask, DirectClass);
@@ -8636,7 +8645,7 @@ Image_median_filter(int argc, VALUE *argv, VALUE self)
8636
8645
  {
8637
8646
  Image *image, *new_image;
8638
8647
  double radius = 0.0;
8639
- ExceptionInfo exception;
8648
+ ExceptionInfo *exception;
8640
8649
 
8641
8650
  image = rm_check_destroyed(self);
8642
8651
  switch (argc)
@@ -8650,12 +8659,15 @@ Image_median_filter(int argc, VALUE *argv, VALUE self)
8650
8659
  break;
8651
8660
  }
8652
8661
 
8653
- GetExceptionInfo(&exception);
8654
-
8655
- new_image = MedianFilterImage(image, radius, &exception);
8656
- 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);
8657
8669
 
8658
- (void) DestroyExceptionInfo(&exception);
8670
+ (void) DestroyExceptionInfo(exception);
8659
8671
 
8660
8672
  rm_ensure_result(new_image);
8661
8673
 
@@ -8889,7 +8901,7 @@ motion_blur(int argc, VALUE *argv, VALUE self
8889
8901
  double radius = 0.0;
8890
8902
  double sigma = 1.0;
8891
8903
  double angle = 0.0;
8892
- ExceptionInfo exception;
8904
+ ExceptionInfo *exception;
8893
8905
 
8894
8906
  switch (argc)
8895
8907
  {
@@ -8913,11 +8925,11 @@ motion_blur(int argc, VALUE *argv, VALUE self
8913
8925
 
8914
8926
  Data_Get_Struct(self, Image, image);
8915
8927
 
8916
- GetExceptionInfo(&exception);
8917
- new_image = (fp)(image, radius, sigma, angle, &exception);
8918
- 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);
8919
8931
 
8920
- (void) DestroyExceptionInfo(&exception);
8932
+ (void) DestroyExceptionInfo(exception);
8921
8933
 
8922
8934
  rm_ensure_result(new_image);
8923
8935
 
@@ -9267,16 +9279,16 @@ VALUE
9267
9279
  Image_number_colors(VALUE self)
9268
9280
  {
9269
9281
  Image *image;
9270
- ExceptionInfo exception;
9282
+ ExceptionInfo *exception;
9271
9283
  unsigned long n = 0;
9272
9284
 
9273
9285
  image = rm_check_destroyed(self);
9274
- GetExceptionInfo(&exception);
9286
+ exception = AcquireExceptionInfo();
9275
9287
 
9276
- n = (unsigned long) GetNumberColors(image, NULL, &exception);
9288
+ n = (unsigned long) GetNumberColors(image, NULL, exception);
9277
9289
  CHECK_EXCEPTION()
9278
9290
 
9279
- (void) DestroyExceptionInfo(&exception);
9291
+ (void) DestroyExceptionInfo(exception);
9280
9292
 
9281
9293
  return ULONG2NUM(n);
9282
9294
  }
@@ -9305,7 +9317,7 @@ Image_oil_paint(int argc, VALUE *argv, VALUE self)
9305
9317
  {
9306
9318
  Image *image, *new_image;
9307
9319
  double radius = 3.0;
9308
- ExceptionInfo exception;
9320
+ ExceptionInfo *exception;
9309
9321
 
9310
9322
  image = rm_check_destroyed(self);
9311
9323
  switch (argc)
@@ -9319,12 +9331,12 @@ Image_oil_paint(int argc, VALUE *argv, VALUE self)
9319
9331
  break;
9320
9332
  }
9321
9333
 
9322
- GetExceptionInfo(&exception);
9334
+ exception = AcquireExceptionInfo();
9323
9335
 
9324
- new_image = OilPaintImage(image, radius, &exception);
9325
- rm_check_exception(&exception, new_image, DestroyOnError);
9336
+ new_image = OilPaintImage(image, radius, exception);
9337
+ rm_check_exception(exception, new_image, DestroyOnError);
9326
9338
 
9327
- (void) DestroyExceptionInfo(&exception);
9339
+ (void) DestroyExceptionInfo(exception);
9328
9340
 
9329
9341
  rm_ensure_result(new_image);
9330
9342
 
@@ -9516,7 +9528,7 @@ Image_ordered_dither(int argc, VALUE *argv, VALUE self)
9516
9528
  Image *image, *new_image;
9517
9529
  int order;
9518
9530
  const char *threshold_map = "2x2";
9519
- ExceptionInfo exception;
9531
+ ExceptionInfo *exception;
9520
9532
 
9521
9533
  image = rm_check_destroyed(self);
9522
9534
 
@@ -9550,13 +9562,13 @@ Image_ordered_dither(int argc, VALUE *argv, VALUE self)
9550
9562
 
9551
9563
  new_image = rm_clone_image(image);
9552
9564
 
9553
- GetExceptionInfo(&exception);
9565
+ exception = AcquireExceptionInfo();
9554
9566
 
9555
9567
  // ImageMagick >= 6.2.9
9556
- (void) OrderedPosterizeImage(new_image, threshold_map, &exception);
9557
- rm_check_exception(&exception, new_image, DestroyOnError);
9568
+ (void) OrderedPosterizeImage(new_image, threshold_map, exception);
9569
+ rm_check_exception(exception, new_image, DestroyOnError);
9558
9570
 
9559
- (void) DestroyExceptionInfo(&exception);
9571
+ (void) DestroyExceptionInfo(exception);
9560
9572
 
9561
9573
  return rm_image_new(new_image);
9562
9574
  }
@@ -9771,7 +9783,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9771
9783
  {
9772
9784
  Image *image;
9773
9785
  PixelPacket old_color, new_color, *pixel;
9774
- ExceptionInfo exception;
9786
+ ExceptionInfo *exception;
9775
9787
  long x, y;
9776
9788
  unsigned int set = False;
9777
9789
  MagickBooleanType okay;
@@ -9801,15 +9813,15 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9801
9813
  // Get the color of a pixel
9802
9814
  if (!set)
9803
9815
  {
9804
- GetExceptionInfo(&exception);
9816
+ exception = AcquireExceptionInfo();
9805
9817
  #if defined(HAVE_GETVIRTUALPIXELS)
9806
- old_color = *GetVirtualPixels(image, x, y, 1, 1, &exception);
9818
+ old_color = *GetVirtualPixels(image, x, y, 1, 1, exception);
9807
9819
  #else
9808
- old_color = *AcquireImagePixels(image, x, y, 1, 1, &exception);
9820
+ old_color = *AcquireImagePixels(image, x, y, 1, 1, exception);
9809
9821
  #endif
9810
9822
  CHECK_EXCEPTION()
9811
9823
 
9812
- (void) DestroyExceptionInfo(&exception);
9824
+ (void) DestroyExceptionInfo(exception);
9813
9825
 
9814
9826
  // PseudoClass
9815
9827
  if (image->storage_class == PseudoClass)
@@ -9849,11 +9861,11 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9849
9861
 
9850
9862
 
9851
9863
  #if defined(HAVE_GETAUTHENTICPIXELS) || defined(HAVE_SYNCAUTHENTICPIXELS)
9852
- GetExceptionInfo(&exception);
9864
+ exception = AcquireExceptionInfo();
9853
9865
  #endif
9854
9866
 
9855
9867
  #if defined(HAVE_GETAUTHENTICPIXELS)
9856
- pixel = GetAuthenticPixels(image, x, y, 1, 1, &exception);
9868
+ pixel = GetAuthenticPixels(image, x, y, 1, 1, exception);
9857
9869
  CHECK_EXCEPTION()
9858
9870
  #else
9859
9871
  pixel = GetImagePixels(image, x, y, 1, 1);
@@ -9871,7 +9883,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9871
9883
  *pixel = new_color;
9872
9884
 
9873
9885
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
9874
- SyncAuthenticPixels(image, &exception);
9886
+ SyncAuthenticPixels(image, exception);
9875
9887
  CHECK_EXCEPTION()
9876
9888
  #else
9877
9889
  SyncImagePixels(image);
@@ -9879,7 +9891,7 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
9879
9891
  #endif
9880
9892
 
9881
9893
  #if defined(HAVE_GETAUTHENTICPIXELS) || defined(HAVE_SYNCAUTHENTICPIXELS)
9882
- (void) DestroyExceptionInfo(&exception);
9894
+ (void) DestroyExceptionInfo(exception);
9883
9895
  #endif
9884
9896
 
9885
9897
  return Pixel_from_PixelPacket(&old_color);
@@ -9950,7 +9962,7 @@ Image_polaroid(int argc, VALUE *argv, VALUE self)
9950
9962
  volatile VALUE options;
9951
9963
  double angle = -5.0;
9952
9964
  Draw *draw;
9953
- ExceptionInfo exception;
9965
+ ExceptionInfo *exception;
9954
9966
 
9955
9967
  image = rm_check_destroyed(self);
9956
9968
 
@@ -9972,12 +9984,12 @@ Image_polaroid(int argc, VALUE *argv, VALUE self)
9972
9984
  clone->background_color = draw->shadow_color;
9973
9985
  clone->border_color = draw->info->border_color;
9974
9986
 
9975
- GetExceptionInfo(&exception);
9976
- new_image = PolaroidImage(clone, draw->info, angle, &exception);
9977
- 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);
9978
9990
 
9979
9991
  (void) DestroyImage(clone);
9980
- (void) DestroyExceptionInfo(&exception);
9992
+ (void) DestroyExceptionInfo(exception);
9981
9993
 
9982
9994
  rm_ensure_result(new_image);
9983
9995
 
@@ -10046,16 +10058,16 @@ Image_preview(VALUE self, VALUE preview)
10046
10058
  {
10047
10059
  Image *image, *new_image;
10048
10060
  PreviewType preview_type;
10049
- ExceptionInfo exception;
10061
+ ExceptionInfo *exception;
10050
10062
 
10051
- GetExceptionInfo(&exception);
10063
+ exception = AcquireExceptionInfo();
10052
10064
  image = rm_check_destroyed(self);
10053
10065
  VALUE_TO_ENUM(preview, preview_type, PreviewType);
10054
10066
 
10055
- new_image = PreviewImage(image, preview_type, &exception);
10056
- rm_check_exception(&exception, new_image, DestroyOnError);
10067
+ new_image = PreviewImage(image, preview_type, exception);
10068
+ rm_check_exception(exception, new_image, DestroyOnError);
10057
10069
 
10058
- (void) DestroyExceptionInfo(&exception);
10070
+ (void) DestroyExceptionInfo(exception);
10059
10071
 
10060
10072
  rm_ensure_result(new_image);
10061
10073
 
@@ -10159,7 +10171,7 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self)
10159
10171
  MagickEvaluateOperator qop;
10160
10172
  double rvalue;
10161
10173
  ChannelType channel;
10162
- ExceptionInfo exception;
10174
+ ExceptionInfo *exception;
10163
10175
 
10164
10176
  image = rm_check_destroyed(self);
10165
10177
 
@@ -10297,11 +10309,11 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self)
10297
10309
  #endif
10298
10310
  }
10299
10311
 
10300
- GetExceptionInfo(&exception);
10301
- (void) EvaluateImageChannel(image, channel, qop, rvalue, &exception);
10312
+ exception = AcquireExceptionInfo();
10313
+ (void) EvaluateImageChannel(image, channel, qop, rvalue, exception);
10302
10314
  CHECK_EXCEPTION()
10303
10315
 
10304
- (void) DestroyExceptionInfo(&exception);
10316
+ (void) DestroyExceptionInfo(exception);
10305
10317
 
10306
10318
  return self;
10307
10319
  }
@@ -10389,15 +10401,19 @@ VALUE
10389
10401
  Image_radial_blur(VALUE self, VALUE angle)
10390
10402
  {
10391
10403
  Image *image, *new_image;
10392
- ExceptionInfo exception;
10404
+ ExceptionInfo *exception;
10393
10405
 
10394
10406
  image = rm_check_destroyed(self);
10395
- GetExceptionInfo(&exception);
10407
+ exception = AcquireExceptionInfo();
10396
10408
 
10397
- new_image = RadialBlurImage(image, NUM2DBL(angle), &exception);
10398
- 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);
10399
10415
 
10400
- (void) DestroyExceptionInfo(&exception);
10416
+ (void) DestroyExceptionInfo(exception);
10401
10417
 
10402
10418
  rm_ensure_result(new_image);
10403
10419
 
@@ -10426,7 +10442,7 @@ VALUE
10426
10442
  Image_radial_blur_channel(int argc, VALUE *argv, VALUE self)
10427
10443
  {
10428
10444
  Image *image, *new_image;
10429
- ExceptionInfo exception;
10445
+ ExceptionInfo *exception;
10430
10446
  ChannelType channels;
10431
10447
 
10432
10448
  image = rm_check_destroyed(self);
@@ -10442,12 +10458,15 @@ Image_radial_blur_channel(int argc, VALUE *argv, VALUE self)
10442
10458
  raise_ChannelType_error(argv[argc-1]);
10443
10459
  }
10444
10460
 
10445
- GetExceptionInfo(&exception);
10446
-
10447
- new_image = RadialBlurImageChannel(image, channels, NUM2DBL(argv[0]), &exception);
10461
+ exception = AcquireExceptionInfo();
10448
10462
 
10449
- rm_check_exception(&exception, new_image, DestroyOnError);
10450
- (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);
10451
10470
  rm_ensure_result(new_image);
10452
10471
 
10453
10472
  return rm_image_new(new_image);
@@ -10477,7 +10496,7 @@ Image_random_threshold_channel(int argc, VALUE *argv, VALUE self)
10477
10496
  ChannelType channels;
10478
10497
  char *thresholds;
10479
10498
  volatile VALUE geom_str;
10480
- ExceptionInfo exception;
10499
+ ExceptionInfo *exception;
10481
10500
 
10482
10501
  image = rm_check_destroyed(self);
10483
10502
 
@@ -10499,12 +10518,12 @@ Image_random_threshold_channel(int argc, VALUE *argv, VALUE self)
10499
10518
 
10500
10519
  new_image = rm_clone_image(image);
10501
10520
 
10502
- GetExceptionInfo(&exception);
10521
+ exception = AcquireExceptionInfo();
10503
10522
 
10504
- (void) RandomThresholdImageChannel(new_image, channels, thresholds, &exception);
10505
- rm_check_exception(&exception, new_image, DestroyOnError);
10523
+ (void) RandomThresholdImageChannel(new_image, channels, thresholds, exception);
10524
+ rm_check_exception(exception, new_image, DestroyOnError);
10506
10525
 
10507
- (void) DestroyExceptionInfo(&exception);
10526
+ (void) DestroyExceptionInfo(exception);
10508
10527
 
10509
10528
  return rm_image_new(new_image);
10510
10529
  }
@@ -10628,7 +10647,7 @@ rd_image(VALUE class, VALUE file, reader_t reader)
10628
10647
  Info *info;
10629
10648
  volatile VALUE info_obj;
10630
10649
  Image *images;
10631
- ExceptionInfo exception;
10650
+ ExceptionInfo *exception;
10632
10651
 
10633
10652
  class = class; // defeat gcc message
10634
10653
 
@@ -10657,12 +10676,12 @@ rd_image(VALUE class, VALUE file, reader_t reader)
10657
10676
  SetImageInfoFile(info, NULL);
10658
10677
  }
10659
10678
 
10660
- GetExceptionInfo(&exception);
10679
+ exception = AcquireExceptionInfo();
10661
10680
 
10662
- images = (reader)(info, &exception);
10663
- rm_check_exception(&exception, images, DestroyOnError);
10681
+ images = (reader)(info, exception);
10682
+ rm_check_exception(exception, images, DestroyOnError);
10664
10683
  rm_set_user_artifact(images, info);
10665
- (void) DestroyExceptionInfo(&exception);
10684
+ (void) DestroyExceptionInfo(exception);
10666
10685
 
10667
10686
  return array_from_images(images);
10668
10687
  }
@@ -10685,10 +10704,14 @@ Image_recolor(VALUE self, VALUE color_matrix)
10685
10704
  unsigned long order;
10686
10705
  long x, len;
10687
10706
  double *matrix;
10688
- ExceptionInfo exception;
10707
+ ExceptionInfo *exception;
10708
+
10709
+ #if defined(HAVE_COLORMATRIXIMAGE)
10710
+ KernelInfo *kernel_info;
10711
+ #endif
10689
10712
 
10690
10713
  image = rm_check_destroyed(self);
10691
- GetExceptionInfo(&exception);
10714
+ exception = AcquireExceptionInfo();
10692
10715
 
10693
10716
  // Allocate color matrix from Ruby's memory
10694
10717
  len = RARRAY_LEN(color_matrix);
@@ -10702,11 +10725,23 @@ Image_recolor(VALUE self, VALUE color_matrix)
10702
10725
  order = (unsigned long)sqrt((double)(len + 1.0));
10703
10726
 
10704
10727
  // RecolorImage sets the ExceptionInfo and returns a NULL image if an error occurs.
10705
- 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
10706
10741
  xfree((void *)matrix);
10707
10742
 
10708
- rm_check_exception(&exception, new_image, DestroyOnError);
10709
- (void) DestroyExceptionInfo(&exception);
10743
+ rm_check_exception(exception, new_image, DestroyOnError);
10744
+ (void) DestroyExceptionInfo(exception);
10710
10745
 
10711
10746
  return rm_image_new(new_image);
10712
10747
  }
@@ -10738,7 +10773,7 @@ Image_read_inline(VALUE self, VALUE content)
10738
10773
  long x, image_data_l;
10739
10774
  unsigned char *blob;
10740
10775
  size_t blob_l;
10741
- ExceptionInfo exception;
10776
+ ExceptionInfo *exception;
10742
10777
 
10743
10778
  self = self; // defeat gcc message
10744
10779
 
@@ -10765,19 +10800,19 @@ Image_read_inline(VALUE self, VALUE content)
10765
10800
  rb_raise(rb_eArgError, "can't decode image");
10766
10801
  }
10767
10802
 
10768
- GetExceptionInfo(&exception);
10803
+ exception = AcquireExceptionInfo();
10769
10804
 
10770
10805
  // Create a new Info structure for this read. About the
10771
10806
  // only useful attribute that can be set is `format'.
10772
10807
  info_obj = rm_info_new();
10773
10808
  Data_Get_Struct(info_obj, Info, info);
10774
10809
 
10775
- images = BlobToImage(info, blob, blob_l, &exception);
10810
+ images = BlobToImage(info, blob, blob_l, exception);
10776
10811
  magick_free((void *)blob);
10777
10812
 
10778
- rm_check_exception(&exception, images, DestroyOnError);
10813
+ rm_check_exception(exception, images, DestroyOnError);
10779
10814
 
10780
- (void) DestroyExceptionInfo(&exception);
10815
+ (void) DestroyExceptionInfo(exception);
10781
10816
  rm_set_user_artifact(images, info);
10782
10817
 
10783
10818
  return array_from_images(images);
@@ -10826,15 +10861,19 @@ VALUE
10826
10861
  Image_reduce_noise(VALUE self, VALUE radius)
10827
10862
  {
10828
10863
  Image *image, *new_image;
10829
- ExceptionInfo exception;
10864
+ ExceptionInfo *exception;
10830
10865
 
10831
10866
  image = rm_check_destroyed(self);
10832
10867
 
10833
- GetExceptionInfo(&exception);
10834
- new_image = ReduceNoiseImage(image, NUM2DBL(radius), &exception);
10835
- 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);
10836
10875
 
10837
- (void) DestroyExceptionInfo(&exception);
10876
+ (void) DestroyExceptionInfo(exception);
10838
10877
 
10839
10878
  return rm_image_new(new_image);
10840
10879
  }
@@ -10938,6 +10977,152 @@ Image_rendering_intent_eq(VALUE self, VALUE ri)
10938
10977
  }
10939
10978
 
10940
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
+
10941
11126
  /**
10942
11127
  * Scale an image to the desired dimensions using the specified filter and blur
10943
11128
  * factor.
@@ -10960,7 +11145,7 @@ resize(int bang, int argc, VALUE *argv, VALUE self)
10960
11145
  FilterTypes filter;
10961
11146
  unsigned long rows, columns;
10962
11147
  double blur, drows, dcols;
10963
- ExceptionInfo exception;
11148
+ ExceptionInfo *exception;
10964
11149
 
10965
11150
  Data_Get_Struct(self, Image, image);
10966
11151
 
@@ -11004,11 +11189,11 @@ resize(int bang, int argc, VALUE *argv, VALUE self)
11004
11189
  break;
11005
11190
  }
11006
11191
 
11007
- GetExceptionInfo(&exception);
11008
- new_image = ResizeImage(image, columns, rows, filter, blur, &exception);
11009
- 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);
11010
11195
 
11011
- (void) DestroyExceptionInfo(&exception);
11196
+ (void) DestroyExceptionInfo(exception);
11012
11197
 
11013
11198
  rm_ensure_result(new_image);
11014
11199
 
@@ -11095,15 +11280,15 @@ VALUE
11095
11280
  Image_roll(VALUE self, VALUE x_offset, VALUE y_offset)
11096
11281
  {
11097
11282
  Image *image, *new_image;
11098
- ExceptionInfo exception;
11283
+ ExceptionInfo *exception;
11099
11284
 
11100
11285
  image = rm_check_destroyed(self);
11101
11286
 
11102
- GetExceptionInfo(&exception);
11103
- new_image = RollImage(image, NUM2LONG(x_offset), NUM2LONG(y_offset), &exception);
11104
- 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);
11105
11290
 
11106
- (void) DestroyExceptionInfo(&exception);
11291
+ (void) DestroyExceptionInfo(exception);
11107
11292
 
11108
11293
  rm_ensure_result(new_image);
11109
11294
 
@@ -11131,7 +11316,7 @@ rotate(int bang, int argc, VALUE *argv, VALUE self)
11131
11316
  double degrees;
11132
11317
  char *arrow;
11133
11318
  long arrow_l;
11134
- ExceptionInfo exception;
11319
+ ExceptionInfo *exception;
11135
11320
 
11136
11321
  Data_Get_Struct(self, Image, image);
11137
11322
 
@@ -11159,12 +11344,12 @@ rotate(int bang, int argc, VALUE *argv, VALUE self)
11159
11344
  break;
11160
11345
  }
11161
11346
 
11162
- GetExceptionInfo(&exception);
11347
+ exception = AcquireExceptionInfo();
11163
11348
 
11164
- new_image = RotateImage(image, degrees, &exception);
11165
- rm_check_exception(&exception, new_image, DestroyOnError);
11349
+ new_image = RotateImage(image, degrees, exception);
11350
+ rm_check_exception(exception, new_image, DestroyOnError);
11166
11351
 
11167
- (void) DestroyExceptionInfo(&exception);
11352
+ (void) DestroyExceptionInfo(exception);
11168
11353
 
11169
11354
  rm_ensure_result(new_image);
11170
11355
 
@@ -11360,7 +11545,7 @@ scale(int bang, int argc, VALUE *argv, VALUE self, scaler_t scaler)
11360
11545
  Image *image, *new_image;
11361
11546
  unsigned long columns, rows;
11362
11547
  double scale_arg, drows, dcols;
11363
- ExceptionInfo exception;
11548
+ ExceptionInfo *exception;
11364
11549
 
11365
11550
  Data_Get_Struct(self, Image, image);
11366
11551
 
@@ -11394,11 +11579,11 @@ scale(int bang, int argc, VALUE *argv, VALUE self, scaler_t scaler)
11394
11579
  break;
11395
11580
  }
11396
11581
 
11397
- GetExceptionInfo(&exception);
11398
- new_image = (scaler)(image, columns, rows, &exception);
11399
- 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);
11400
11585
 
11401
- (void) DestroyExceptionInfo(&exception);
11586
+ (void) DestroyExceptionInfo(exception);
11402
11587
 
11403
11588
  rm_ensure_result(new_image);
11404
11589
 
@@ -11447,7 +11632,7 @@ Image_selective_blur_channel(int argc, VALUE *argv, VALUE self)
11447
11632
  #if defined(HAVE_SELECTIVEBLURIMAGECHANNEL)
11448
11633
  Image *image, *new_image;
11449
11634
  double radius, sigma, threshold;
11450
- ExceptionInfo exception;
11635
+ ExceptionInfo *exception;
11451
11636
  ChannelType channels;
11452
11637
 
11453
11638
  image = rm_check_destroyed(self);
@@ -11467,10 +11652,10 @@ Image_selective_blur_channel(int argc, VALUE *argv, VALUE self)
11467
11652
  // Either way it's supposed to represent a percentage of the QuantumRange.
11468
11653
  threshold = rm_percentage(argv[2],1.0) * QuantumRange;
11469
11654
 
11470
- GetExceptionInfo(&exception);
11471
- new_image = SelectiveBlurImageChannel(image, channels, radius, sigma, threshold, &exception);
11472
- rm_check_exception(&exception, new_image, DestroyOnError);
11473
- (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);
11474
11659
  rm_ensure_result(new_image);
11475
11660
 
11476
11661
  return rm_image_new(new_image);
@@ -11536,7 +11721,7 @@ Image_separate(int argc, VALUE *argv, VALUE self)
11536
11721
  {
11537
11722
  Image *image, *new_images;
11538
11723
  ChannelType channels = 0;
11539
- ExceptionInfo exception;
11724
+ ExceptionInfo *exception;
11540
11725
 
11541
11726
  image = rm_check_destroyed(self);
11542
11727
  channels = extract_channels(&argc, argv);
@@ -11547,10 +11732,10 @@ Image_separate(int argc, VALUE *argv, VALUE self)
11547
11732
  raise_ChannelType_error(argv[argc-1]);
11548
11733
  }
11549
11734
 
11550
- GetExceptionInfo(&exception);
11551
- new_images = SeparateImages(image, channels, &exception);
11552
- rm_check_exception(&exception, new_images, DestroyOnError);
11553
- DestroyExceptionInfo(&exception);
11735
+ exception = AcquireExceptionInfo();
11736
+ new_images = SeparateImages(image, channels, exception);
11737
+ rm_check_exception(exception, new_images, DestroyOnError);
11738
+ DestroyExceptionInfo(exception);
11554
11739
  rm_ensure_result(new_images);
11555
11740
 
11556
11741
  return rm_imagelist_from_images(new_images);
@@ -11577,7 +11762,7 @@ Image_sepiatone(int argc, VALUE *argv, VALUE self)
11577
11762
  {
11578
11763
  Image *image, *new_image;
11579
11764
  double threshold = (double) QuantumRange;
11580
- ExceptionInfo exception;
11765
+ ExceptionInfo *exception;
11581
11766
 
11582
11767
  image = rm_check_destroyed(self);
11583
11768
 
@@ -11592,11 +11777,11 @@ Image_sepiatone(int argc, VALUE *argv, VALUE self)
11592
11777
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 or 1)", argc);
11593
11778
  }
11594
11779
 
11595
- GetExceptionInfo(&exception);
11596
- new_image = SepiaToneImage(image, threshold, &exception);
11597
- 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);
11598
11783
 
11599
- (void) DestroyExceptionInfo(&exception);
11784
+ (void) DestroyExceptionInfo(exception);
11600
11785
  rm_ensure_result(new_image);
11601
11786
 
11602
11787
  return rm_image_new(new_image);
@@ -11776,7 +11961,7 @@ Image_shade(int argc, VALUE *argv, VALUE self)
11776
11961
  Image *image, *new_image;
11777
11962
  double azimuth = 30.0, elevation = 30.0;
11778
11963
  unsigned int shading=MagickFalse;
11779
- ExceptionInfo exception;
11964
+ ExceptionInfo *exception;
11780
11965
 
11781
11966
  image = rm_check_destroyed(self);
11782
11967
  switch (argc)
@@ -11794,11 +11979,11 @@ Image_shade(int argc, VALUE *argv, VALUE self)
11794
11979
  break;
11795
11980
  }
11796
11981
 
11797
- GetExceptionInfo(&exception);
11798
- new_image = ShadeImage(image, shading, azimuth, elevation, &exception);
11799
- 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);
11800
11985
 
11801
- (void) DestroyExceptionInfo(&exception);
11986
+ (void) DestroyExceptionInfo(exception);
11802
11987
  rm_ensure_result(new_image);
11803
11988
 
11804
11989
  return rm_image_new(new_image);
@@ -11839,7 +12024,7 @@ Image_shadow(int argc, VALUE *argv, VALUE self)
11839
12024
  double sigma = 4.0;
11840
12025
  long x_offset = 4L;
11841
12026
  long y_offset = 4L;
11842
- ExceptionInfo exception;
12027
+ ExceptionInfo *exception;
11843
12028
 
11844
12029
  image = rm_check_destroyed(self);
11845
12030
  switch (argc)
@@ -11866,11 +12051,11 @@ Image_shadow(int argc, VALUE *argv, VALUE self)
11866
12051
  break;
11867
12052
  }
11868
12053
 
11869
- GetExceptionInfo(&exception);
11870
- new_image = ShadowImage(image, opacity, sigma, x_offset, y_offset, &exception);
11871
- 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);
11872
12057
 
11873
- (void) DestroyExceptionInfo(&exception);
12058
+ (void) DestroyExceptionInfo(exception);
11874
12059
  rm_ensure_result(new_image);
11875
12060
 
11876
12061
  return rm_image_new(new_image);
@@ -11927,7 +12112,7 @@ Image_sharpen_channel(int argc, VALUE *argv, VALUE self)
11927
12112
  {
11928
12113
  Image *image, *new_image;
11929
12114
  ChannelType channels;
11930
- ExceptionInfo exception;
12115
+ ExceptionInfo *exception;
11931
12116
  double radius = 0.0, sigma = 1.0;
11932
12117
 
11933
12118
  image = rm_check_destroyed(self);
@@ -11950,11 +12135,11 @@ Image_sharpen_channel(int argc, VALUE *argv, VALUE self)
11950
12135
 
11951
12136
  new_image = rm_clone_image(image);
11952
12137
 
11953
- GetExceptionInfo(&exception);
11954
- (void) SharpenImageChannel(new_image, channels, radius, sigma, &exception);
12138
+ exception = AcquireExceptionInfo();
12139
+ (void) SharpenImageChannel(new_image, channels, radius, sigma, exception);
11955
12140
 
11956
- rm_check_exception(&exception, new_image, DestroyOnError);
11957
- (void) DestroyExceptionInfo(&exception);
12141
+ rm_check_exception(exception, new_image, DestroyOnError);
12142
+ (void) DestroyExceptionInfo(exception);
11958
12143
 
11959
12144
  return rm_image_new(new_image);
11960
12145
  }
@@ -12019,15 +12204,15 @@ VALUE
12019
12204
  Image_shear(VALUE self, VALUE x_shear, VALUE y_shear)
12020
12205
  {
12021
12206
  Image *image, *new_image;
12022
- ExceptionInfo exception;
12207
+ ExceptionInfo *exception;
12023
12208
 
12024
12209
  image = rm_check_destroyed(self);
12025
12210
 
12026
- GetExceptionInfo(&exception);
12027
- new_image = ShearImage(image, NUM2DBL(x_shear), NUM2DBL(y_shear), &exception);
12028
- 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);
12029
12214
 
12030
- (void) DestroyExceptionInfo(&exception);
12215
+ (void) DestroyExceptionInfo(exception);
12031
12216
  rm_ensure_result(new_image);
12032
12217
 
12033
12218
  return rm_image_new(new_image);
@@ -12326,7 +12511,7 @@ Image_sparse_color(int argc, VALUE *argv, VALUE self)
12326
12511
  double * volatile args;
12327
12512
  ChannelType channels;
12328
12513
  MagickPixelPacket pp;
12329
- ExceptionInfo exception;
12514
+ ExceptionInfo *exception;
12330
12515
 
12331
12516
  image = rm_check_destroyed(self);
12332
12517
 
@@ -12387,8 +12572,8 @@ Image_sparse_color(int argc, VALUE *argv, VALUE self)
12387
12572
  }
12388
12573
  }
12389
12574
 
12390
- GetExceptionInfo(&exception);
12391
- new_image = SparseColorImage(image, channels, method, nargs, args, &exception);
12575
+ exception = AcquireExceptionInfo();
12576
+ new_image = SparseColorImage(image, channels, method, nargs, args, exception);
12392
12577
  xfree(args);
12393
12578
  CHECK_EXCEPTION();
12394
12579
  rm_ensure_result(new_image);
@@ -12430,7 +12615,7 @@ Image_splice(int argc, VALUE *argv, VALUE self)
12430
12615
  Image *image, *new_image;
12431
12616
  PixelPacket color, old_color;
12432
12617
  RectangleInfo rectangle;
12433
- ExceptionInfo exception;
12618
+ ExceptionInfo *exception;
12434
12619
 
12435
12620
  image = rm_check_destroyed(self);
12436
12621
 
@@ -12454,17 +12639,17 @@ Image_splice(int argc, VALUE *argv, VALUE self)
12454
12639
  rectangle.width = NUM2ULONG(argv[2]);
12455
12640
  rectangle.height = NUM2ULONG(argv[3]);
12456
12641
 
12457
- GetExceptionInfo(&exception);
12642
+ exception = AcquireExceptionInfo();
12458
12643
 
12459
12644
  // Swap in color for the duration of this call.
12460
12645
  old_color = image->background_color;
12461
12646
  image->background_color = color;
12462
- new_image = SpliceImage(image, &rectangle, &exception);
12647
+ new_image = SpliceImage(image, &rectangle, exception);
12463
12648
  image->background_color = old_color;
12464
12649
 
12465
- rm_check_exception(&exception, new_image, DestroyOnError);
12650
+ rm_check_exception(exception, new_image, DestroyOnError);
12466
12651
 
12467
- (void) DestroyExceptionInfo(&exception);
12652
+ (void) DestroyExceptionInfo(exception);
12468
12653
 
12469
12654
  rm_ensure_result(new_image);
12470
12655
 
@@ -12492,7 +12677,7 @@ Image_spread(int argc, VALUE *argv, VALUE self)
12492
12677
  {
12493
12678
  Image *image, *new_image;
12494
12679
  double radius = 3.0;
12495
- ExceptionInfo exception;
12680
+ ExceptionInfo *exception;
12496
12681
 
12497
12682
  image = rm_check_destroyed(self);
12498
12683
  switch (argc)
@@ -12506,12 +12691,12 @@ Image_spread(int argc, VALUE *argv, VALUE self)
12506
12691
  break;
12507
12692
  }
12508
12693
 
12509
- GetExceptionInfo(&exception);
12510
- new_image = SpreadImage(image, radius, &exception);
12511
- 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);
12512
12697
  rm_ensure_result(new_image);
12513
12698
 
12514
- (void) DestroyExceptionInfo(&exception);
12699
+ (void) DestroyExceptionInfo(exception);
12515
12700
 
12516
12701
  return rm_image_new(new_image);
12517
12702
  }
@@ -12538,7 +12723,7 @@ Image_stegano(VALUE self, VALUE watermark_image, VALUE offset)
12538
12723
  Image *image, *new_image;
12539
12724
  volatile VALUE wm_image;
12540
12725
  Image *watermark;
12541
- ExceptionInfo exception;
12726
+ ExceptionInfo *exception;
12542
12727
 
12543
12728
  image = rm_check_destroyed(self);
12544
12729
 
@@ -12547,11 +12732,11 @@ Image_stegano(VALUE self, VALUE watermark_image, VALUE offset)
12547
12732
 
12548
12733
  image->offset = NUM2LONG(offset);
12549
12734
 
12550
- GetExceptionInfo(&exception);
12551
- new_image = SteganoImage(image, watermark, &exception);
12552
- 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);
12553
12738
 
12554
- (void) DestroyExceptionInfo(&exception);
12739
+ (void) DestroyExceptionInfo(exception);
12555
12740
 
12556
12741
  rm_ensure_result(new_image);
12557
12742
 
@@ -12577,18 +12762,18 @@ Image_stereo(VALUE self, VALUE offset_image_arg)
12577
12762
  Image *image, *new_image;
12578
12763
  volatile VALUE offset_image;
12579
12764
  Image *offset;
12580
- ExceptionInfo exception;
12765
+ ExceptionInfo *exception;
12581
12766
 
12582
12767
  image = rm_check_destroyed(self);
12583
12768
 
12584
12769
  offset_image = rm_cur_image(offset_image_arg);
12585
12770
  offset = rm_check_destroyed(offset_image);
12586
12771
 
12587
- GetExceptionInfo(&exception);
12588
- new_image = StereoImage(image, offset, &exception);
12589
- 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);
12590
12775
 
12591
- (void) DestroyExceptionInfo(&exception);
12776
+ (void) DestroyExceptionInfo(exception);
12592
12777
 
12593
12778
  rm_ensure_result(new_image);
12594
12779
 
@@ -12715,12 +12900,12 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg
12715
12900
  // from the pixels argument.
12716
12901
  {
12717
12902
  #if defined(HAVE_SYNCAUTHENTICPIXELS) || defined(HAVE_GETAUTHENTICPIXELS)
12718
- ExceptionInfo exception;
12719
- GetExceptionInfo(&exception);
12903
+ ExceptionInfo *exception;
12904
+ exception = AcquireExceptionInfo();
12720
12905
  #endif
12721
12906
 
12722
12907
  #if defined(HAVE_GETAUTHENTICPIXELS)
12723
- pixels = GetAuthenticPixels(image, x, y, cols, rows, &exception);
12908
+ pixels = GetAuthenticPixels(image, x, y, cols, rows, exception);
12724
12909
  CHECK_EXCEPTION()
12725
12910
  #else
12726
12911
  pixels = GetImagePixels(image, x, y, cols, rows);
@@ -12736,7 +12921,7 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg
12736
12921
  pixels[n] = *pixel;
12737
12922
  }
12738
12923
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
12739
- SyncAuthenticPixels(image, &exception);
12924
+ SyncAuthenticPixels(image, exception);
12740
12925
  CHECK_EXCEPTION()
12741
12926
  #else
12742
12927
  SyncImagePixels(image);
@@ -12745,7 +12930,7 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg
12745
12930
  }
12746
12931
 
12747
12932
  #if defined(HAVE_SYNCAUTHENTICPIXELS) || defined(HAVE_GETAUTHENTICPIXELS)
12748
- DestroyExceptionInfo(&exception);
12933
+ DestroyExceptionInfo(exception);
12749
12934
  #endif
12750
12935
  }
12751
12936
 
@@ -12788,15 +12973,15 @@ VALUE
12788
12973
  Image_swirl(VALUE self, VALUE degrees)
12789
12974
  {
12790
12975
  Image *image, *new_image;
12791
- ExceptionInfo exception;
12976
+ ExceptionInfo *exception;
12792
12977
 
12793
12978
  image = rm_check_destroyed(self);
12794
12979
 
12795
- GetExceptionInfo(&exception);
12796
- new_image = SwirlImage(image, NUM2DBL(degrees), &exception);
12797
- 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);
12798
12983
 
12799
- (void) DestroyExceptionInfo(&exception);
12984
+ (void) DestroyExceptionInfo(exception);
12800
12985
 
12801
12986
  rm_ensure_result(new_image);
12802
12987
 
@@ -13029,7 +13214,7 @@ thumbnail(int bang, int argc, VALUE *argv, VALUE self)
13029
13214
  Image *image, *new_image;
13030
13215
  unsigned long columns, rows;
13031
13216
  double scale_arg, drows, dcols;
13032
- ExceptionInfo exception;
13217
+ ExceptionInfo *exception;
13033
13218
 
13034
13219
  Data_Get_Struct(self, Image, image);
13035
13220
 
@@ -13063,11 +13248,11 @@ thumbnail(int bang, int argc, VALUE *argv, VALUE self)
13063
13248
  break;
13064
13249
  }
13065
13250
 
13066
- GetExceptionInfo(&exception);
13067
- new_image = ThumbnailImage(image, columns, rows, &exception);
13068
- 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);
13069
13254
 
13070
- (void) DestroyExceptionInfo(&exception);
13255
+ (void) DestroyExceptionInfo(exception);
13071
13256
 
13072
13257
  rm_ensure_result(new_image);
13073
13258
 
@@ -13190,7 +13375,7 @@ Image_tint(int argc, VALUE *argv, VALUE self)
13190
13375
  double red_pct_opaque, green_pct_opaque, blue_pct_opaque;
13191
13376
  double alpha_pct_opaque = 1.0;
13192
13377
  char opacity[50];
13193
- ExceptionInfo exception;
13378
+ ExceptionInfo *exception;
13194
13379
 
13195
13380
  image = rm_check_destroyed(self);
13196
13381
 
@@ -13236,12 +13421,12 @@ Image_tint(int argc, VALUE *argv, VALUE self)
13236
13421
  , blue_pct_opaque*100.0, alpha_pct_opaque*100.0);
13237
13422
 
13238
13423
  Data_Get_Struct(argv[0], Pixel, tint);
13239
- GetExceptionInfo(&exception);
13424
+ exception = AcquireExceptionInfo();
13240
13425
 
13241
- new_image = TintImage(image, opacity, *tint, &exception);
13242
- rm_check_exception(&exception, new_image, DestroyOnError);
13426
+ new_image = TintImage(image, opacity, *tint, exception);
13427
+ rm_check_exception(exception, new_image, DestroyOnError);
13243
13428
 
13244
- (void) DestroyExceptionInfo(&exception);
13429
+ (void) DestroyExceptionInfo(exception);
13245
13430
 
13246
13431
  rm_ensure_result(new_image);
13247
13432
 
@@ -13272,7 +13457,7 @@ Image_to_blob(VALUE self)
13272
13457
  volatile VALUE blob_str;
13273
13458
  void *blob = NULL;
13274
13459
  size_t length = 2048; // Do what Magick++ does
13275
- ExceptionInfo exception;
13460
+ ExceptionInfo *exception;
13276
13461
 
13277
13462
  // The user can specify the depth (8 or 16, if the format supports
13278
13463
  // both) and the image format by setting the depth and format
@@ -13289,10 +13474,10 @@ Image_to_blob(VALUE self)
13289
13474
  rm_check_image_exception(image, RetainOnError);
13290
13475
  }
13291
13476
 
13292
- GetExceptionInfo(&exception);
13477
+ exception = AcquireExceptionInfo();
13293
13478
  if (*info->magick)
13294
13479
  {
13295
- (void) SetImageInfo(info, MagickTrue, &exception);
13480
+ (void) SetImageInfo(info, MagickTrue, exception);
13296
13481
  CHECK_EXCEPTION()
13297
13482
 
13298
13483
  if (*info->magick == '\0')
@@ -13303,7 +13488,7 @@ Image_to_blob(VALUE self)
13303
13488
  }
13304
13489
 
13305
13490
  // Fix #2844 - libjpeg exits when image is 0x0
13306
- magick_info = GetMagickInfo(image->magick, &exception);
13491
+ magick_info = GetMagickInfo(image->magick, exception);
13307
13492
  CHECK_EXCEPTION()
13308
13493
 
13309
13494
  if (magick_info)
@@ -13319,10 +13504,10 @@ Image_to_blob(VALUE self)
13319
13504
 
13320
13505
  rm_sync_image_options(image, info);
13321
13506
 
13322
- blob = ImageToBlob(info, image, &length, &exception);
13507
+ blob = ImageToBlob(info, image, &length, exception);
13323
13508
  CHECK_EXCEPTION()
13324
13509
 
13325
- (void) DestroyExceptionInfo(&exception);
13510
+ (void) DestroyExceptionInfo(exception);
13326
13511
 
13327
13512
  if (length == 0 || !blob)
13328
13513
  {
@@ -13356,22 +13541,22 @@ Image_to_color(VALUE self, VALUE pixel_arg)
13356
13541
  {
13357
13542
  Image *image;
13358
13543
  Pixel *pixel;
13359
- ExceptionInfo exception;
13544
+ ExceptionInfo *exception;
13360
13545
  char name[MaxTextExtent];
13361
13546
 
13362
13547
  image = rm_check_destroyed(self);
13363
13548
  Data_Get_Struct(pixel_arg, Pixel, pixel);
13364
- GetExceptionInfo(&exception);
13549
+ exception = AcquireExceptionInfo();
13365
13550
 
13366
13551
  // QueryColorname returns False if the color represented by the PixelPacket
13367
13552
  // doesn't have a "real" name, just a sequence of hex digits. We don't care
13368
13553
  // about that.
13369
13554
 
13370
13555
  name[0] = '\0';
13371
- (void) QueryColorname(image, pixel, AllCompliance, name, &exception);
13556
+ (void) QueryColorname(image, pixel, AllCompliance, name, exception);
13372
13557
  CHECK_EXCEPTION()
13373
13558
 
13374
- (void) DestroyExceptionInfo(&exception);
13559
+ (void) DestroyExceptionInfo(exception);
13375
13560
 
13376
13561
  return rb_str_new2(name);
13377
13562
 
@@ -13683,7 +13868,7 @@ static VALUE
13683
13868
  trimmer(int bang, int argc, VALUE *argv, VALUE self)
13684
13869
  {
13685
13870
  Image *image, *new_image;
13686
- ExceptionInfo exception;
13871
+ ExceptionInfo *exception;
13687
13872
  int reset_page = 0;
13688
13873
 
13689
13874
  switch (argc)
@@ -13699,11 +13884,11 @@ trimmer(int bang, int argc, VALUE *argv, VALUE self)
13699
13884
 
13700
13885
  Data_Get_Struct(self, Image, image);
13701
13886
 
13702
- GetExceptionInfo(&exception);
13703
- new_image = TrimImage(image, &exception);
13704
- rm_check_exception(&exception, new_image, DestroyOnError);
13887
+ exception = AcquireExceptionInfo();
13888
+ new_image = TrimImage(image, exception);
13889
+ rm_check_exception(exception, new_image, DestroyOnError);
13705
13890
 
13706
- (void) DestroyExceptionInfo(&exception);
13891
+ (void) DestroyExceptionInfo(exception);
13707
13892
 
13708
13893
  rm_ensure_result(new_image);
13709
13894
 
@@ -13822,14 +14007,14 @@ VALUE Image_image_type(VALUE self)
13822
14007
  {
13823
14008
  Image *image;
13824
14009
  ImageType type;
13825
- ExceptionInfo exception;
14010
+ ExceptionInfo *exception;
13826
14011
 
13827
14012
  image = rm_check_destroyed(self);
13828
- GetExceptionInfo(&exception);
13829
- type = GetImageType(image, &exception);
14013
+ exception = AcquireExceptionInfo();
14014
+ type = GetImageType(image, exception);
13830
14015
  CHECK_EXCEPTION()
13831
14016
 
13832
- (void) DestroyExceptionInfo(&exception);
14017
+ (void) DestroyExceptionInfo(exception);
13833
14018
 
13834
14019
  return ImageType_new(type);
13835
14020
  }
@@ -13905,14 +14090,14 @@ VALUE
13905
14090
  Image_unique_colors(VALUE self)
13906
14091
  {
13907
14092
  Image *image, *new_image;
13908
- ExceptionInfo exception;
14093
+ ExceptionInfo *exception;
13909
14094
 
13910
14095
  image = rm_check_destroyed(self);
13911
- GetExceptionInfo(&exception);
14096
+ exception = AcquireExceptionInfo();
13912
14097
 
13913
- new_image = UniqueImageColors(image, &exception);
13914
- rm_check_exception(&exception, new_image, DestroyOnError);
13915
- (void) DestroyExceptionInfo(&exception);
14098
+ new_image = UniqueImageColors(image, exception);
14099
+ rm_check_exception(exception, new_image, DestroyOnError);
14100
+ (void) DestroyExceptionInfo(exception);
13916
14101
 
13917
14102
  rm_ensure_result(new_image);
13918
14103
 
@@ -14074,17 +14259,17 @@ Image_unsharp_mask(int argc, VALUE *argv, VALUE self)
14074
14259
  {
14075
14260
  Image *image, *new_image;
14076
14261
  double radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05;
14077
- ExceptionInfo exception;
14262
+ ExceptionInfo *exception;
14078
14263
 
14079
14264
  image = rm_check_destroyed(self);
14080
14265
 
14081
14266
  unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);
14082
14267
 
14083
- GetExceptionInfo(&exception);
14084
- new_image = UnsharpMaskImage(image, radius, sigma, amount, threshold, &exception);
14085
- 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);
14086
14271
 
14087
- (void) DestroyExceptionInfo(&exception);
14272
+ (void) DestroyExceptionInfo(exception);
14088
14273
 
14089
14274
  rm_ensure_result(new_image);
14090
14275
 
@@ -14123,7 +14308,7 @@ Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self)
14123
14308
  Image *image, *new_image;
14124
14309
  ChannelType channels;
14125
14310
  double radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05;
14126
- ExceptionInfo exception;
14311
+ ExceptionInfo *exception;
14127
14312
 
14128
14313
  image = rm_check_destroyed(self);
14129
14314
  channels = extract_channels(&argc, argv);
@@ -14134,12 +14319,12 @@ Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self)
14134
14319
 
14135
14320
  unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);
14136
14321
 
14137
- GetExceptionInfo(&exception);
14322
+ exception = AcquireExceptionInfo();
14138
14323
  new_image = UnsharpMaskImageChannel(image, channels, radius, sigma, amount
14139
- , threshold, &exception);
14140
- rm_check_exception(&exception, new_image, DestroyOnError);
14324
+ , threshold, exception);
14325
+ rm_check_exception(exception, new_image, DestroyOnError);
14141
14326
 
14142
- (void) DestroyExceptionInfo(&exception);
14327
+ (void) DestroyExceptionInfo(exception);
14143
14328
 
14144
14329
  rm_ensure_result(new_image);
14145
14330
 
@@ -14175,7 +14360,7 @@ Image_vignette(int argc, VALUE *argv, VALUE self)
14175
14360
  Image *image, *new_image;
14176
14361
  long horz_radius, vert_radius;
14177
14362
  double radius = 0.0, sigma = 10.0;
14178
- ExceptionInfo exception;
14363
+ ExceptionInfo *exception;
14179
14364
 
14180
14365
  image = rm_check_destroyed(self);
14181
14366
 
@@ -14199,12 +14384,12 @@ Image_vignette(int argc, VALUE *argv, VALUE self)
14199
14384
  break;
14200
14385
  }
14201
14386
 
14202
- GetExceptionInfo(&exception);
14387
+ exception = AcquireExceptionInfo();
14203
14388
 
14204
- new_image = VignetteImage(image, radius, sigma, horz_radius, vert_radius, &exception);
14205
- 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);
14206
14391
 
14207
- (void) DestroyExceptionInfo(&exception);
14392
+ (void) DestroyExceptionInfo(exception);
14208
14393
 
14209
14394
  rm_ensure_result(new_image);
14210
14395
 
@@ -14358,7 +14543,7 @@ Image_wave(int argc, VALUE *argv, VALUE self)
14358
14543
  {
14359
14544
  Image *image, *new_image;
14360
14545
  double amplitude = 25.0, wavelength = 150.0;
14361
- ExceptionInfo exception;
14546
+ ExceptionInfo *exception;
14362
14547
 
14363
14548
  image = rm_check_destroyed(self);
14364
14549
  switch (argc)
@@ -14374,11 +14559,11 @@ Image_wave(int argc, VALUE *argv, VALUE self)
14374
14559
  break;
14375
14560
  }
14376
14561
 
14377
- GetExceptionInfo(&exception);
14378
- new_image = WaveImage(image, amplitude, wavelength, &exception);
14379
- 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);
14380
14565
 
14381
- (void) DestroyExceptionInfo(&exception);
14566
+ (void) DestroyExceptionInfo(exception);
14382
14567
 
14383
14568
  rm_ensure_result(new_image);
14384
14569
 
@@ -14425,7 +14610,7 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14425
14610
  double rate = 1.0;
14426
14611
  double opacity, step;
14427
14612
  const char *func;
14428
- ExceptionInfo exception;
14613
+ ExceptionInfo *exception;
14429
14614
 
14430
14615
  image = rm_check_destroyed(self);
14431
14616
  switch (argc)
@@ -14468,8 +14653,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14468
14653
  }
14469
14654
 
14470
14655
 
14471
- GetExceptionInfo(&exception);
14472
- flip_image = FlipImage(image, &exception);
14656
+ exception = AcquireExceptionInfo();
14657
+ flip_image = FlipImage(image, exception);
14473
14658
  CHECK_EXCEPTION();
14474
14659
 
14475
14660
 
@@ -14477,7 +14662,7 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14477
14662
  geometry.y = 0;
14478
14663
  geometry.width = image->columns;
14479
14664
  geometry.height = max_rows;
14480
- reflection = CropImage(flip_image, &geometry, &exception);
14665
+ reflection = CropImage(flip_image, &geometry, exception);
14481
14666
  DestroyImage(flip_image);
14482
14667
  CHECK_EXCEPTION();
14483
14668
 
@@ -14498,11 +14683,11 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14498
14683
 
14499
14684
 
14500
14685
  #if defined(HAVE_GETVIRTUALPIXELS)
14501
- p = GetVirtualPixels(reflection, 0, y, image->columns, 1, &exception);
14686
+ p = GetVirtualPixels(reflection, 0, y, image->columns, 1, exception);
14502
14687
  #else
14503
- p = AcquireImagePixels(reflection, 0, y, image->columns, 1, &exception);
14688
+ p = AcquireImagePixels(reflection, 0, y, image->columns, 1, exception);
14504
14689
  #endif
14505
- rm_check_exception(&exception, reflection, DestroyOnError);
14690
+ rm_check_exception(exception, reflection, DestroyOnError);
14506
14691
  if (!p)
14507
14692
  {
14508
14693
  func = "AcquireImagePixels";
@@ -14510,11 +14695,11 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14510
14695
  }
14511
14696
 
14512
14697
  #if defined(HAVE_QUEUEAUTHENTICPIXELS)
14513
- q = QueueAuthenticPixels(reflection, 0, y, image->columns, 1, &exception);
14698
+ q = QueueAuthenticPixels(reflection, 0, y, image->columns, 1, exception);
14514
14699
  #else
14515
14700
  q = SetImagePixels(reflection, 0, y, image->columns, 1);
14516
14701
  #endif
14517
- rm_check_exception(&exception, reflection, DestroyOnError);
14702
+ rm_check_exception(exception, reflection, DestroyOnError);
14518
14703
  if (!q)
14519
14704
  {
14520
14705
  func = "SetImagePixels";
@@ -14530,8 +14715,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14530
14715
 
14531
14716
 
14532
14717
  #if defined(HAVE_SYNCAUTHENTICPIXELS)
14533
- SyncAuthenticPixels(reflection, &exception);
14534
- rm_check_exception(&exception, reflection, DestroyOnError);
14718
+ SyncAuthenticPixels(reflection, exception);
14719
+ rm_check_exception(exception, reflection, DestroyOnError);
14535
14720
  #else
14536
14721
  SyncImagePixels(reflection);
14537
14722
  rm_check_image_exception(reflection, DestroyOnError);
@@ -14541,11 +14726,11 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self)
14541
14726
  }
14542
14727
 
14543
14728
 
14544
- (void) DestroyExceptionInfo(&exception);
14729
+ (void) DestroyExceptionInfo(exception);
14545
14730
  return rm_image_new(reflection);
14546
14731
 
14547
14732
  error:
14548
- (void) DestroyExceptionInfo(&exception);
14733
+ (void) DestroyExceptionInfo(exception);
14549
14734
  (void) DestroyImage(reflection);
14550
14735
  rb_raise(rb_eRuntimeError, "%s failed on row %lu", func, y);
14551
14736
  return(VALUE)0;
@@ -14591,7 +14776,7 @@ void add_format_prefix(Info *info, VALUE file)
14591
14776
  char *filename;
14592
14777
  long filename_l;
14593
14778
  const MagickInfo *magick_info, *magick_info2;
14594
- ExceptionInfo exception;
14779
+ ExceptionInfo *exception;
14595
14780
  char magic[MaxTextExtent];
14596
14781
  size_t magic_l;
14597
14782
  size_t prefix_l;
@@ -14619,19 +14804,19 @@ void add_format_prefix(Info *info, VALUE file)
14619
14804
  magic_l = p - filename;
14620
14805
  memcpy(magic, filename, magic_l);
14621
14806
 
14622
- GetExceptionInfo(&exception);
14623
- magick_info = GetMagickInfo(magic, &exception);
14807
+ exception = AcquireExceptionInfo();
14808
+ magick_info = GetMagickInfo(magic, exception);
14624
14809
  CHECK_EXCEPTION();
14625
- DestroyExceptionInfo(&exception);
14810
+ DestroyExceptionInfo(exception);
14626
14811
 
14627
14812
  if (magick_info && magick_info->module)
14628
14813
  {
14629
14814
  // We have to compare the module names because some formats have
14630
14815
  // more than one name. JPG and JPEG, for example.
14631
- GetExceptionInfo(&exception);
14632
- magick_info2 = GetMagickInfo(info->magick, &exception);
14816
+ exception = AcquireExceptionInfo();
14817
+ magick_info2 = GetMagickInfo(info->magick, exception);
14633
14818
  CHECK_EXCEPTION();
14634
- DestroyExceptionInfo(&exception);
14819
+ DestroyExceptionInfo(exception);
14635
14820
 
14636
14821
  if (magick_info2->module && strcmp(magick_info->module, magick_info2->module) != 0)
14637
14822
  {
@@ -14694,8 +14879,14 @@ Image_write(VALUE self, VALUE file)
14694
14879
  // Ensure file is open - raise error if not
14695
14880
  GetOpenFile(file, fptr);
14696
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
14697
14887
  SetImageInfoFile(info, GetWriteFile(fptr));
14698
14888
  memset(image->filename, 0, sizeof(image->filename));
14889
+ #endif
14699
14890
  }
14700
14891
  else
14701
14892
  {
@@ -14930,7 +15121,7 @@ xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, x
14930
15121
  {
14931
15122
  Image *image, *new_image;
14932
15123
  RectangleInfo rect;
14933
- ExceptionInfo exception;
15124
+ ExceptionInfo *exception;
14934
15125
 
14935
15126
  Data_Get_Struct(self, Image, image);
14936
15127
  rect.x = NUM2LONG(x);
@@ -14938,15 +15129,15 @@ xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, x
14938
15129
  rect.width = NUM2ULONG(width);
14939
15130
  rect.height = NUM2ULONG(height);
14940
15131
 
14941
- GetExceptionInfo(&exception);
15132
+ exception = AcquireExceptionInfo();
14942
15133
 
14943
- new_image = (xformer)(image, &rect, &exception);
15134
+ new_image = (xformer)(image, &rect, exception);
14944
15135
 
14945
15136
  // An exception can occur in either the old or the new images
14946
15137
  rm_check_image_exception(image, RetainOnError);
14947
- rm_check_exception(&exception, new_image, DestroyOnError);
15138
+ rm_check_exception(exception, new_image, DestroyOnError);
14948
15139
 
14949
- (void) DestroyExceptionInfo(&exception);
15140
+ (void) DestroyExceptionInfo(exception);
14950
15141
 
14951
15142
  rm_ensure_result(new_image);
14952
15143