rmagick 4.2.2 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,39 @@ static void imagelist_push(VALUE, VALUE);
20
20
  static VALUE ImageList_new(void);
21
21
 
22
22
 
23
+ DEFINE_GVL_STUB3(AppendImages, const Image *, const MagickBooleanType, ExceptionInfo *);
24
+ DEFINE_GVL_STUB5(CloneImage, const Image *, const size_t, const size_t, const MagickBooleanType, ExceptionInfo *);
25
+ DEFINE_GVL_STUB2(CloneImageList, const Image *, ExceptionInfo *);
26
+ DEFINE_GVL_STUB2(CoalesceImages, const Image *, ExceptionInfo *);
27
+ DEFINE_GVL_STUB2(DisposeImages, const Image *, ExceptionInfo *);
28
+ DEFINE_GVL_STUB3(EvaluateImages, const Image *, const MagickEvaluateOperator, ExceptionInfo *);
29
+ DEFINE_GVL_STUB4(ImagesToBlob, const ImageInfo *, Image *, size_t *, ExceptionInfo *);
30
+ DEFINE_GVL_STUB3(MergeImageLayers, Image *, const LayerMethod, ExceptionInfo *);
31
+ DEFINE_GVL_STUB3(MontageImages, const Image *, const MontageInfo *, ExceptionInfo *);
32
+ DEFINE_GVL_STUB3(MorphImages, const Image *, const size_t, ExceptionInfo *);
33
+ DEFINE_GVL_STUB2(OptimizeImageLayers, const Image *, ExceptionInfo *);
34
+ DEFINE_GVL_STUB2(OptimizePlusImageLayers, const Image *, ExceptionInfo *);
35
+ #if defined(IMAGEMAGICK_7)
36
+ DEFINE_GVL_STUB3(AnimateImages, const ImageInfo *, Image *, ExceptionInfo *);
37
+ DEFINE_GVL_STUB3(CombineImages, const Image *, const ColorspaceType, ExceptionInfo *);
38
+ DEFINE_GVL_STUB3(CompareImagesLayers, const Image *, const LayerMethod, ExceptionInfo *);
39
+ DEFINE_GVL_STUB3(QuantizeImages, const QuantizeInfo *, Image *, ExceptionInfo *);
40
+ DEFINE_GVL_STUB4(RemapImages, const QuantizeInfo *, Image *, const Image *, ExceptionInfo *);
41
+ DEFINE_GVL_STUB3(WriteImage, const ImageInfo *, Image *, ExceptionInfo *);
42
+ #else
43
+ DEFINE_GVL_STUB2(AnimateImages, const ImageInfo *, Image *);
44
+ DEFINE_GVL_STUB3(CombineImages, const Image *, const ChannelType, ExceptionInfo *);
45
+ DEFINE_GVL_STUB3(CompareImageLayers, const Image *, const ImageLayerMethod, ExceptionInfo *);
46
+ DEFINE_GVL_STUB2(DeconstructImages, const Image *, ExceptionInfo *);
47
+ DEFINE_GVL_STUB2(QuantizeImages, const QuantizeInfo *, Image *);
48
+ DEFINE_GVL_STUB3(RemapImages, const QuantizeInfo *, Image *, const Image *);
49
+ DEFINE_GVL_STUB2(WriteImage, const ImageInfo *, Image *);
50
+ #endif
23
51
 
52
+ DEFINE_GVL_VOID_STUB6(CompositeLayers, Image *, const CompositeOperator, Image *, const ssize_t, const ssize_t, ExceptionInfo *);
53
+ DEFINE_GVL_VOID_STUB2(OptimizeImageTransparency, const Image *, ExceptionInfo *);
54
+ DEFINE_GVL_VOID_STUB2(RemoveDuplicateLayers, Image **, ExceptionInfo *);
55
+ DEFINE_GVL_VOID_STUB2(RemoveZeroDelayLayers, Image **, ExceptionInfo *);
24
56
 
25
57
 
26
58
  /**
@@ -72,15 +104,17 @@ ImageList_animate(int argc, VALUE *argv, VALUE self)
72
104
  }
73
105
  }
74
106
 
75
- Data_Get_Struct(info_obj, Info, info);
107
+ TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
76
108
  #if defined(IMAGEMAGICK_7)
77
109
  exception = AcquireExceptionInfo();
78
- AnimateImages(info, images, exception);
110
+ GVL_STRUCT_TYPE(AnimateImages) args = { info, images, exception };
111
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AnimateImages), &args);
79
112
  rm_split(images);
80
113
  CHECK_EXCEPTION();
81
114
  DestroyExceptionInfo(exception);
82
115
  #else
83
- AnimateImages(info, images);
116
+ GVL_STRUCT_TYPE(AnimateImages) args = { info, images };
117
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AnimateImages), &args);
84
118
  rm_split(images);
85
119
  rm_check_image_exception(images, RetainOnError);
86
120
  #endif
@@ -112,7 +146,8 @@ ImageList_append(VALUE self, VALUE stack_arg)
112
146
  stack = RTEST(stack_arg);
113
147
 
114
148
  exception = AcquireExceptionInfo();
115
- new_image = AppendImages(images, stack, exception);
149
+ GVL_STRUCT_TYPE(AppendImages) args = { images, stack, exception };
150
+ new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AppendImages), &args);
116
151
  rm_split(images);
117
152
  rm_check_exception(exception, new_image, DestroyOnError);
118
153
  DestroyExceptionInfo(exception);
@@ -136,8 +171,8 @@ ImageList_average(VALUE self)
136
171
  images = images_from_imagelist(self);
137
172
 
138
173
  exception = AcquireExceptionInfo();
139
- new_image = EvaluateImages(images, MeanEvaluateOperator, exception);
140
-
174
+ GVL_STRUCT_TYPE(EvaluateImages) args = { images, MeanEvaluateOperator, exception };
175
+ new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EvaluateImages), &args);
141
176
  rm_split(images);
142
177
  rm_check_exception(exception, new_image, DestroyOnError);
143
178
  DestroyExceptionInfo(exception);
@@ -164,7 +199,8 @@ ImageList_coalesce(VALUE self)
164
199
  images = images_from_imagelist(self);
165
200
 
166
201
  exception = AcquireExceptionInfo();
167
- new_images = CoalesceImages(images, exception);
202
+ GVL_STRUCT_TYPE(CoalesceImages) args = { images, exception };
203
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CoalesceImages), &args);
168
204
  rm_split(images);
169
205
  rm_check_exception(exception, new_images, DestroyOnError);
170
206
  DestroyExceptionInfo(exception);
@@ -252,10 +288,11 @@ VALUE ImageList_combine(int argc, VALUE *argv, VALUE self)
252
288
  #if defined(IMAGEMAGICK_6)
253
289
  old_colorspace = images->colorspace;
254
290
  SetImageColorspace(images, colorspace);
255
- new_image = CombineImages(images, channel, exception);
291
+ GVL_STRUCT_TYPE(CombineImages) args = { images, channel, exception };
256
292
  #else
257
- new_image = CombineImages(images, colorspace, exception);
293
+ GVL_STRUCT_TYPE(CombineImages) args = { images, colorspace, exception };
258
294
  #endif
295
+ new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CombineImages), &args);
259
296
 
260
297
  rm_split(images);
261
298
  #if defined(IMAGEMAGICK_6)
@@ -319,7 +356,8 @@ ImageList_composite_layers(int argc, VALUE *argv, VALUE self)
319
356
  new_images->gravity, &geometry);
320
357
 
321
358
  exception = AcquireExceptionInfo();
322
- CompositeLayers(new_images, operator, source, geometry.x, geometry.y, exception);
359
+ GVL_STRUCT_TYPE(CompositeLayers) args = { new_images, operator, source, geometry.x, geometry.y, exception };
360
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeLayers), &args);
323
361
  rm_split(source);
324
362
  rm_check_exception(exception, new_images, DestroyOnError);
325
363
  DestroyExceptionInfo(exception);
@@ -345,9 +383,11 @@ ImageList_deconstruct(VALUE self)
345
383
  images = images_from_imagelist(self);
346
384
  exception = AcquireExceptionInfo();
347
385
  #if defined(IMAGEMAGICK_7)
348
- new_images = CompareImagesLayers(images, CompareAnyLayer, exception);
386
+ GVL_STRUCT_TYPE(CompareImagesLayers) args = { images, CompareAnyLayer, exception };
387
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImagesLayers), &args);
349
388
  #else
350
- new_images = DeconstructImages(images, exception);
389
+ GVL_STRUCT_TYPE(DeconstructImages) args = { images, exception };
390
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DeconstructImages), &args);
351
391
  #endif
352
392
  rm_split(images);
353
393
  rm_check_exception(exception, new_images, DestroyOnError);
@@ -374,7 +414,7 @@ ImageList_display(VALUE self)
374
414
 
375
415
  // Create a new Info object to use with this call
376
416
  info_obj = rm_info_new();
377
- Data_Get_Struct(info_obj, Info, info);
417
+ TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
378
418
 
379
419
  // Convert the images array to an images sequence.
380
420
  images = images_from_imagelist(self);
@@ -410,7 +450,8 @@ ImageList_flatten_images(VALUE self)
410
450
  images = images_from_imagelist(self);
411
451
  exception = AcquireExceptionInfo();
412
452
 
413
- new_image = MergeImageLayers(images, FlattenLayer, exception);
453
+ GVL_STRUCT_TYPE(MergeImageLayers) args = { images, FlattenLayer, exception };
454
+ new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
414
455
 
415
456
  rm_split(images);
416
457
  rm_check_exception(exception, new_image, DestroyOnError);
@@ -428,8 +469,8 @@ ImageList_flatten_images(VALUE self)
428
469
  * @overload montage
429
470
  * Creates {Magick::ImageList::Montage} object, yields to block
430
471
  * if present in {Magick::ImageList::Montage} object's scope.
431
- * @yield []
432
- *
472
+ * @yield [Magick::ImageList::Montage]
473
+ *
433
474
  * @return [Magick::ImageList] a new image list
434
475
  */
435
476
  VALUE
@@ -440,23 +481,14 @@ ImageList_montage(VALUE self)
440
481
  Image *new_images, *images;
441
482
  ExceptionInfo *exception;
442
483
 
443
- // Create a new instance of the Magick::Montage class
484
+ // Create a new instance of the Magick::ImageList::Montage class
444
485
  montage_obj = rm_montage_new();
445
486
  if (rb_block_given_p())
446
487
  {
447
- // Run the block in the instance's context, allowing the app to modify the
448
- // object's attributes.
449
- if (rb_proc_arity(rb_block_proc()) == 0)
450
- {
451
- rb_obj_instance_eval(0, NULL, montage_obj);
452
- }
453
- else
454
- {
455
- rb_yield(montage_obj);
456
- }
488
+ rb_yield(montage_obj);
457
489
  }
458
490
 
459
- Data_Get_Struct(montage_obj, Montage, montage);
491
+ TypedData_Get_Struct(montage_obj, Montage, &rm_montage_data_type, montage);
460
492
 
461
493
  images = images_from_imagelist(self);
462
494
 
@@ -475,7 +507,8 @@ ImageList_montage(VALUE self)
475
507
  exception = AcquireExceptionInfo();
476
508
 
477
509
  // MontageImage can return more than one image.
478
- new_images = MontageImages(images, montage->info, exception);
510
+ GVL_STRUCT_TYPE(MontageImages) args = { images, montage->info, exception };
511
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MontageImages), &args);
479
512
  rm_split(images);
480
513
  rm_check_exception(exception, new_images, DestroyOnError);
481
514
  DestroyExceptionInfo(exception);
@@ -511,7 +544,8 @@ ImageList_morph(VALUE self, VALUE nimages)
511
544
 
512
545
  images = images_from_imagelist(self);
513
546
  exception = AcquireExceptionInfo();
514
- new_images = MorphImages(images, (unsigned long)number_images, exception);
547
+ GVL_STRUCT_TYPE(MorphImages) args = { images, number_images, exception };
548
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MorphImages), &args);
515
549
  rm_split(images);
516
550
  rm_check_exception(exception, new_images, DestroyOnError);
517
551
  DestroyExceptionInfo(exception);
@@ -534,7 +568,8 @@ ImageList_mosaic(VALUE self)
534
568
  images = images_from_imagelist(self);
535
569
 
536
570
  exception = AcquireExceptionInfo();
537
- new_image = MergeImageLayers(images, MosaicLayer, exception);
571
+ GVL_STRUCT_TYPE(MergeImageLayers) args = { images, MosaicLayer, exception };
572
+ new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
538
573
 
539
574
  rm_split(images);
540
575
  rm_check_exception(exception, new_image, DestroyOnError);
@@ -568,22 +603,37 @@ ImageList_optimize_layers(VALUE self, VALUE method)
568
603
  switch (mthd)
569
604
  {
570
605
  case CoalesceLayer:
571
- new_images = CoalesceImages(images, exception);
606
+ {
607
+ GVL_STRUCT_TYPE(CoalesceImages) args = { images, exception };
608
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CoalesceImages), &args);
609
+ }
572
610
  break;
573
611
  case DisposeLayer:
574
- new_images = DisposeImages(images, exception);
612
+ {
613
+ GVL_STRUCT_TYPE(DisposeImages) args = { images, exception };
614
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DisposeImages), &args);
615
+ }
575
616
  break;
576
617
  case OptimizeTransLayer:
577
- new_images = clone_imagelist(images);
578
- OptimizeImageTransparency(new_images, exception);
618
+ {
619
+ new_images = clone_imagelist(images);
620
+ GVL_STRUCT_TYPE(OptimizeImageTransparency) args = { new_images, exception };
621
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageTransparency), &args);
622
+ }
579
623
  break;
580
624
  case RemoveDupsLayer:
581
- new_images = clone_imagelist(images);
582
- RemoveDuplicateLayers(&new_images, exception);
625
+ {
626
+ new_images = clone_imagelist(images);
627
+ GVL_STRUCT_TYPE(RemoveDuplicateLayers) args = { &new_images, exception };
628
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemoveDuplicateLayers), &args);
629
+ }
583
630
  break;
584
631
  case RemoveZeroLayer:
585
- new_images = clone_imagelist(images);
586
- RemoveZeroDelayLayers(&new_images, exception);
632
+ {
633
+ new_images = clone_imagelist(images);
634
+ GVL_STRUCT_TYPE(RemoveZeroDelayLayers) args = { &new_images, exception };
635
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemoveZeroDelayLayers), &args);
636
+ }
587
637
  break;
588
638
  case CompositeLayer:
589
639
  rm_split(images);
@@ -592,50 +642,81 @@ ImageList_optimize_layers(VALUE self, VALUE method)
592
642
  break;
593
643
  // In 6.3.4-ish, OptimizeImageLayer replaced OptimizeLayer
594
644
  case OptimizeImageLayer:
595
- new_images = OptimizeImageLayers(images, exception);
645
+ {
646
+ GVL_STRUCT_TYPE(OptimizeImageLayers) args = { images, exception };
647
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageLayers), &args);
648
+ }
596
649
  break;
597
650
  // and OptimizeLayer became a "General Purpose, GIF Animation Optimizer" (ref. mogrify.c)
598
651
  case OptimizeLayer:
599
- new_images = CoalesceImages(images, exception);
600
- rm_split(images);
601
- rm_check_exception(exception, new_images, DestroyOnError);
602
- new_images2 = OptimizeImageLayers(new_images, exception);
603
- DestroyImageList(new_images);
604
- rm_check_exception(exception, new_images2, DestroyOnError);
605
- new_images = new_images2;
606
- OptimizeImageTransparency(new_images, exception);
607
- rm_check_exception(exception, new_images, DestroyOnError);
608
- // mogrify supports -dither here. We don't.
609
- GetQuantizeInfo(&quantize_info);
652
+ {
653
+ GVL_STRUCT_TYPE(CoalesceImages) args_CoalesceImages = { images, exception };
654
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CoalesceImages), &args_CoalesceImages);
655
+ rm_split(images);
656
+ rm_check_exception(exception, new_images, DestroyOnError);
657
+
658
+ GVL_STRUCT_TYPE(OptimizeImageLayers) args_OptimizeImageLayers = { new_images, exception };
659
+ new_images2 = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageLayers), &args_OptimizeImageLayers);
660
+ DestroyImageList(new_images);
661
+ rm_check_exception(exception, new_images2, DestroyOnError);
662
+
663
+ new_images = new_images2;
664
+ GVL_STRUCT_TYPE(OptimizeImageTransparency) args_OptimizeImageTransparency = { new_images, exception };
665
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageTransparency), &args_OptimizeImageTransparency);
666
+ rm_check_exception(exception, new_images, DestroyOnError);
667
+ // mogrify supports -dither here. We don't.
668
+ GetQuantizeInfo(&quantize_info);
610
669
  #if defined(IMAGEMAGICK_7)
611
- RemapImages(&quantize_info, new_images, NULL, exception);
670
+ GVL_STRUCT_TYPE(RemapImages) args_RemapImages = { &quantize_info, new_images, NULL, exception };
612
671
  #else
613
- RemapImages(&quantize_info, new_images, NULL);
672
+ GVL_STRUCT_TYPE(RemapImages) args_RemapImages = { &quantize_info, new_images, NULL };
614
673
  #endif
674
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImages), &args_RemapImages);
675
+
676
+ }
615
677
  break;
616
678
  case OptimizePlusLayer:
617
- new_images = OptimizePlusImageLayers(images, exception);
679
+ {
680
+ GVL_STRUCT_TYPE(OptimizePlusImageLayers) args = { images, exception };
681
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizePlusImageLayers), &args);
682
+ }
618
683
  break;
619
684
  case CompareAnyLayer:
620
685
  case CompareClearLayer:
621
686
  case CompareOverlayLayer:
687
+ {
622
688
  #if defined(IMAGEMAGICK_7)
623
- new_images = CompareImagesLayers(images, mthd, exception);
689
+ GVL_STRUCT_TYPE(CompareImagesLayers) args = { images, mthd, exception };
690
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImagesLayers), &args);
624
691
  #else
625
- new_images = CompareImageLayers(images, mthd, exception);
692
+ GVL_STRUCT_TYPE(CompareImageLayers) args = { images, mthd, exception };
693
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImageLayers), &args);
626
694
  #endif
695
+ }
627
696
  break;
628
697
  case MosaicLayer:
629
- new_images = MergeImageLayers(images, mthd, exception);
698
+ {
699
+ GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
700
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
701
+ }
630
702
  break;
631
703
  case FlattenLayer:
632
- new_images = MergeImageLayers(images, mthd, exception);
704
+ {
705
+ GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
706
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
707
+ }
633
708
  break;
634
709
  case MergeLayer:
635
- new_images = MergeImageLayers(images, mthd, exception);
710
+ {
711
+ GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
712
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
713
+ }
636
714
  break;
637
715
  case TrimBoundsLayer:
638
- new_images = MergeImageLayers(images, mthd, exception);
716
+ {
717
+ GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
718
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
719
+ }
639
720
  break;
640
721
  default:
641
722
  rm_split(images);
@@ -833,7 +914,8 @@ clone_imagelist(Image *images)
833
914
  {
834
915
  Image *clone;
835
916
 
836
- clone = CloneImage(image, 0, 0, MagickTrue, exception);
917
+ GVL_STRUCT_TYPE(CloneImage) args = { image, 0, 0, MagickTrue, exception };
918
+ clone = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CloneImage), &args);
837
919
  rm_check_exception(exception, new_imagelist, DestroyOnError);
838
920
  AppendImageToList(&new_imagelist, clone);
839
921
  image = GetNextImageInList(image);
@@ -910,17 +992,19 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
910
992
  // Convert image array to image sequence, clone image sequence.
911
993
  images = images_from_imagelist(self);
912
994
  exception = AcquireExceptionInfo();
913
- new_images = CloneImageList(images, exception);
995
+ GVL_STRUCT_TYPE(CloneImageList) args_CloneImageList = { images, exception };
996
+ new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CloneImageList), &args_CloneImageList);
914
997
  rm_split(images);
915
998
  rm_check_exception(exception, new_images, DestroyOnError);
916
999
 
917
1000
  rm_ensure_result(new_images);
918
1001
 
919
1002
  #if defined(IMAGEMAGICK_7)
920
- QuantizeImages(&quantize_info, new_images, exception);
1003
+ GVL_STRUCT_TYPE(QuantizeImages) args_QuantizeImages = { &quantize_info, new_images, exception };
921
1004
  #else
922
- QuantizeImages(&quantize_info, new_images);
1005
+ GVL_STRUCT_TYPE(QuantizeImages) args_QuantizeImages = { &quantize_info, new_images };
923
1006
  #endif
1007
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImages), &args_QuantizeImages);
924
1008
  rm_check_exception(exception, new_images, DestroyOnError);
925
1009
  DestroyExceptionInfo(exception);
926
1010
 
@@ -987,12 +1071,14 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
987
1071
 
988
1072
  #if defined(IMAGEMAGICK_7)
989
1073
  exception = AcquireExceptionInfo();
990
- RemapImages(&quantize_info, images, remap_image, exception);
1074
+ GVL_STRUCT_TYPE(RemapImages) args = { &quantize_info, images, remap_image, exception };
1075
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImages), &args);
991
1076
  rm_split(images);
992
1077
  CHECK_EXCEPTION();
993
1078
  DestroyExceptionInfo(exception);
994
1079
  #else
995
- RemapImages(&quantize_info, images, remap_image);
1080
+ GVL_STRUCT_TYPE(RemapImages) args = { &quantize_info, images, remap_image };
1081
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImages), &args);
996
1082
  rm_split(images);
997
1083
  rm_check_image_exception(images, RetainOnError);
998
1084
  #endif
@@ -1008,7 +1094,7 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
1008
1094
  *
1009
1095
  * @overload to_blob
1010
1096
  * Runs an info parm block if present - the user can specify the image format and depth
1011
- * @yield []
1097
+ * @yield [Magick::Image::Info]
1012
1098
  *
1013
1099
  * @return [String] the blob
1014
1100
  */
@@ -1024,7 +1110,7 @@ ImageList_to_blob(VALUE self)
1024
1110
  ExceptionInfo *exception;
1025
1111
 
1026
1112
  info_obj = rm_info_new();
1027
- Data_Get_Struct(info_obj, Info, info);
1113
+ TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
1028
1114
 
1029
1115
  // Convert the images array to an images sequence.
1030
1116
  images = images_from_imagelist(self);
@@ -1051,7 +1137,8 @@ ImageList_to_blob(VALUE self)
1051
1137
  // can happen is that there's only one image or the format
1052
1138
  // doesn't support multi-image files.
1053
1139
  info->adjoin = MagickTrue;
1054
- blob = ImagesToBlob(info, images, &length, exception);
1140
+ GVL_STRUCT_TYPE(ImagesToBlob) args = { info, images, &length, exception };
1141
+ blob = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImagesToBlob), &args);
1055
1142
  if (blob && exception->severity >= ErrorException)
1056
1143
  {
1057
1144
  magick_free((void*)blob);
@@ -1097,7 +1184,7 @@ ImageList_write(VALUE self, VALUE file)
1097
1184
  ExceptionInfo *exception;
1098
1185
 
1099
1186
  info_obj = rm_info_new();
1100
- Data_Get_Struct(info_obj, Info, info);
1187
+ TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
1101
1188
 
1102
1189
 
1103
1190
  if (TYPE(file) == T_FILE)
@@ -1106,8 +1193,8 @@ ImageList_write(VALUE self, VALUE file)
1106
1193
 
1107
1194
  // Ensure file is open - raise error if not
1108
1195
  GetOpenFile(file, fptr);
1109
- #if defined(_WIN32)
1110
1196
  add_format_prefix(info, fptr->pathv);
1197
+ #if defined(_WIN32)
1111
1198
  SetImageInfoFile(info, NULL);
1112
1199
  #else
1113
1200
  SetImageInfoFile(info, rb_io_stdio_file(fptr));
@@ -1142,7 +1229,7 @@ ImageList_write(VALUE self, VALUE file)
1142
1229
  #endif
1143
1230
 
1144
1231
  // Tell WriteImage if we want a multi-images file.
1145
- if (imagelist_length(self) > 1L && GetMagickAdjoin(m))
1232
+ if (imagelist_length(self) > 1L && m && GetMagickAdjoin(m))
1146
1233
  {
1147
1234
  info->adjoin = MagickTrue;
1148
1235
  }
@@ -1151,10 +1238,12 @@ ImageList_write(VALUE self, VALUE file)
1151
1238
  {
1152
1239
  rm_sync_image_options(img, info);
1153
1240
  #if defined(IMAGEMAGICK_7)
1154
- WriteImage(info, img, exception);
1241
+ GVL_STRUCT_TYPE(WriteImage) args = { info, img, exception };
1242
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WriteImage), &args);
1155
1243
  rm_check_exception(exception, img, RetainOnError);
1156
1244
  #else
1157
- WriteImage(info, img);
1245
+ GVL_STRUCT_TYPE(WriteImage) args = { info, img };
1246
+ CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WriteImage), &args);
1158
1247
  // images will be split before raising an exception
1159
1248
  rm_check_image_exception(images, RetainOnError);
1160
1249
  #endif