rmagick 5.0.0 → 5.1.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.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +5 -14
- data/before_install_osx.sh +2 -1
- data/ext/RMagick/extconf.rb +21 -21
- data/ext/RMagick/rmagick.h +23 -11
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/rmdraw.c +101 -69
- data/ext/RMagick/rmenum.c +34 -15
- data/ext/RMagick/rmfill.c +77 -16
- data/ext/RMagick/rmilist.c +156 -58
- data/ext/RMagick/rmimage.c +1073 -486
- data/ext/RMagick/rminfo.c +107 -85
- data/ext/RMagick/rmkinfo.c +43 -13
- data/ext/RMagick/rmmain.c +4 -0
- data/ext/RMagick/rmmontage.c +41 -20
- data/ext/RMagick/rmpixel.c +64 -40
- data/ext/RMagick/rmutil.c +7 -3
- data/lib/rmagick/version.rb +3 -1
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +8 -13
- data/rmagick.gemspec +2 -0
- metadata +17 -2
    
        data/ext/RMagick/rmimage.c
    CHANGED
    
    | @@ -29,45 +29,276 @@ | |
| 29 29 | 
             
                #define magick_module module
         | 
| 30 30 | 
             
            #endif
         | 
| 31 31 |  | 
| 32 | 
            -
            /** Method that effects an image */
         | 
| 33 | 
            -
            typedef Image *(effector_t)(const Image *, const double, const double, ExceptionInfo *);
         | 
| 34 | 
            -
            /** Method that flips an image */
         | 
| 35 | 
            -
            typedef Image *(flipper_t)(const Image *, ExceptionInfo *);
         | 
| 36 | 
            -
            /** Method that magnifies an image */
         | 
| 37 | 
            -
            typedef Image *(magnifier_t)(const Image *, ExceptionInfo *);
         | 
| 38 | 
            -
            /** Method that reads an image */
         | 
| 39 | 
            -
            typedef Image *(reader_t)(const Info *, ExceptionInfo *);
         | 
| 40 | 
            -
            /** Method that scales an image */
         | 
| 41 | 
            -
            typedef Image *(scaler_t)(const Image *, const size_t, const size_t, ExceptionInfo *);
         | 
| 42 | 
            -
            /** Method that computes threshold on an image */
         | 
| 43 | 
            -
            #if defined(IMAGEMAGICK_7)
         | 
| 44 | 
            -
                typedef MagickBooleanType (auto_channel_t)(Image *, ExceptionInfo *exception);
         | 
| 45 | 
            -
                typedef Image *(channel_method_t)(const Image *, const double, const double, ExceptionInfo *);
         | 
| 46 | 
            -
                typedef MagickBooleanType (thresholder_t)(Image *, const char *, ExceptionInfo *);
         | 
| 47 | 
            -
            #else
         | 
| 48 | 
            -
                typedef MagickBooleanType (auto_channel_t)(Image *, const ChannelType);
         | 
| 49 | 
            -
                typedef Image *(channel_method_t)(const Image *, const ChannelType, const double, const double, ExceptionInfo *);
         | 
| 50 | 
            -
                typedef MagickBooleanType (thresholder_t)(Image *, const char *);
         | 
| 51 | 
            -
                #define IsEquivalentImage IsImageSimilar
         | 
| 52 | 
            -
                #define OrderedDitherImage OrderedPosterizeImage
         | 
| 53 | 
            -
            #endif
         | 
| 54 | 
            -
            /** Method that transforms an image */
         | 
| 55 | 
            -
            typedef Image *(xformer_t)(const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 56 | 
            -
             | 
| 57 32 | 
             
            static VALUE cropper(int, int, VALUE *, VALUE);
         | 
| 58 | 
            -
            static VALUE effect_image(VALUE, int, VALUE *,  | 
| 59 | 
            -
            static VALUE flipflop(int, VALUE,  | 
| 60 | 
            -
            static VALUE rd_image(VALUE, VALUE,  | 
| 33 | 
            +
            static VALUE effect_image(VALUE, int, VALUE *, gvl_function_t);
         | 
| 34 | 
            +
            static VALUE flipflop(int, VALUE, gvl_function_t);
         | 
| 35 | 
            +
            static VALUE rd_image(VALUE, VALUE, gvl_function_t);
         | 
| 61 36 | 
             
            static VALUE rotate(int, int, VALUE *, VALUE);
         | 
| 62 | 
            -
            static VALUE scale(int, int, VALUE *, VALUE,  | 
| 63 | 
            -
            static VALUE threshold_image(int, VALUE *, VALUE,  | 
| 64 | 
            -
            static VALUE xform_image(int, VALUE, VALUE, VALUE, VALUE, VALUE,  | 
| 37 | 
            +
            static VALUE scale(int, int, VALUE *, VALUE, gvl_function_t);
         | 
| 38 | 
            +
            static VALUE threshold_image(int, VALUE *, VALUE, gvl_function_t);
         | 
| 39 | 
            +
            static VALUE xform_image(int, VALUE, VALUE, VALUE, VALUE, VALUE, gvl_function_t);
         | 
| 65 40 | 
             
            static VALUE array_from_images(Image *);
         | 
| 66 41 | 
             
            static VALUE file_arg_rescue(VALUE, VALUE ATTRIBUTE_UNUSED) ATTRIBUTE_NORETURN;
         | 
| 42 | 
            +
            static size_t rm_image_memsize(const void *img);
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            const rb_data_type_t rm_image_data_type = {
         | 
| 45 | 
            +
                "Magick::Image",
         | 
| 46 | 
            +
                { NULL, rm_image_destroy, rm_image_memsize, },
         | 
| 47 | 
            +
                0, 0,
         | 
| 48 | 
            +
                RUBY_TYPED_FROZEN_SHAREABLE,
         | 
| 49 | 
            +
            };
         | 
| 67 50 |  | 
| 68 51 | 
             
            static const char *BlackPointCompensationKey = "PROFILE:black-point-compensation";
         | 
| 69 52 |  | 
| 70 53 |  | 
| 54 | 
            +
            DEFINE_GVL_STUB4(AdaptiveBlurImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 55 | 
            +
            DEFINE_GVL_STUB4(AdaptiveResizeImage, const Image *, const size_t, const size_t, ExceptionInfo *);
         | 
| 56 | 
            +
            DEFINE_GVL_STUB4(AdaptiveSharpenImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 57 | 
            +
            DEFINE_GVL_STUB5(AdaptiveThresholdImage, const Image *, const size_t, const size_t, const double, ExceptionInfo *);
         | 
| 58 | 
            +
            DEFINE_GVL_STUB3(AffineTransformImage, const Image *, const AffineMatrix *, ExceptionInfo *);
         | 
| 59 | 
            +
            DEFINE_GVL_STUB2(Base64Decode, const char *, size_t *);
         | 
| 60 | 
            +
            DEFINE_GVL_STUB4(BlobToImage, const ImageInfo *, const void *, const size_t, ExceptionInfo *);
         | 
| 61 | 
            +
            DEFINE_GVL_STUB3(BlueShiftImage, const Image *, const double, ExceptionInfo *);
         | 
| 62 | 
            +
            DEFINE_GVL_STUB4(BlurImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 63 | 
            +
            DEFINE_GVL_STUB4(CharcoalImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 64 | 
            +
            DEFINE_GVL_STUB3(ChopImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 65 | 
            +
            DEFINE_GVL_STUB3(ColorMatrixImage, const Image *, const KernelInfo *, ExceptionInfo *);
         | 
| 66 | 
            +
            DEFINE_GVL_STUB3(CropImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 67 | 
            +
            DEFINE_GVL_STUB3(DecipherImage, Image *, const char *, ExceptionInfo *);
         | 
| 68 | 
            +
            DEFINE_GVL_STUB3(DeskewImage, const Image *, const double, ExceptionInfo *);
         | 
| 69 | 
            +
            DEFINE_GVL_STUB2(DespeckleImage, const Image *, ExceptionInfo *);
         | 
| 70 | 
            +
            DEFINE_GVL_STUB6(DistortImage, const Image *, DistortMethod, const size_t, const double *, MagickBooleanType, ExceptionInfo *);
         | 
| 71 | 
            +
            DEFINE_GVL_STUB3(EdgeImage, const Image *, const double, ExceptionInfo *);
         | 
| 72 | 
            +
            DEFINE_GVL_STUB4(EmbossImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 73 | 
            +
            DEFINE_GVL_STUB3(EncipherImage, Image *, const char *, ExceptionInfo *);
         | 
| 74 | 
            +
            DEFINE_GVL_STUB2(EnhanceImage, const Image *, ExceptionInfo *);
         | 
| 75 | 
            +
            DEFINE_GVL_STUB3(ExcerptImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 76 | 
            +
            DEFINE_GVL_STUB9(ExportImagePixels, const Image *, const ssize_t, const ssize_t, const size_t, const size_t, const char *, const StorageType, void *, ExceptionInfo *);
         | 
| 77 | 
            +
            DEFINE_GVL_STUB3(ExtentImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 78 | 
            +
            DEFINE_GVL_STUB2(FlipImage, const Image *, ExceptionInfo *);
         | 
| 79 | 
            +
            DEFINE_GVL_STUB2(FlopImage, const Image *, ExceptionInfo *);
         | 
| 80 | 
            +
            DEFINE_GVL_STUB4(GaussianBlurImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 81 | 
            +
            DEFINE_GVL_STUB6(GetAuthenticPixels, Image *, const ssize_t, const ssize_t, const size_t, const size_t, ExceptionInfo *);
         | 
| 82 | 
            +
            DEFINE_GVL_STUB2(GetImageDepth, const Image *, ExceptionInfo *);
         | 
| 83 | 
            +
            DEFINE_GVL_STUB3(GetImageHistogram, const Image *, size_t *, ExceptionInfo *);
         | 
| 84 | 
            +
            DEFINE_GVL_STUB3(GetNumberColors, const Image *, FILE *, ExceptionInfo *);
         | 
| 85 | 
            +
            DEFINE_GVL_STUB6(GetVirtualPixels, const Image *, const ssize_t, const ssize_t, const size_t, const size_t, ExceptionInfo *);
         | 
| 86 | 
            +
            DEFINE_GVL_STUB4(ImageToBlob, const ImageInfo *, Image *, size_t *, ExceptionInfo *);
         | 
| 87 | 
            +
            DEFINE_GVL_STUB6(LiquidRescaleImage, const Image *, const size_t, const size_t, const double, const double, ExceptionInfo *);
         | 
| 88 | 
            +
            DEFINE_GVL_STUB2(MagnifyImage, const Image *, ExceptionInfo *);
         | 
| 89 | 
            +
            DEFINE_GVL_STUB2(MinifyImage, const Image *, ExceptionInfo *);
         | 
| 90 | 
            +
            DEFINE_GVL_STUB5(MotionBlurImage, const Image *, const double, const double, const double, ExceptionInfo *);
         | 
| 91 | 
            +
            DEFINE_GVL_STUB2(PingImage, const ImageInfo *, ExceptionInfo *);
         | 
| 92 | 
            +
            DEFINE_GVL_STUB3(PreviewImage, const Image *, const PreviewType, ExceptionInfo *);
         | 
| 93 | 
            +
            DEFINE_GVL_STUB2(ReadImage, const ImageInfo *, ExceptionInfo *);
         | 
| 94 | 
            +
            DEFINE_GVL_STUB4(RollImage, const Image *, const ssize_t, const ssize_t, ExceptionInfo *);
         | 
| 95 | 
            +
            DEFINE_GVL_STUB3(RotateImage, const Image *, const double, ExceptionInfo *);
         | 
| 96 | 
            +
            DEFINE_GVL_STUB4(SampleImage, const Image *, const size_t, const size_t, ExceptionInfo *);
         | 
| 97 | 
            +
            DEFINE_GVL_STUB4(ScaleImage, const Image *, const size_t, const size_t, ExceptionInfo *);
         | 
| 98 | 
            +
            DEFINE_GVL_STUB3(SepiaToneImage, const Image *, const double, ExceptionInfo *);
         | 
| 99 | 
            +
            DEFINE_GVL_STUB5(ShadeImage, const Image *, const MagickBooleanType, const double, const double,ExceptionInfo *);
         | 
| 100 | 
            +
            DEFINE_GVL_STUB6(ShadowImage, const Image *, const double, const double, const ssize_t, const ssize_t,  ExceptionInfo *);
         | 
| 101 | 
            +
            DEFINE_GVL_STUB4(SharpenImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 102 | 
            +
            DEFINE_GVL_STUB3(ShaveImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 103 | 
            +
            DEFINE_GVL_STUB4(ShearImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 104 | 
            +
            DEFINE_GVL_STUB5(SketchImage, const Image *, const double, const double, const double, ExceptionInfo *);
         | 
| 105 | 
            +
            DEFINE_GVL_STUB3(SpliceImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 106 | 
            +
            DEFINE_GVL_STUB5(StatisticImage, const Image *, const StatisticType, const size_t, const size_t, ExceptionInfo *);
         | 
| 107 | 
            +
            DEFINE_GVL_STUB3(SteganoImage, const Image *, const Image *, ExceptionInfo *);
         | 
| 108 | 
            +
            DEFINE_GVL_STUB3(StereoImage, const Image *, const Image *, ExceptionInfo *);
         | 
| 109 | 
            +
            DEFINE_GVL_STUB2(SyncAuthenticPixels, Image *, ExceptionInfo *);
         | 
| 110 | 
            +
            DEFINE_GVL_STUB4(ThumbnailImage, const Image *, const size_t, const size_t, ExceptionInfo *);
         | 
| 111 | 
            +
            DEFINE_GVL_STUB2(TransposeImage, const Image *, ExceptionInfo *);
         | 
| 112 | 
            +
            DEFINE_GVL_STUB2(TransverseImage, const Image *, ExceptionInfo *);
         | 
| 113 | 
            +
            DEFINE_GVL_STUB2(TrimImage, const Image *, ExceptionInfo *);
         | 
| 114 | 
            +
            DEFINE_GVL_STUB2(UniqueImageColors, const Image *, ExceptionInfo *);
         | 
| 115 | 
            +
            DEFINE_GVL_STUB6(UnsharpMaskImage, const Image *, const double, const double, const double, const double,  ExceptionInfo *);
         | 
| 116 | 
            +
            DEFINE_GVL_STUB6(VignetteImage, const Image *, const double, const double, const ssize_t, const ssize_t, ExceptionInfo *);
         | 
| 117 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 118 | 
            +
            DEFINE_GVL_STUB4(AddNoiseImage, const Image *, const NoiseType, const double, ExceptionInfo *);
         | 
| 119 | 
            +
            DEFINE_GVL_STUB2(AutoGammaImage, Image *, ExceptionInfo *);
         | 
| 120 | 
            +
            DEFINE_GVL_STUB2(AutoLevelImage, Image *, ExceptionInfo *);
         | 
| 121 | 
            +
            DEFINE_GVL_STUB3(BilevelImage, Image *, const double, ExceptionInfo *);
         | 
| 122 | 
            +
            DEFINE_GVL_STUB3(BlackThresholdImage, Image *, const char *, ExceptionInfo *);
         | 
| 123 | 
            +
            DEFINE_GVL_STUB4(BorderImage, const Image *, const RectangleInfo *, const CompositeOperator, ExceptionInfo *);
         | 
| 124 | 
            +
            DEFINE_GVL_STUB4(ClutImage, Image *, const Image *, const PixelInterpolateMethod, ExceptionInfo *);
         | 
| 125 | 
            +
            DEFINE_GVL_STUB4(ColorizeImage, const Image *, const char *, const PixelInfo *, ExceptionInfo *);
         | 
| 126 | 
            +
            DEFINE_GVL_STUB5(CompareImages, Image *, const Image *, const MetricType, double *, ExceptionInfo *);
         | 
| 127 | 
            +
            DEFINE_GVL_STUB7(CompositeImage, Image *, const Image *, const CompositeOperator, const MagickBooleanType, const ssize_t, const ssize_t, ExceptionInfo *);
         | 
| 128 | 
            +
            DEFINE_GVL_STUB2(CompressImageColormap, Image *, ExceptionInfo *);
         | 
| 129 | 
            +
            DEFINE_GVL_STUB4(ContrastStretchImage, Image *, const double, const double, ExceptionInfo *);
         | 
| 130 | 
            +
            DEFINE_GVL_STUB3(ConvolveImage, const Image *, const KernelInfo *, ExceptionInfo *);
         | 
| 131 | 
            +
            DEFINE_GVL_STUB3(CycleColormapImage, Image *, const ssize_t, ExceptionInfo *);
         | 
| 132 | 
            +
            DEFINE_GVL_STUB4(DrawAffineImage, Image *, const Image *, const AffineMatrix *, ExceptionInfo *);
         | 
| 133 | 
            +
            DEFINE_GVL_STUB2(EqualizeImage, Image *, ExceptionInfo *);
         | 
| 134 | 
            +
            DEFINE_GVL_STUB4(EvaluateImage, Image *, const MagickEvaluateOperator, const double, ExceptionInfo *);
         | 
| 135 | 
            +
            DEFINE_GVL_STUB7(FloodfillPaintImage, Image *, const DrawInfo *, const PixelInfo *, const ssize_t, const ssize_t, const MagickBooleanType, ExceptionInfo *);
         | 
| 136 | 
            +
            DEFINE_GVL_STUB4(FrameImage, const Image *, const FrameInfo *, const CompositeOperator, ExceptionInfo *);
         | 
| 137 | 
            +
            DEFINE_GVL_STUB5(FunctionImage, Image *, const MagickFunction, const size_t, const double *, ExceptionInfo *);
         | 
| 138 | 
            +
            DEFINE_GVL_STUB3(FxImage, const Image *, const char *, ExceptionInfo *);
         | 
| 139 | 
            +
            DEFINE_GVL_STUB3(GammaImage, Image *, const double, ExceptionInfo *);
         | 
| 140 | 
            +
            DEFINE_GVL_STUB5(GetImageDistortion, Image *, const Image *, const MetricType, double *, ExceptionInfo *);
         | 
| 141 | 
            +
            DEFINE_GVL_STUB3(GetImageEntropy, const Image *, double *, ExceptionInfo *);
         | 
| 142 | 
            +
            DEFINE_GVL_STUB4(GetImageExtrema, const Image *, size_t *, size_t *, ExceptionInfo *);
         | 
| 143 | 
            +
            DEFINE_GVL_STUB3(GetImageMask, const Image *, const PixelMask, ExceptionInfo *);
         | 
| 144 | 
            +
            DEFINE_GVL_STUB4(GetImageMean, const Image *, double *, double *, ExceptionInfo *);
         | 
| 145 | 
            +
            DEFINE_GVL_STUB4(ImplodeImage, const Image *, const double, const PixelInterpolateMethod, ExceptionInfo *);
         | 
| 146 | 
            +
            DEFINE_GVL_STUB9(ImportImagePixels, Image *, const ssize_t, const ssize_t, const size_t, const size_t, const char *, const StorageType, const void *, ExceptionInfo *);
         | 
| 147 | 
            +
            DEFINE_GVL_STUB5(IsEquivalentImage, const Image *, const Image *, ssize_t *, ssize_t *, ExceptionInfo *);
         | 
| 148 | 
            +
            DEFINE_GVL_STUB5(LevelImage, Image *, const double, const double, const double, ExceptionInfo *);
         | 
| 149 | 
            +
            DEFINE_GVL_STUB5(LevelImageColors, Image *, const PixelInfo *, const PixelInfo *, const MagickBooleanType, ExceptionInfo *);
         | 
| 150 | 
            +
            DEFINE_GVL_STUB5(LevelizeImage, Image *, const double, const double, const double, ExceptionInfo *);
         | 
| 151 | 
            +
            DEFINE_GVL_STUB4(LinearStretchImage, Image *, const double, const double, ExceptionInfo *);
         | 
| 152 | 
            +
            DEFINE_GVL_STUB3(ModulateImage, Image *, const char *, ExceptionInfo *);
         | 
| 153 | 
            +
            DEFINE_GVL_STUB5(MorphologyImage, const Image *, const MorphologyMethod, const ssize_t, const KernelInfo *, ExceptionInfo *);
         | 
| 154 | 
            +
            DEFINE_GVL_STUB3(NegateImage, Image *, const MagickBooleanType, ExceptionInfo *);
         | 
| 155 | 
            +
            DEFINE_GVL_STUB2(NormalizeImage, Image *, ExceptionInfo *);
         | 
| 156 | 
            +
            DEFINE_GVL_STUB4(OilPaintImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 157 | 
            +
            DEFINE_GVL_STUB5(OpaquePaintImage, Image *, const PixelInfo *, const PixelInfo *, const MagickBooleanType, ExceptionInfo *);
         | 
| 158 | 
            +
            DEFINE_GVL_STUB3(OrderedDitherImage, Image *, const char *, ExceptionInfo *);
         | 
| 159 | 
            +
            DEFINE_GVL_STUB6(PolaroidImage, const Image *, const DrawInfo *, const char *, const double, const PixelInterpolateMethod, ExceptionInfo *);
         | 
| 160 | 
            +
            DEFINE_GVL_STUB4(PosterizeImage, Image *, const size_t, const DitherMethod, ExceptionInfo *);
         | 
| 161 | 
            +
            DEFINE_GVL_STUB5(ProfileImage, Image *, const char *, const void *, const size_t, ExceptionInfo *);
         | 
| 162 | 
            +
            DEFINE_GVL_STUB3(QuantizeImage, const QuantizeInfo *, Image *, ExceptionInfo *);
         | 
| 163 | 
            +
            DEFINE_GVL_STUB4(RaiseImage, Image *, const RectangleInfo *, const MagickBooleanType, ExceptionInfo *);
         | 
| 164 | 
            +
            DEFINE_GVL_STUB4(RandomThresholdImage, Image *, const double, const double, ExceptionInfo *);
         | 
| 165 | 
            +
            DEFINE_GVL_STUB4(RemapImage, const QuantizeInfo *, Image *, const Image *, ExceptionInfo *);
         | 
| 166 | 
            +
            DEFINE_GVL_STUB5(ResampleImage, const Image *, const double, const double, const FilterType, ExceptionInfo *);
         | 
| 167 | 
            +
            DEFINE_GVL_STUB5(ResizeImage, const Image *, const size_t, const size_t, const FilterType, ExceptionInfo *);
         | 
| 168 | 
            +
            DEFINE_GVL_STUB6(SegmentImage, Image *, const ColorspaceType, const MagickBooleanType, const double, const double, ExceptionInfo *);
         | 
| 169 | 
            +
            DEFINE_GVL_STUB5(SelectiveBlurImage, const Image *, const double, const double, const double, ExceptionInfo *);
         | 
| 170 | 
            +
            DEFINE_GVL_STUB3(SeparateImage, const Image *, const ChannelType, ExceptionInfo *);
         | 
| 171 | 
            +
            DEFINE_GVL_STUB2(SeparateImages, const Image *, ExceptionInfo *);
         | 
| 172 | 
            +
            DEFINE_GVL_STUB3(SetImageAlphaChannel, Image *, const AlphaChannelOption, ExceptionInfo *);
         | 
| 173 | 
            +
            DEFINE_GVL_STUB2(SetImageBackgroundColor, Image *, ExceptionInfo *);
         | 
| 174 | 
            +
            DEFINE_GVL_STUB3(SetImageDepth, Image *, const size_t, ExceptionInfo *);
         | 
| 175 | 
            +
            DEFINE_GVL_STUB4(SetImageExtent, Image *, const size_t, const size_t, ExceptionInfo *);
         | 
| 176 | 
            +
            DEFINE_GVL_STUB4(SetImageMask, Image *, const PixelMask, const Image *, ExceptionInfo *);
         | 
| 177 | 
            +
            DEFINE_GVL_STUB3(SetImageStorageClass, Image *, const ClassType, ExceptionInfo *);
         | 
| 178 | 
            +
            DEFINE_GVL_STUB5(SigmoidalContrastImage, Image *, const MagickBooleanType, const double, const double, ExceptionInfo *);
         | 
| 179 | 
            +
            DEFINE_GVL_STUB2(SignatureImage, Image *, ExceptionInfo *);
         | 
| 180 | 
            +
            DEFINE_GVL_STUB3(SolarizeImage, Image *, const double, ExceptionInfo *);
         | 
| 181 | 
            +
            DEFINE_GVL_STUB5(SparseColorImage, const Image *, const SparseColorMethod, const size_t, const double *, ExceptionInfo *);
         | 
| 182 | 
            +
            DEFINE_GVL_STUB4(SpreadImage, const Image *, const PixelInterpolateMethod, const double, ExceptionInfo *);
         | 
| 183 | 
            +
            DEFINE_GVL_STUB4(SwirlImage, const Image *, double, const PixelInterpolateMethod, ExceptionInfo *);
         | 
| 184 | 
            +
            DEFINE_GVL_STUB2(SyncImage, Image *, ExceptionInfo *);
         | 
| 185 | 
            +
            DEFINE_GVL_STUB4(TintImage, const Image *, const char *, const PixelInfo *, ExceptionInfo *);
         | 
| 186 | 
            +
            DEFINE_GVL_STUB3(TransformImageColorspace, Image *, const ColorspaceType, ExceptionInfo *);
         | 
| 187 | 
            +
            DEFINE_GVL_STUB5(TransparentPaintImage, Image *, const PixelInfo *, const Quantum, const MagickBooleanType, ExceptionInfo *);
         | 
| 188 | 
            +
            DEFINE_GVL_STUB6(TransparentPaintImageChroma, Image *, const PixelInfo *, const PixelInfo *, const Quantum, const MagickBooleanType, ExceptionInfo *);
         | 
| 189 | 
            +
            DEFINE_GVL_STUB5(WaveImage, const Image *, const double, const double, const PixelInterpolateMethod, ExceptionInfo *);
         | 
| 190 | 
            +
            DEFINE_GVL_STUB3(WhiteThresholdImage, Image *, const char *, ExceptionInfo *);
         | 
| 191 | 
            +
            DEFINE_GVL_STUB3(WriteImage, const ImageInfo *, Image *, ExceptionInfo *);
         | 
| 192 | 
            +
            #else
         | 
| 193 | 
            +
            DEFINE_GVL_STUB5(AdaptiveBlurImageChannel, const Image *, const ChannelType, const double, const double, ExceptionInfo *);
         | 
| 194 | 
            +
            DEFINE_GVL_STUB5(AdaptiveSharpenImageChannel, const Image *, const ChannelType, const double, const double, ExceptionInfo *);
         | 
| 195 | 
            +
            DEFINE_GVL_STUB3(AddNoiseImage, const Image *, const NoiseType, ExceptionInfo *);
         | 
| 196 | 
            +
            DEFINE_GVL_STUB4(AddNoiseImageChannel, const Image *, const ChannelType, const NoiseType, ExceptionInfo *);
         | 
| 197 | 
            +
            DEFINE_GVL_STUB2(AutoGammaImageChannel, Image *, const ChannelType);
         | 
| 198 | 
            +
            DEFINE_GVL_STUB2(AutoLevelImageChannel,Image *, const ChannelType);
         | 
| 199 | 
            +
            DEFINE_GVL_STUB3(BilevelImageChannel, Image *, const ChannelType,const double);
         | 
| 200 | 
            +
            DEFINE_GVL_STUB2(BlackThresholdImage, Image *, const char *);
         | 
| 201 | 
            +
            DEFINE_GVL_STUB5(BlurImageChannel, const Image *, const ChannelType, const double, const double, ExceptionInfo *);
         | 
| 202 | 
            +
            DEFINE_GVL_STUB3(BorderImage, const Image *, const RectangleInfo *, ExceptionInfo *);
         | 
| 203 | 
            +
            DEFINE_GVL_STUB3(ClutImageChannel, Image *, const ChannelType, const Image *);
         | 
| 204 | 
            +
            DEFINE_GVL_STUB4(ColorizeImage, const Image *, const char *, const PixelPacket, ExceptionInfo *);
         | 
| 205 | 
            +
            DEFINE_GVL_STUB6(CompareImageChannels, Image *, const Image *, const ChannelType, const MetricType, double *, ExceptionInfo *);
         | 
| 206 | 
            +
            DEFINE_GVL_STUB5(CompositeImage, Image *, const CompositeOperator, const Image *, const ssize_t, const ssize_t);
         | 
| 207 | 
            +
            DEFINE_GVL_STUB6(CompositeImageChannel, Image *, const ChannelType, const CompositeOperator, const Image *, const ssize_t, const ssize_t);
         | 
| 208 | 
            +
            DEFINE_GVL_STUB1(CompressImageColormap, Image *);
         | 
| 209 | 
            +
            DEFINE_GVL_STUB4(ContrastStretchImageChannel, Image *, const ChannelType, const double, const double);
         | 
| 210 | 
            +
            DEFINE_GVL_STUB4(ConvolveImage, const Image *, const size_t, const double *, ExceptionInfo *);
         | 
| 211 | 
            +
            DEFINE_GVL_STUB5(ConvolveImageChannel, const Image *, const ChannelType, const size_t, const double *, ExceptionInfo *);
         | 
| 212 | 
            +
            DEFINE_GVL_STUB2(CycleColormapImage, Image *, const ssize_t);
         | 
| 213 | 
            +
            DEFINE_GVL_STUB3(DrawAffineImage, Image *, const Image *, const AffineMatrix *);
         | 
| 214 | 
            +
            DEFINE_GVL_STUB1(EqualizeImage, Image *);
         | 
| 215 | 
            +
            DEFINE_GVL_STUB2(EqualizeImageChannel, Image *, const ChannelType);
         | 
| 216 | 
            +
            DEFINE_GVL_STUB5(EvaluateImageChannel, Image *, const ChannelType, const MagickEvaluateOperator, const double, ExceptionInfo *);
         | 
| 217 | 
            +
            DEFINE_GVL_STUB7(FloodfillPaintImage, Image *, const ChannelType, const DrawInfo *, const MagickPixelPacket *, const ssize_t, const ssize_t, const MagickBooleanType);
         | 
| 218 | 
            +
            DEFINE_GVL_STUB3(FrameImage, const Image *, const FrameInfo *, ExceptionInfo *);
         | 
| 219 | 
            +
            DEFINE_GVL_STUB6(FunctionImageChannel, Image *, const ChannelType, const MagickFunction, const size_t, const double *, ExceptionInfo *);
         | 
| 220 | 
            +
            DEFINE_GVL_STUB4(FxImageChannel, const Image *, const ChannelType, const char *, ExceptionInfo *);
         | 
| 221 | 
            +
            DEFINE_GVL_STUB3(GammaImageChannel, Image *, const ChannelType, const double);
         | 
| 222 | 
            +
            DEFINE_GVL_STUB5(GaussianBlurImageChannel, const Image *, const ChannelType, const double, const double, ExceptionInfo *);
         | 
| 223 | 
            +
            DEFINE_GVL_STUB3(GetImageChannelDepth, const Image *, const ChannelType, ExceptionInfo *);
         | 
| 224 | 
            +
            DEFINE_GVL_STUB6(GetImageChannelDistortion, Image *, const Image *, const ChannelType, const MetricType, double *, ExceptionInfo *);
         | 
| 225 | 
            +
            DEFINE_GVL_STUB5(GetImageChannelExtrema, const Image *, const ChannelType, size_t *, size_t *, ExceptionInfo *);
         | 
| 226 | 
            +
            DEFINE_GVL_STUB5(GetImageChannelMean, const Image *, const ChannelType, double *, double *, ExceptionInfo *);
         | 
| 227 | 
            +
            DEFINE_GVL_STUB2(GetImageClipMask, const Image *, ExceptionInfo *);
         | 
| 228 | 
            +
            DEFINE_GVL_STUB3(ImplodeImage, const Image *, const double, ExceptionInfo *);
         | 
| 229 | 
            +
            DEFINE_GVL_STUB8(ImportImagePixels, Image *, const ssize_t, const ssize_t, const size_t,const size_t,const char *, const StorageType, const void *);
         | 
| 230 | 
            +
            DEFINE_GVL_STUB5(IsImageSimilar, const Image *, const Image *, ssize_t *, ssize_t *, ExceptionInfo *);
         | 
| 231 | 
            +
            DEFINE_GVL_STUB2(IsImagesEqual, Image *, const Image *);
         | 
| 232 | 
            +
            DEFINE_GVL_STUB5(LevelColorsImageChannel, Image *, const ChannelType, const MagickPixelPacket *, const MagickPixelPacket *, const MagickBooleanType);
         | 
| 233 | 
            +
            DEFINE_GVL_STUB2(LevelImage, Image *, const char *);
         | 
| 234 | 
            +
            DEFINE_GVL_STUB5(LevelImageChannel, Image *, const ChannelType, const double, const double, const double);
         | 
| 235 | 
            +
            DEFINE_GVL_STUB5(LevelizeImageChannel, Image *, const ChannelType, const double, const double, const double);
         | 
| 236 | 
            +
            DEFINE_GVL_STUB3(LinearStretchImage, Image *, const double, const double);
         | 
| 237 | 
            +
            DEFINE_GVL_STUB2(ModulateImage, Image *, const char *);
         | 
| 238 | 
            +
            DEFINE_GVL_STUB6(MorphologyImageChannel, const Image *, const ChannelType, const MorphologyMethod, const ssize_t, const KernelInfo *, ExceptionInfo *);
         | 
| 239 | 
            +
            DEFINE_GVL_STUB2(NegateImage, Image *, const MagickBooleanType);
         | 
| 240 | 
            +
            DEFINE_GVL_STUB3(NegateImageChannel, Image *, const ChannelType, const MagickBooleanType);
         | 
| 241 | 
            +
            DEFINE_GVL_STUB1(NormalizeImage, Image *);
         | 
| 242 | 
            +
            DEFINE_GVL_STUB2(NormalizeImageChannel, Image *, const ChannelType);
         | 
| 243 | 
            +
            DEFINE_GVL_STUB3(OilPaintImage, const Image *, const double, ExceptionInfo *);
         | 
| 244 | 
            +
            DEFINE_GVL_STUB5(OpaquePaintImageChannel, Image *, const ChannelType, const MagickPixelPacket *, const MagickPixelPacket *, const MagickBooleanType);
         | 
| 245 | 
            +
            DEFINE_GVL_STUB3(OrderedPosterizeImage, Image *, const char *, ExceptionInfo *);
         | 
| 246 | 
            +
            DEFINE_GVL_STUB4(PolaroidImage, const Image *, const DrawInfo *, const double, ExceptionInfo *);
         | 
| 247 | 
            +
            DEFINE_GVL_STUB3(PosterizeImage, Image *, const size_t, const MagickBooleanType);
         | 
| 248 | 
            +
            DEFINE_GVL_STUB5(ProfileImage, Image *, const char *, const void *, const size_t, const MagickBooleanType);
         | 
| 249 | 
            +
            DEFINE_GVL_STUB2(QuantizeImage, const QuantizeInfo *, Image *);
         | 
| 250 | 
            +
            DEFINE_GVL_STUB3(RaiseImage, Image *, const RectangleInfo *, const MagickBooleanType);
         | 
| 251 | 
            +
            DEFINE_GVL_STUB4(RandomThresholdImageChannel, Image *, const ChannelType, const char *, ExceptionInfo *);
         | 
| 252 | 
            +
            DEFINE_GVL_STUB3(RemapImage, const QuantizeInfo *, Image *, const Image *);
         | 
| 253 | 
            +
            DEFINE_GVL_STUB6(ResampleImage, const Image *, const double, const double, const FilterTypes, const double, ExceptionInfo *);
         | 
| 254 | 
            +
            DEFINE_GVL_STUB6(ResizeImage, const Image *, const size_t, const size_t, const FilterTypes, const double, ExceptionInfo *);
         | 
| 255 | 
            +
            DEFINE_GVL_STUB5(SegmentImage, Image *, const ColorspaceType, const MagickBooleanType, const double, const double);
         | 
| 256 | 
            +
            DEFINE_GVL_STUB6(SelectiveBlurImageChannel, const Image *, const ChannelType, const double, const double,  const double, ExceptionInfo *);
         | 
| 257 | 
            +
            DEFINE_GVL_STUB2(SeparateImageChannel, Image *, const ChannelType);
         | 
| 258 | 
            +
            DEFINE_GVL_STUB3(SeparateImages, const Image *, const ChannelType, ExceptionInfo *);
         | 
| 259 | 
            +
            DEFINE_GVL_STUB2(SetImageAlphaChannel, Image *, const AlphaChannelType);
         | 
| 260 | 
            +
            DEFINE_GVL_STUB1(SetImageBackgroundColor, Image *);
         | 
| 261 | 
            +
            DEFINE_GVL_STUB3(SetImageChannelDepth, Image *, const ChannelType, const size_t);
         | 
| 262 | 
            +
            DEFINE_GVL_STUB2(SetImageClipMask, Image *, const Image *);
         | 
| 263 | 
            +
            DEFINE_GVL_STUB2(SetImageDepth, Image *, const size_t);
         | 
| 264 | 
            +
            DEFINE_GVL_STUB3(SetImageExtent, Image *, const size_t, const size_t);
         | 
| 265 | 
            +
            DEFINE_GVL_STUB2(SetImageMask, Image *, const Image *);
         | 
| 266 | 
            +
            DEFINE_GVL_STUB2(SetImageStorageClass, Image *, const ClassType);
         | 
| 267 | 
            +
            DEFINE_GVL_STUB5(SharpenImageChannel, const Image *, const ChannelType, const double, const double,  ExceptionInfo *);
         | 
| 268 | 
            +
            DEFINE_GVL_STUB5(SigmoidalContrastImageChannel, Image *, const ChannelType, const MagickBooleanType, const double, const double);
         | 
| 269 | 
            +
            DEFINE_GVL_STUB1(SignatureImage, Image *);
         | 
| 270 | 
            +
            DEFINE_GVL_STUB2(SolarizeImage, Image *, const double);
         | 
| 271 | 
            +
            DEFINE_GVL_STUB6(SparseColorImage, const Image *, const ChannelType, const SparseColorMethod, const size_t, const double *, ExceptionInfo *);
         | 
| 272 | 
            +
            DEFINE_GVL_STUB3(SpreadImage, const Image *, const double, ExceptionInfo *);
         | 
| 273 | 
            +
            DEFINE_GVL_STUB3(SwirlImage, const Image *, double, ExceptionInfo *);
         | 
| 274 | 
            +
            DEFINE_GVL_STUB1(SyncImage, Image *);
         | 
| 275 | 
            +
            DEFINE_GVL_STUB4(TintImage, const Image *, const char *, const PixelPacket, ExceptionInfo *);
         | 
| 276 | 
            +
            DEFINE_GVL_STUB2(TransformImageColorspace, Image *, const ColorspaceType);
         | 
| 277 | 
            +
            DEFINE_GVL_STUB4(TransparentPaintImage, Image *, const MagickPixelPacket *, const Quantum, const MagickBooleanType);
         | 
| 278 | 
            +
            DEFINE_GVL_STUB5(TransparentPaintImageChroma, Image *, const MagickPixelPacket *, const MagickPixelPacket *, const Quantum, const MagickBooleanType);
         | 
| 279 | 
            +
            DEFINE_GVL_STUB7(UnsharpMaskImageChannel, const Image *, const ChannelType, const double, const double,  const double, const double, ExceptionInfo *);
         | 
| 280 | 
            +
            DEFINE_GVL_STUB4(WaveImage, const Image *, const double, const double, ExceptionInfo *);
         | 
| 281 | 
            +
            DEFINE_GVL_STUB2(WhiteThresholdImage, Image *, const char *);
         | 
| 282 | 
            +
            DEFINE_GVL_STUB2(WriteImage, const ImageInfo *, Image *);
         | 
| 283 | 
            +
            #endif
         | 
| 284 | 
            +
             | 
| 285 | 
            +
            #if defined(HAVE_GETIMAGECHANNELENTROPY)
         | 
| 286 | 
            +
            DEFINE_GVL_STUB4(GetImageChannelEntropy, const Image *, const ChannelType, double *, ExceptionInfo *);
         | 
| 287 | 
            +
            #endif
         | 
| 288 | 
            +
             | 
| 289 | 
            +
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 290 | 
            +
            DEFINE_GVL_STUB3(RotationalBlurImage, const Image *, const double, ExceptionInfo *);
         | 
| 291 | 
            +
            #else
         | 
| 292 | 
            +
            DEFINE_GVL_STUB3(RadialBlurImage, const Image *, const double, ExceptionInfo *);
         | 
| 293 | 
            +
            #endif
         | 
| 294 | 
            +
             | 
| 295 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 296 | 
            +
            #elif defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 297 | 
            +
            DEFINE_GVL_STUB4(RotationalBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
         | 
| 298 | 
            +
            #else
         | 
| 299 | 
            +
            DEFINE_GVL_STUB4(RadialBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
         | 
| 300 | 
            +
            #endif
         | 
| 301 | 
            +
             | 
| 71 302 | 
             
            /**
         | 
| 72 303 | 
             
             * Returns the alpha value from the hash.
         | 
| 73 304 | 
             
             *
         | 
| @@ -98,6 +329,9 @@ get_named_alpha_value(VALUE hash) | |
| 98 329 | 
             
            }
         | 
| 99 330 |  | 
| 100 331 |  | 
| 332 | 
            +
            // aliases for common use of structure types; AdaptiveBlurImage, AdaptiveSharpenImage
         | 
| 333 | 
            +
            typedef GVL_STRUCT_TYPE(AdaptiveBlurImage) GVL_STRUCT_TYPE(adaptive_method);
         | 
| 334 | 
            +
             | 
| 101 335 | 
             
            /**
         | 
| 102 336 | 
             
             * Call Adaptive(Blur|Sharpen)Image.
         | 
| 103 337 | 
             
             *
         | 
| @@ -110,8 +344,7 @@ get_named_alpha_value(VALUE hash) | |
| 110 344 | 
             
             * @return a new image
         | 
| 111 345 | 
             
             */
         | 
| 112 346 | 
             
            static VALUE
         | 
| 113 | 
            -
            adaptive_method(int argc, VALUE *argv, VALUE self,
         | 
| 114 | 
            -
                            Image *fp(const Image *, const double, const double, ExceptionInfo *))
         | 
| 347 | 
            +
            adaptive_method(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
         | 
| 115 348 | 
             
            {
         | 
| 116 349 | 
             
                Image *image, *new_image;
         | 
| 117 350 | 
             
                double radius = 0.0;
         | 
| @@ -135,7 +368,8 @@ adaptive_method(int argc, VALUE *argv, VALUE self, | |
| 135 368 |  | 
| 136 369 | 
             
                exception = AcquireExceptionInfo();
         | 
| 137 370 |  | 
| 138 | 
            -
                 | 
| 371 | 
            +
                GVL_STRUCT_TYPE(adaptive_method) args = { image, radius, sigma, exception };
         | 
| 372 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 139 373 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 140 374 | 
             
                DestroyExceptionInfo(exception);
         | 
| 141 375 |  | 
| @@ -143,6 +377,12 @@ adaptive_method(int argc, VALUE *argv, VALUE self, | |
| 143 377 | 
             
            }
         | 
| 144 378 |  | 
| 145 379 |  | 
| 380 | 
            +
            // aliases for common use of structure types; AdaptiveBlurImage, AdaptiveSharpenImage, AdaptiveBlurImageChannel, AdaptiveSharpenImageChannel
         | 
| 381 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 382 | 
            +
            typedef GVL_STRUCT_TYPE(AdaptiveBlurImage) GVL_STRUCT_TYPE(adaptive_channel_method);
         | 
| 383 | 
            +
            #else
         | 
| 384 | 
            +
            typedef GVL_STRUCT_TYPE(AdaptiveBlurImageChannel) GVL_STRUCT_TYPE(adaptive_channel_method);
         | 
| 385 | 
            +
            #endif
         | 
| 146 386 |  | 
| 147 387 | 
             
            /**
         | 
| 148 388 | 
             
             * Call Adaptive(Blur|Sharpen)ImageChannel.
         | 
| @@ -156,7 +396,7 @@ adaptive_method(int argc, VALUE *argv, VALUE self, | |
| 156 396 | 
             
             * @return a new image
         | 
| 157 397 | 
             
             */
         | 
| 158 398 | 
             
            static VALUE
         | 
| 159 | 
            -
            adaptive_channel_method(int argc, VALUE *argv, VALUE self,  | 
| 399 | 
            +
            adaptive_channel_method(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
         | 
| 160 400 | 
             
            {
         | 
| 161 401 | 
             
                Image *image, *new_image;
         | 
| 162 402 | 
             
                double radius = 0.0;
         | 
| @@ -184,11 +424,13 @@ adaptive_channel_method(int argc, VALUE *argv, VALUE self, channel_method_t fp) | |
| 184 424 |  | 
| 185 425 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 186 426 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 187 | 
            -
                 | 
| 427 | 
            +
                GVL_STRUCT_TYPE(adaptive_channel_method) args = { image, radius, sigma, exception };
         | 
| 428 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 188 429 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 189 430 | 
             
                END_CHANNEL_MASK(image);
         | 
| 190 431 | 
             
            #else
         | 
| 191 | 
            -
                 | 
| 432 | 
            +
                GVL_STRUCT_TYPE(adaptive_channel_method) args = { image, channels, radius, sigma, exception };
         | 
| 433 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 192 434 | 
             
            #endif
         | 
| 193 435 |  | 
| 194 436 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| @@ -212,11 +454,10 @@ adaptive_channel_method(int argc, VALUE *argv, VALUE self, channel_method_t fp) | |
| 212 454 | 
             
            VALUE
         | 
| 213 455 | 
             
            Image_adaptive_blur(int argc, VALUE *argv, VALUE self)
         | 
| 214 456 | 
             
            {
         | 
| 215 | 
            -
                return adaptive_method(argc, argv, self, AdaptiveBlurImage);
         | 
| 457 | 
            +
                return adaptive_method(argc, argv, self, GVL_FUNC(AdaptiveBlurImage));
         | 
| 216 458 | 
             
            }
         | 
| 217 459 |  | 
| 218 460 |  | 
| 219 | 
            -
             | 
| 220 461 | 
             
            /**
         | 
| 221 462 | 
             
             * The same as {Magick::Image#adaptive_blur} except only the specified channels are blurred.
         | 
| 222 463 | 
             
             *
         | 
| @@ -236,9 +477,9 @@ VALUE | |
| 236 477 | 
             
            Image_adaptive_blur_channel(int argc, VALUE *argv, VALUE self)
         | 
| 237 478 | 
             
            {
         | 
| 238 479 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 239 | 
            -
                return adaptive_channel_method(argc, argv, self, AdaptiveBlurImage);
         | 
| 480 | 
            +
                return adaptive_channel_method(argc, argv, self, GVL_FUNC(AdaptiveBlurImage));
         | 
| 240 481 | 
             
            #else
         | 
| 241 | 
            -
                return adaptive_channel_method(argc, argv, self, AdaptiveBlurImageChannel);
         | 
| 482 | 
            +
                return adaptive_channel_method(argc, argv, self, GVL_FUNC(AdaptiveBlurImageChannel));
         | 
| 242 483 | 
             
            #endif
         | 
| 243 484 | 
             
            }
         | 
| 244 485 |  | 
| @@ -294,7 +535,8 @@ Image_adaptive_resize(int argc, VALUE *argv, VALUE self) | |
| 294 535 | 
             
                }
         | 
| 295 536 |  | 
| 296 537 | 
             
                exception = AcquireExceptionInfo();
         | 
| 297 | 
            -
                 | 
| 538 | 
            +
                GVL_STRUCT_TYPE(AdaptiveResizeImage) args = { image, columns, rows, exception };
         | 
| 539 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AdaptiveResizeImage), &args);
         | 
| 298 540 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 299 541 | 
             
                DestroyExceptionInfo(exception);
         | 
| 300 542 |  | 
| @@ -302,7 +544,6 @@ Image_adaptive_resize(int argc, VALUE *argv, VALUE self) | |
| 302 544 | 
             
            }
         | 
| 303 545 |  | 
| 304 546 |  | 
| 305 | 
            -
             | 
| 306 547 | 
             
            /**
         | 
| 307 548 | 
             
             * Adaptively sharpens the image by sharpening more intensely near image edges and less intensely
         | 
| 308 549 | 
             
             * far from edges.
         | 
| @@ -321,11 +562,10 @@ Image_adaptive_resize(int argc, VALUE *argv, VALUE self) | |
| 321 562 | 
             
            VALUE
         | 
| 322 563 | 
             
            Image_adaptive_sharpen(int argc, VALUE *argv, VALUE self)
         | 
| 323 564 | 
             
            {
         | 
| 324 | 
            -
                return adaptive_method(argc, argv, self, AdaptiveSharpenImage);
         | 
| 565 | 
            +
                return adaptive_method(argc, argv, self, GVL_FUNC(AdaptiveSharpenImage));
         | 
| 325 566 | 
             
            }
         | 
| 326 567 |  | 
| 327 568 |  | 
| 328 | 
            -
             | 
| 329 569 | 
             
            /**
         | 
| 330 570 | 
             
             * The same as {Magick::Image#adaptive_sharpen} except only the specified channels are sharpened.
         | 
| 331 571 | 
             
             *
         | 
| @@ -345,14 +585,13 @@ VALUE | |
| 345 585 | 
             
            Image_adaptive_sharpen_channel(int argc, VALUE *argv, VALUE self)
         | 
| 346 586 | 
             
            {
         | 
| 347 587 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 348 | 
            -
                return adaptive_channel_method(argc, argv, self, AdaptiveSharpenImage);
         | 
| 588 | 
            +
                return adaptive_channel_method(argc, argv, self, GVL_FUNC(AdaptiveSharpenImage));
         | 
| 349 589 | 
             
            #else
         | 
| 350 | 
            -
                return adaptive_channel_method(argc, argv, self, AdaptiveSharpenImageChannel);
         | 
| 590 | 
            +
                return adaptive_channel_method(argc, argv, self, GVL_FUNC(AdaptiveSharpenImageChannel));
         | 
| 351 591 | 
             
            #endif
         | 
| 352 592 | 
             
            }
         | 
| 353 593 |  | 
| 354 594 |  | 
| 355 | 
            -
             | 
| 356 595 | 
             
            /**
         | 
| 357 596 | 
             
             * Selects an individual threshold for each pixel based on the range of intensity values in its
         | 
| 358 597 | 
             
             * local neighborhood. This allows for thresholding of an image whose global intensity histogram
         | 
| @@ -389,7 +628,8 @@ Image_adaptive_threshold(int argc, VALUE *argv, VALUE self) | |
| 389 628 | 
             
                }
         | 
| 390 629 |  | 
| 391 630 | 
             
                exception = AcquireExceptionInfo();
         | 
| 392 | 
            -
                 | 
| 631 | 
            +
                GVL_STRUCT_TYPE(AdaptiveThresholdImage) args = { image, width, height, offset, exception };
         | 
| 632 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AdaptiveThresholdImage), &args);
         | 
| 393 633 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 394 634 | 
             
                DestroyExceptionInfo(exception);
         | 
| 395 635 |  | 
| @@ -428,17 +668,21 @@ Image_add_compose_mask(VALUE self, VALUE mask) | |
| 428 668 | 
             
                clip_mask = rm_clone_image(mask_image);
         | 
| 429 669 |  | 
| 430 670 | 
             
                exception = AcquireExceptionInfo();
         | 
| 431 | 
            -
                NegateImage | 
| 671 | 
            +
                GVL_STRUCT_TYPE(NegateImage) args_NegateImage = { clip_mask, MagickFalse, exception };
         | 
| 672 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NegateImage), &args_NegateImage);
         | 
| 432 673 | 
             
                rm_check_exception(exception, clip_mask, DestroyOnError);
         | 
| 433 | 
            -
                SetImageMask | 
| 674 | 
            +
                GVL_STRUCT_TYPE(SetImageMask) args_SetImageMask = { image, CompositePixelMask, clip_mask, exception };
         | 
| 675 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageMask), &args_SetImageMask);
         | 
| 434 676 | 
             
                DestroyImage(clip_mask);
         | 
| 435 677 | 
             
                CHECK_EXCEPTION();
         | 
| 436 678 | 
             
                DestroyExceptionInfo(exception);
         | 
| 437 679 | 
             
            #else
         | 
| 438 680 | 
             
                // Delete any previously-existing mask image.
         | 
| 439 681 | 
             
                // Store a clone of the new mask image.
         | 
| 440 | 
            -
                SetImageMask | 
| 441 | 
            -
                 | 
| 682 | 
            +
                GVL_STRUCT_TYPE(SetImageMask) args_SetImageMask = { image, mask_image };
         | 
| 683 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageMask), &args_SetImageMask);
         | 
| 684 | 
            +
                GVL_STRUCT_TYPE(NegateImage) args_NegateImage = { image->mask, MagickFalse };
         | 
| 685 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NegateImage), &args_NegateImage);
         | 
| 442 686 |  | 
| 443 687 | 
             
                // Since both Set and GetImageMask clone the mask image I don't see any
         | 
| 444 688 | 
             
                // way to negate the mask without referencing it directly. Sigh.
         | 
| @@ -467,10 +711,11 @@ Image_add_noise(VALUE self, VALUE noise) | |
| 467 711 |  | 
| 468 712 | 
             
                exception = AcquireExceptionInfo();
         | 
| 469 713 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 470 | 
            -
                 | 
| 714 | 
            +
                GVL_STRUCT_TYPE(AddNoiseImage) args = { image, noise_type, 1.0, exception };
         | 
| 471 715 | 
             
            #else
         | 
| 472 | 
            -
                 | 
| 716 | 
            +
                GVL_STRUCT_TYPE(AddNoiseImage) args = { image, noise_type, exception };
         | 
| 473 717 | 
             
            #endif
         | 
| 718 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AddNoiseImage), &args);
         | 
| 474 719 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 475 720 | 
             
                DestroyExceptionInfo(exception);
         | 
| 476 721 |  | 
| @@ -517,10 +762,12 @@ Image_add_noise_channel(int argc, VALUE *argv, VALUE self) | |
| 517 762 | 
             
                exception = AcquireExceptionInfo();
         | 
| 518 763 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 519 764 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 520 | 
            -
                 | 
| 765 | 
            +
                GVL_STRUCT_TYPE(AddNoiseImage) args = { image, noise_type, 1.0, exception };
         | 
| 766 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AddNoiseImage), &args);
         | 
| 521 767 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 522 768 | 
             
            #else
         | 
| 523 | 
            -
                 | 
| 769 | 
            +
                GVL_STRUCT_TYPE(AddNoiseImageChannel) args = { image, channels, noise_type, exception };
         | 
| 770 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AddNoiseImageChannel), &args);
         | 
| 524 771 | 
             
            #endif
         | 
| 525 772 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 526 773 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -578,10 +825,12 @@ Image_add_profile(VALUE self, VALUE name) | |
| 578 825 | 
             
                    if (profile)
         | 
| 579 826 | 
             
                    {
         | 
| 580 827 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 581 | 
            -
                        ProfileImage | 
| 828 | 
            +
                        GVL_STRUCT_TYPE(ProfileImage) args = { image, profile_name, GetStringInfoDatum(profile), GetStringInfoLength(profile), exception };
         | 
| 829 | 
            +
                        CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 582 830 | 
             
                        if (rm_should_raise_exception(exception, RetainExceptionRetention))
         | 
| 583 831 | 
             
            #else
         | 
| 584 | 
            -
                        ProfileImage | 
| 832 | 
            +
                        GVL_STRUCT_TYPE(ProfileImage) args = { image, profile_name, GetStringInfoDatum(profile), GetStringInfoLength(profile), MagickFalse };
         | 
| 833 | 
            +
                        CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 585 834 | 
             
                        if (rm_should_raise_exception(&image->exception, RetainExceptionRetention))
         | 
| 586 835 | 
             
            #endif
         | 
| 587 836 | 
             
                        {
         | 
| @@ -652,11 +901,13 @@ Image_alpha(int argc, VALUE *argv, VALUE self) | |
| 652 901 |  | 
| 653 902 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 654 903 | 
             
                exception = AcquireExceptionInfo();
         | 
| 655 | 
            -
                SetImageAlphaChannel | 
| 904 | 
            +
                GVL_STRUCT_TYPE(SetImageAlphaChannel) args = { image, alpha, exception };
         | 
| 905 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageAlphaChannel), &args);
         | 
| 656 906 | 
             
                CHECK_EXCEPTION();
         | 
| 657 907 | 
             
                DestroyExceptionInfo(exception);
         | 
| 658 908 | 
             
            #else
         | 
| 659 | 
            -
                SetImageAlphaChannel | 
| 909 | 
            +
                GVL_STRUCT_TYPE(SetImageAlphaChannel) args = { image, alpha };
         | 
| 910 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageAlphaChannel), &args);
         | 
| 660 911 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 661 912 | 
             
            #endif
         | 
| 662 913 |  | 
| @@ -701,7 +952,8 @@ Image_affine_transform(VALUE self, VALUE affine) | |
| 701 952 | 
             
                Export_AffineMatrix(&matrix, affine);
         | 
| 702 953 |  | 
| 703 954 | 
             
                exception = AcquireExceptionInfo();
         | 
| 704 | 
            -
                 | 
| 955 | 
            +
                GVL_STRUCT_TYPE(AffineTransformImage) args = { image, &matrix, exception };
         | 
| 956 | 
            +
                new_image = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AffineTransformImage), &args);
         | 
| 705 957 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 706 958 | 
             
                DestroyExceptionInfo(exception);
         | 
| 707 959 |  | 
| @@ -823,6 +1075,9 @@ Image_aset(VALUE self, VALUE key_arg, VALUE attr_arg) | |
| 823 1075 | 
             
            }
         | 
| 824 1076 |  | 
| 825 1077 |  | 
| 1078 | 
            +
            // aliases for common use of structure types; TransposeImage, TransverseImage
         | 
| 1079 | 
            +
            typedef GVL_STRUCT_TYPE(TransposeImage) GVL_STRUCT_TYPE(crisscross);
         | 
| 1080 | 
            +
             | 
| 826 1081 | 
             
            /**
         | 
| 827 1082 | 
             
             * Handle #transverse, #transform methods.
         | 
| 828 1083 | 
             
             *
         | 
| @@ -834,15 +1089,16 @@ Image_aset(VALUE self, VALUE key_arg, VALUE attr_arg) | |
| 834 1089 | 
             
             * @return self if bang, otherwise a new image
         | 
| 835 1090 | 
             
             */
         | 
| 836 1091 | 
             
            static VALUE
         | 
| 837 | 
            -
            crisscross(int bang, VALUE self,  | 
| 1092 | 
            +
            crisscross(int bang, VALUE self, gvl_function_t fp)
         | 
| 838 1093 | 
             
            {
         | 
| 839 1094 | 
             
                Image *image, *new_image;
         | 
| 840 1095 | 
             
                ExceptionInfo *exception;
         | 
| 841 1096 |  | 
| 842 | 
            -
                 | 
| 1097 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 843 1098 | 
             
                exception = AcquireExceptionInfo();
         | 
| 844 1099 |  | 
| 845 | 
            -
                 | 
| 1100 | 
            +
                GVL_STRUCT_TYPE(crisscross) args = { image, exception };
         | 
| 1101 | 
            +
                new_image = CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 846 1102 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 847 1103 | 
             
                DestroyExceptionInfo(exception);
         | 
| 848 1104 |  | 
| @@ -859,6 +1115,12 @@ crisscross(int bang, VALUE self, Image *fp(const Image *, ExceptionInfo *)) | |
| 859 1115 | 
             
            }
         | 
| 860 1116 |  | 
| 861 1117 |  | 
| 1118 | 
            +
            // aliases for common use of structure types; AutoGammaImage, AutoLevelImage, AutoGammaImageChannel, AutoLevelImageChannel
         | 
| 1119 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 1120 | 
            +
            typedef GVL_STRUCT_TYPE(AutoGammaImage) GVL_STRUCT_TYPE(auto_channel);
         | 
| 1121 | 
            +
            #else
         | 
| 1122 | 
            +
            typedef GVL_STRUCT_TYPE(AutoGammaImageChannel) GVL_STRUCT_TYPE(auto_channel);
         | 
| 1123 | 
            +
            #endif
         | 
| 862 1124 |  | 
| 863 1125 | 
             
            /**
         | 
| 864 1126 | 
             
             * Handle #auto_gamma_channel, #auto_level_channel methods.
         | 
| @@ -872,7 +1134,7 @@ crisscross(int bang, VALUE self, Image *fp(const Image *, ExceptionInfo *)) | |
| 872 1134 | 
             
             * @return a new image
         | 
| 873 1135 | 
             
             */
         | 
| 874 1136 | 
             
            static VALUE
         | 
| 875 | 
            -
            auto_channel(int argc, VALUE *argv, VALUE self,  | 
| 1137 | 
            +
            auto_channel(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
         | 
| 876 1138 | 
             
            {
         | 
| 877 1139 | 
             
                Image *image, *new_image;
         | 
| 878 1140 | 
             
                ChannelType channels;
         | 
| @@ -893,12 +1155,14 @@ auto_channel(int argc, VALUE *argv, VALUE self, auto_channel_t fp) | |
| 893 1155 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 894 1156 | 
             
                exception = AcquireExceptionInfo();
         | 
| 895 1157 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 896 | 
            -
                ( | 
| 1158 | 
            +
                GVL_STRUCT_TYPE(auto_channel) args = { new_image, exception };
         | 
| 1159 | 
            +
                CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 897 1160 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 898 1161 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 899 1162 | 
             
                DestroyExceptionInfo(exception);
         | 
| 900 1163 | 
             
            #else
         | 
| 901 | 
            -
                ( | 
| 1164 | 
            +
                GVL_STRUCT_TYPE(auto_channel) args = { new_image, channels };
         | 
| 1165 | 
            +
                CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 902 1166 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 903 1167 | 
             
            #endif
         | 
| 904 1168 |  | 
| @@ -921,9 +1185,9 @@ VALUE | |
| 921 1185 | 
             
            Image_auto_gamma_channel(int argc, VALUE *argv, VALUE self)
         | 
| 922 1186 | 
             
            {
         | 
| 923 1187 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 924 | 
            -
                return auto_channel(argc, argv, self, AutoGammaImage);
         | 
| 1188 | 
            +
                return auto_channel(argc, argv, self, GVL_FUNC(AutoGammaImage));
         | 
| 925 1189 | 
             
            #else
         | 
| 926 | 
            -
                return auto_channel(argc, argv, self, AutoGammaImageChannel);
         | 
| 1190 | 
            +
                return auto_channel(argc, argv, self, GVL_FUNC(AutoGammaImageChannel));
         | 
| 927 1191 | 
             
            #endif
         | 
| 928 1192 | 
             
            }
         | 
| 929 1193 |  | 
| @@ -943,9 +1207,9 @@ VALUE | |
| 943 1207 | 
             
            Image_auto_level_channel(int argc, VALUE *argv, VALUE self)
         | 
| 944 1208 | 
             
            {
         | 
| 945 1209 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 946 | 
            -
                return auto_channel(argc, argv, self, AutoLevelImage);
         | 
| 1210 | 
            +
                return auto_channel(argc, argv, self, GVL_FUNC(AutoLevelImage));
         | 
| 947 1211 | 
             
            #else
         | 
| 948 | 
            -
                return auto_channel(argc, argv, self, AutoLevelImageChannel);
         | 
| 1212 | 
            +
                return auto_channel(argc, argv, self, GVL_FUNC(AutoLevelImageChannel));
         | 
| 949 1213 | 
             
            #endif
         | 
| 950 1214 | 
             
            }
         | 
| 951 1215 |  | 
| @@ -968,12 +1232,12 @@ auto_orient(int bang, VALUE self) | |
| 968 1232 | 
             
                VALUE new_image;
         | 
| 969 1233 | 
             
                VALUE degrees[1];
         | 
| 970 1234 |  | 
| 971 | 
            -
                 | 
| 1235 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 972 1236 |  | 
| 973 1237 | 
             
                switch (image->orientation)
         | 
| 974 1238 | 
             
                {
         | 
| 975 1239 | 
             
                    case TopRightOrientation:
         | 
| 976 | 
            -
                        new_image = flipflop(bang, self, FlopImage);
         | 
| 1240 | 
            +
                        new_image = flipflop(bang, self, GVL_FUNC(FlopImage));
         | 
| 977 1241 | 
             
                        break;
         | 
| 978 1242 |  | 
| 979 1243 | 
             
                    case BottomRightOrientation:
         | 
| @@ -982,11 +1246,11 @@ auto_orient(int bang, VALUE self) | |
| 982 1246 | 
             
                        break;
         | 
| 983 1247 |  | 
| 984 1248 | 
             
                    case BottomLeftOrientation:
         | 
| 985 | 
            -
                        new_image = flipflop(bang, self, FlipImage);
         | 
| 1249 | 
            +
                        new_image = flipflop(bang, self, GVL_FUNC(FlipImage));
         | 
| 986 1250 | 
             
                        break;
         | 
| 987 1251 |  | 
| 988 1252 | 
             
                    case LeftTopOrientation:
         | 
| 989 | 
            -
                        new_image = crisscross(bang, self, TransposeImage);
         | 
| 1253 | 
            +
                        new_image = crisscross(bang, self, GVL_FUNC(TransposeImage));
         | 
| 990 1254 | 
             
                        break;
         | 
| 991 1255 |  | 
| 992 1256 | 
             
                    case RightTopOrientation:
         | 
| @@ -995,7 +1259,7 @@ auto_orient(int bang, VALUE self) | |
| 995 1259 | 
             
                        break;
         | 
| 996 1260 |  | 
| 997 1261 | 
             
                    case RightBottomOrientation:
         | 
| 998 | 
            -
                        new_image = crisscross(bang, self, TransverseImage);
         | 
| 1262 | 
            +
                        new_image = crisscross(bang, self, GVL_FUNC(TransverseImage));
         | 
| 999 1263 | 
             
                        break;
         | 
| 1000 1264 |  | 
| 1001 1265 | 
             
                    case LeftBottomOrientation:
         | 
| @@ -1009,7 +1273,7 @@ auto_orient(int bang, VALUE self) | |
| 1009 1273 | 
             
                }
         | 
| 1010 1274 |  | 
| 1011 1275 |  | 
| 1012 | 
            -
                 | 
| 1276 | 
            +
                TypedData_Get_Struct(new_image, Image, &rm_image_data_type, image);
         | 
| 1013 1277 | 
             
                image->orientation = TopLeftOrientation;
         | 
| 1014 1278 |  | 
| 1015 1279 | 
             
                RB_GC_GUARD(new_image);
         | 
| @@ -1228,12 +1492,14 @@ Image_bilevel_channel(int argc, VALUE *argv, VALUE self) | |
| 1228 1492 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1229 1493 | 
             
                exception = AcquireExceptionInfo();
         | 
| 1230 1494 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 1231 | 
            -
                BilevelImage | 
| 1495 | 
            +
                GVL_STRUCT_TYPE(BilevelImage) args = { new_image, threshold, exception };
         | 
| 1496 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BilevelImage), &args);
         | 
| 1232 1497 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 1233 1498 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 1234 1499 | 
             
                DestroyExceptionInfo(exception);
         | 
| 1235 1500 | 
             
            #else
         | 
| 1236 | 
            -
                BilevelImageChannel | 
| 1501 | 
            +
                GVL_STRUCT_TYPE(BilevelImageChannel) args = { new_image, channels, threshold };
         | 
| 1502 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BilevelImageChannel), &args);
         | 
| 1237 1503 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 1238 1504 | 
             
            #endif
         | 
| 1239 1505 |  | 
| @@ -1320,7 +1586,7 @@ Image_black_point_compensation_eq(VALUE self, VALUE arg) | |
| 1320 1586 | 
             
            VALUE
         | 
| 1321 1587 | 
             
            Image_black_threshold(int argc, VALUE *argv, VALUE self)
         | 
| 1322 1588 | 
             
            {
         | 
| 1323 | 
            -
                return threshold_image(argc, argv, self, BlackThresholdImage);
         | 
| 1589 | 
            +
                return threshold_image(argc, argv, self, GVL_FUNC(BlackThresholdImage));
         | 
| 1324 1590 | 
             
            }
         | 
| 1325 1591 |  | 
| 1326 1592 |  | 
| @@ -1630,11 +1896,13 @@ special_composite(Image *image, Image *overlay, double image_pct, double overlay | |
| 1630 1896 |  | 
| 1631 1897 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1632 1898 | 
             
                exception = AcquireExceptionInfo();
         | 
| 1633 | 
            -
                CompositeImage | 
| 1899 | 
            +
                GVL_STRUCT_TYPE(CompositeImage) args = { new_image, overlay, op, MagickTrue, x_off, y_off, exception };
         | 
| 1900 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 1634 1901 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 1635 1902 | 
             
                DestroyExceptionInfo(exception);
         | 
| 1636 1903 | 
             
            #else
         | 
| 1637 | 
            -
                CompositeImage | 
| 1904 | 
            +
                GVL_STRUCT_TYPE(CompositeImage) args = { new_image, op, overlay, x_off, y_off };
         | 
| 1905 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 1638 1906 |  | 
| 1639 1907 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 1640 1908 | 
             
            #endif
         | 
| @@ -1741,7 +2009,8 @@ Image_blue_shift(int argc, VALUE *argv, VALUE self) | |
| 1741 2009 |  | 
| 1742 2010 |  | 
| 1743 2011 | 
             
                exception = AcquireExceptionInfo();
         | 
| 1744 | 
            -
                 | 
| 2012 | 
            +
                GVL_STRUCT_TYPE(BlueShiftImage) args = { image, factor, exception };
         | 
| 2013 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlueShiftImage), &args);
         | 
| 1745 2014 | 
             
                CHECK_EXCEPTION();
         | 
| 1746 2015 | 
             
                DestroyExceptionInfo(exception);
         | 
| 1747 2016 |  | 
| @@ -1793,11 +2062,13 @@ Image_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 1793 2062 | 
             
                exception = AcquireExceptionInfo();
         | 
| 1794 2063 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1795 2064 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 1796 | 
            -
                 | 
| 2065 | 
            +
                GVL_STRUCT_TYPE(BlurImage) args = { image, radius, sigma, exception };
         | 
| 2066 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlurImage), &args);
         | 
| 1797 2067 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 1798 2068 | 
             
                END_CHANNEL_MASK(image);
         | 
| 1799 2069 | 
             
            #else
         | 
| 1800 | 
            -
                 | 
| 2070 | 
            +
                GVL_STRUCT_TYPE(BlurImageChannel) args = { image, channels, radius, sigma, exception };
         | 
| 2071 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlurImageChannel), &args);
         | 
| 1801 2072 | 
             
            #endif
         | 
| 1802 2073 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 1803 2074 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -1817,7 +2088,7 @@ Image_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 1817 2088 | 
             
            VALUE
         | 
| 1818 2089 | 
             
            Image_blur_image(int argc, VALUE *argv, VALUE self)
         | 
| 1819 2090 | 
             
            {
         | 
| 1820 | 
            -
                return effect_image(self, argc, argv, BlurImage);
         | 
| 2091 | 
            +
                return effect_image(self, argc, argv, GVL_FUNC(BlurImage));
         | 
| 1821 2092 | 
             
            }
         | 
| 1822 2093 |  | 
| 1823 2094 |  | 
| @@ -1844,7 +2115,7 @@ border(int bang, VALUE self, VALUE width, VALUE height, VALUE color) | |
| 1844 2115 | 
             
                ExceptionInfo *exception;
         | 
| 1845 2116 | 
             
                RectangleInfo rect;
         | 
| 1846 2117 |  | 
| 1847 | 
            -
                 | 
| 2118 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 1848 2119 |  | 
| 1849 2120 | 
             
                memset(&rect, 0, sizeof(rect));
         | 
| 1850 2121 | 
             
                rect.width = NUM2UINT(width);
         | 
| @@ -1856,10 +2127,11 @@ border(int bang, VALUE self, VALUE width, VALUE height, VALUE color) | |
| 1856 2127 |  | 
| 1857 2128 | 
             
                exception = AcquireExceptionInfo();
         | 
| 1858 2129 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1859 | 
            -
                 | 
| 2130 | 
            +
                GVL_STRUCT_TYPE(BorderImage) args = { image, &rect, image->compose, exception };
         | 
| 1860 2131 | 
             
            #else
         | 
| 1861 | 
            -
                 | 
| 2132 | 
            +
                GVL_STRUCT_TYPE(BorderImage) args = { image, &rect, exception };
         | 
| 1862 2133 | 
             
            #endif
         | 
| 2134 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BorderImage), &args);
         | 
| 1863 2135 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 1864 2136 | 
             
                DestroyExceptionInfo(exception);
         | 
| 1865 2137 |  | 
| @@ -2033,7 +2305,7 @@ Image_capture(int argc, VALUE *argv, VALUE self ATTRIBUTE_UNUSED) | |
| 2033 2305 | 
             
                // Set info->server_name to the server name
         | 
| 2034 2306 | 
             
                // Also info->colorspace, depth, dither, interlace, type
         | 
| 2035 2307 | 
             
                info_obj = rm_info_new();
         | 
| 2036 | 
            -
                 | 
| 2308 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, image_info);
         | 
| 2037 2309 |  | 
| 2038 2310 | 
             
                // If an error occurs, IM will call our error handler and we raise an exception.
         | 
| 2039 2311 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| @@ -2144,12 +2416,14 @@ Image_channel(VALUE self, VALUE channel_arg) | |
| 2144 2416 |  | 
| 2145 2417 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2146 2418 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2147 | 
            -
                 | 
| 2419 | 
            +
                GVL_STRUCT_TYPE(SeparateImage) args = { image, channel, exception };
         | 
| 2420 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SeparateImage), &args);
         | 
| 2148 2421 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 2149 2422 | 
             
                DestroyExceptionInfo(exception);
         | 
| 2150 2423 | 
             
            #else
         | 
| 2151 2424 | 
             
                new_image = rm_clone_image(image);
         | 
| 2152 | 
            -
                SeparateImageChannel | 
| 2425 | 
            +
                GVL_STRUCT_TYPE(SeparateImageChannel) args = { new_image, channel };
         | 
| 2426 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SeparateImageChannel), &args);
         | 
| 2153 2427 |  | 
| 2154 2428 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 2155 2429 | 
             
            #endif
         | 
| @@ -2174,7 +2448,7 @@ Image_channel_depth(int argc, VALUE *argv, VALUE self) | |
| 2174 2448 | 
             
            {
         | 
| 2175 2449 | 
             
                Image *image;
         | 
| 2176 2450 | 
             
                ChannelType channels;
         | 
| 2177 | 
            -
                 | 
| 2451 | 
            +
                size_t channel_depth;
         | 
| 2178 2452 | 
             
                ExceptionInfo *exception;
         | 
| 2179 2453 |  | 
| 2180 2454 | 
             
                image = rm_check_destroyed(self);
         | 
| @@ -2190,10 +2464,12 @@ Image_channel_depth(int argc, VALUE *argv, VALUE self) | |
| 2190 2464 |  | 
| 2191 2465 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2192 2466 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 2193 | 
            -
                 | 
| 2467 | 
            +
                GVL_STRUCT_TYPE(GetImageDepth) args = { image, exception };
         | 
| 2468 | 
            +
                channel_depth = (size_t)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageDepth), &args);
         | 
| 2194 2469 | 
             
                END_CHANNEL_MASK(image);
         | 
| 2195 2470 | 
             
            #else
         | 
| 2196 | 
            -
                 | 
| 2471 | 
            +
                GVL_STRUCT_TYPE(GetImageChannelDepth) args = { image, channels, exception };
         | 
| 2472 | 
            +
                channel_depth = (size_t)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageChannelDepth), &args);
         | 
| 2197 2473 | 
             
            #endif
         | 
| 2198 2474 | 
             
                CHECK_EXCEPTION();
         | 
| 2199 2475 |  | 
| @@ -2237,10 +2513,12 @@ Image_channel_extrema(int argc, VALUE *argv, VALUE self) | |
| 2237 2513 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2238 2514 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2239 2515 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 2240 | 
            -
                GetImageExtrema | 
| 2516 | 
            +
                GVL_STRUCT_TYPE(GetImageExtrema) args = { image, &min, &max, exception };
         | 
| 2517 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageExtrema), &args);
         | 
| 2241 2518 | 
             
                END_CHANNEL_MASK(image);
         | 
| 2242 2519 | 
             
            #else
         | 
| 2243 | 
            -
                GetImageChannelExtrema | 
| 2520 | 
            +
                GVL_STRUCT_TYPE(GetImageChannelExtrema) args = { image, channels, &min, &max, exception };
         | 
| 2521 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageChannelExtrema), &args);
         | 
| 2244 2522 | 
             
            #endif
         | 
| 2245 2523 | 
             
                CHECK_EXCEPTION();
         | 
| 2246 2524 |  | 
| @@ -2290,10 +2568,12 @@ Image_channel_mean(int argc, VALUE *argv, VALUE self) | |
| 2290 2568 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2291 2569 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2292 2570 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 2293 | 
            -
                GetImageMean | 
| 2571 | 
            +
                GVL_STRUCT_TYPE(GetImageMean) args = { image, &mean, &stddev, exception };
         | 
| 2572 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageMean), &args);
         | 
| 2294 2573 | 
             
                END_CHANNEL_MASK(image);
         | 
| 2295 2574 | 
             
            #else
         | 
| 2296 | 
            -
                GetImageChannelMean | 
| 2575 | 
            +
                GVL_STRUCT_TYPE(GetImageChannelMean) args = { image, channels, &mean, &stddev, exception };
         | 
| 2576 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageChannelMean), &args);
         | 
| 2297 2577 | 
             
            #endif
         | 
| 2298 2578 | 
             
                CHECK_EXCEPTION();
         | 
| 2299 2579 |  | 
| @@ -2342,10 +2622,12 @@ Image_channel_entropy(int argc, VALUE *argv, VALUE self) | |
| 2342 2622 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2343 2623 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2344 2624 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 2345 | 
            -
                GetImageEntropy | 
| 2625 | 
            +
                GVL_STRUCT_TYPE(GetImageEntropy) args = { image, &entropy, exception };
         | 
| 2626 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageEntropy), &args);
         | 
| 2346 2627 | 
             
                END_CHANNEL_MASK(image);
         | 
| 2347 2628 | 
             
            #else
         | 
| 2348 | 
            -
                GetImageChannelEntropy | 
| 2629 | 
            +
                GVL_STRUCT_TYPE(GetImageChannelEntropy) args = { image, channels, &entropy, exception };
         | 
| 2630 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageChannelEntropy), &args);
         | 
| 2349 2631 | 
             
            #endif
         | 
| 2350 2632 | 
             
                CHECK_EXCEPTION();
         | 
| 2351 2633 |  | 
| @@ -2377,7 +2659,7 @@ Image_channel_entropy(int argc ATTRIBUTE_UNUSED, VALUE *argv ATTRIBUTE_UNUSED, V | |
| 2377 2659 | 
             
            VALUE
         | 
| 2378 2660 | 
             
            Image_charcoal(int argc, VALUE *argv, VALUE self)
         | 
| 2379 2661 | 
             
            {
         | 
| 2380 | 
            -
                return effect_image(self, argc, argv, CharcoalImage);
         | 
| 2662 | 
            +
                return effect_image(self, argc, argv, GVL_FUNC(CharcoalImage));
         | 
| 2381 2663 | 
             
            }
         | 
| 2382 2664 |  | 
| 2383 2665 |  | 
| @@ -2408,7 +2690,7 @@ VALUE | |
| 2408 2690 | 
             
            Image_chop(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
         | 
| 2409 2691 | 
             
            {
         | 
| 2410 2692 | 
             
                rm_check_destroyed(self);
         | 
| 2411 | 
            -
                return xform_image(False, self, x, y, width, height, ChopImage);
         | 
| 2693 | 
            +
                return xform_image(False, self, x, y, width, height, GVL_FUNC(ChopImage));
         | 
| 2412 2694 | 
             
            }
         | 
| 2413 2695 |  | 
| 2414 2696 |  | 
| @@ -2513,17 +2795,19 @@ Image_clut_channel(int argc, VALUE *argv, VALUE self) | |
| 2513 2795 | 
             
                    rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or more)", argc);
         | 
| 2514 2796 | 
             
                }
         | 
| 2515 2797 |  | 
| 2516 | 
            -
                 | 
| 2798 | 
            +
                TypedData_Get_Struct(argv[0], Image, &rm_image_data_type, clut);
         | 
| 2517 2799 |  | 
| 2518 2800 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2519 2801 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2520 2802 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 2521 | 
            -
                 | 
| 2803 | 
            +
                GVL_STRUCT_TYPE(ClutImage) args = { image, clut, image->interpolate, exception };
         | 
| 2804 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ClutImage), &args);
         | 
| 2522 2805 | 
             
                END_CHANNEL_MASK(image);
         | 
| 2523 2806 | 
             
                CHECK_EXCEPTION();
         | 
| 2524 2807 | 
             
                DestroyExceptionInfo(exception);
         | 
| 2525 2808 | 
             
            #else
         | 
| 2526 | 
            -
                 | 
| 2809 | 
            +
                GVL_STRUCT_TYPE(ClutImageChannel) args = { image, channels, clut };
         | 
| 2810 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ClutImageChannel), &args);
         | 
| 2527 2811 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 2528 2812 | 
             
                rm_check_image_exception(clut, RetainOnError);
         | 
| 2529 2813 | 
             
            #endif
         | 
| @@ -2564,14 +2848,16 @@ Image_color_histogram(VALUE self) | |
| 2564 2848 | 
             
                {
         | 
| 2565 2849 | 
             
                    dc_copy = rm_clone_image(image);
         | 
| 2566 2850 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2567 | 
            -
                    SetImageStorageClass | 
| 2851 | 
            +
                    GVL_STRUCT_TYPE(SetImageStorageClass) args = { dc_copy, DirectClass, exception };
         | 
| 2568 2852 | 
             
            #else
         | 
| 2569 | 
            -
                    SetImageStorageClass | 
| 2853 | 
            +
                    GVL_STRUCT_TYPE(SetImageStorageClass) args = { dc_copy, DirectClass };
         | 
| 2570 2854 | 
             
            #endif
         | 
| 2855 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 2571 2856 | 
             
                    image = dc_copy;
         | 
| 2572 2857 | 
             
                }
         | 
| 2573 2858 |  | 
| 2574 | 
            -
                 | 
| 2859 | 
            +
                GVL_STRUCT_TYPE(GetImageHistogram) args = { image, &colors, exception };
         | 
| 2860 | 
            +
                histogram = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageHistogram), &args);
         | 
| 2575 2861 |  | 
| 2576 2862 | 
             
                if (histogram == NULL)
         | 
| 2577 2863 | 
             
                {
         | 
| @@ -2665,7 +2951,8 @@ set_profile(VALUE self, const char *name, VALUE profile) | |
| 2665 2951 |  | 
| 2666 2952 | 
             
                strlcpy(info->magick, m->name, sizeof(info->magick));
         | 
| 2667 2953 |  | 
| 2668 | 
            -
                 | 
| 2954 | 
            +
                GVL_STRUCT_TYPE(BlobToImage) args = { info, profile_blob, (size_t)profile_length, exception };
         | 
| 2955 | 
            +
                profile_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlobToImage), &args);
         | 
| 2669 2956 | 
             
                DestroyImageInfo(info);
         | 
| 2670 2957 | 
             
                CHECK_EXCEPTION();
         | 
| 2671 2958 |  | 
| @@ -2677,10 +2964,12 @@ set_profile(VALUE self, const char *name, VALUE profile) | |
| 2677 2964 | 
             
                    if (rm_strcasecmp("8bim", profile_name) == 0 && rm_strcasecmp("iptc", name) == 0)
         | 
| 2678 2965 | 
             
                    {
         | 
| 2679 2966 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2680 | 
            -
                        ProfileImage | 
| 2967 | 
            +
                        GVL_STRUCT_TYPE(ProfileImage) args = { image, name, profile_blob, profile_length, exception };
         | 
| 2968 | 
            +
                        CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 2681 2969 | 
             
                        if (rm_should_raise_exception(exception, RetainExceptionRetention))
         | 
| 2682 2970 | 
             
            #else
         | 
| 2683 | 
            -
                        ProfileImage | 
| 2971 | 
            +
                        GVL_STRUCT_TYPE(ProfileImage) args = { image, name, profile_blob, profile_length, MagickFalse };
         | 
| 2972 | 
            +
                        CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 2684 2973 | 
             
                        if (rm_should_raise_exception(&image->exception, RetainExceptionRetention))
         | 
| 2685 2974 | 
             
            #endif
         | 
| 2686 2975 | 
             
                        {
         | 
| @@ -2693,10 +2982,12 @@ set_profile(VALUE self, const char *name, VALUE profile) | |
| 2693 2982 | 
             
                        if (profile_data)
         | 
| 2694 2983 | 
             
                        {
         | 
| 2695 2984 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2696 | 
            -
                            ProfileImage | 
| 2985 | 
            +
                            GVL_STRUCT_TYPE(ProfileImage) args = { image, name, GetStringInfoDatum(profile_data), GetStringInfoLength(profile_data), exception };
         | 
| 2986 | 
            +
                            CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 2697 2987 | 
             
                            if (rm_should_raise_exception(exception, RetainExceptionRetention))
         | 
| 2698 2988 | 
             
            #else
         | 
| 2699 | 
            -
                            ProfileImage | 
| 2989 | 
            +
                            GVL_STRUCT_TYPE(ProfileImage) args = { image, name, GetStringInfoDatum(profile_data), GetStringInfoLength(profile_data), MagickFalse };
         | 
| 2990 | 
            +
                            CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 2700 2991 | 
             
                            if (rm_should_raise_exception(&image->exception, RetainExceptionRetention))
         | 
| 2701 2992 | 
             
            #endif
         | 
| 2702 2993 | 
             
                            {
         | 
| @@ -2845,12 +3136,14 @@ Image_color_flood_fill(VALUE self, VALUE target_color, VALUE fill_color, | |
| 2845 3136 |  | 
| 2846 3137 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2847 3138 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2848 | 
            -
                FloodfillPaintImage | 
| 3139 | 
            +
                GVL_STRUCT_TYPE(FloodfillPaintImage) args = { new_image, draw_info, &target_mpp, x, y, invert, exception };
         | 
| 3140 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FloodfillPaintImage), &args);
         | 
| 2849 3141 | 
             
                DestroyDrawInfo(draw_info);
         | 
| 2850 3142 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 2851 3143 | 
             
                DestroyExceptionInfo(exception);
         | 
| 2852 3144 | 
             
            #else
         | 
| 2853 | 
            -
                FloodfillPaintImage | 
| 3145 | 
            +
                GVL_STRUCT_TYPE(FloodfillPaintImage) args = { new_image, DefaultChannels, draw_info, &target_mpp, x, y, invert };
         | 
| 3146 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FloodfillPaintImage), &args);
         | 
| 2854 3147 |  | 
| 2855 3148 | 
             
                DestroyDrawInfo(draw_info);
         | 
| 2856 3149 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| @@ -2914,10 +3207,11 @@ Image_colorize(int argc, VALUE *argv, VALUE self) | |
| 2914 3207 |  | 
| 2915 3208 | 
             
                exception = AcquireExceptionInfo();
         | 
| 2916 3209 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 2917 | 
            -
                 | 
| 3210 | 
            +
                GVL_STRUCT_TYPE(ColorizeImage) args = { image, opacity, &target, exception };
         | 
| 2918 3211 | 
             
            #else
         | 
| 2919 | 
            -
                 | 
| 3212 | 
            +
                GVL_STRUCT_TYPE(ColorizeImage) args = { image, opacity, target, exception };
         | 
| 2920 3213 | 
             
            #endif
         | 
| 3214 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ColorizeImage), &args);
         | 
| 2921 3215 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 2922 3216 | 
             
                DestroyExceptionInfo(exception);
         | 
| 2923 3217 |  | 
| @@ -3027,7 +3321,7 @@ Image_colormap(int argc, VALUE *argv, VALUE self) | |
| 3027 3321 | 
             
            VALUE
         | 
| 3028 3322 | 
             
            Image_colors(VALUE self)
         | 
| 3029 3323 | 
             
            {
         | 
| 3030 | 
            -
                 | 
| 3324 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, colors, ulong, &rm_image_data_type);
         | 
| 3031 3325 | 
             
            }
         | 
| 3032 3326 |  | 
| 3033 3327 | 
             
            /**
         | 
| @@ -3067,11 +3361,13 @@ Image_colorspace_eq(VALUE self, VALUE colorspace) | |
| 3067 3361 |  | 
| 3068 3362 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3069 3363 | 
             
                exception = AcquireExceptionInfo();
         | 
| 3070 | 
            -
                TransformImageColorspace | 
| 3364 | 
            +
                GVL_STRUCT_TYPE(TransformImageColorspace) args = { image, new_cs, exception };
         | 
| 3365 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransformImageColorspace), &args);
         | 
| 3071 3366 | 
             
                CHECK_EXCEPTION();
         | 
| 3072 3367 | 
             
                DestroyExceptionInfo(exception);
         | 
| 3073 3368 | 
             
            #else
         | 
| 3074 | 
            -
                TransformImageColorspace | 
| 3369 | 
            +
                GVL_STRUCT_TYPE(TransformImageColorspace) args = { image, new_cs };
         | 
| 3370 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransformImageColorspace), &args);
         | 
| 3075 3371 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 3076 3372 | 
             
            #endif
         | 
| 3077 3373 |  | 
| @@ -3087,7 +3383,7 @@ Image_colorspace_eq(VALUE self, VALUE colorspace) | |
| 3087 3383 | 
             
            VALUE
         | 
| 3088 3384 | 
             
            Image_columns(VALUE self)
         | 
| 3089 3385 | 
             
            {
         | 
| 3090 | 
            -
                 | 
| 3386 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, columns, int, &rm_image_data_type);
         | 
| 3091 3387 | 
             
            }
         | 
| 3092 3388 |  | 
| 3093 3389 |  | 
| @@ -3171,10 +3467,12 @@ Image_compare_channel(int argc, VALUE *argv, VALUE self) | |
| 3171 3467 | 
             
                exception = AcquireExceptionInfo();
         | 
| 3172 3468 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3173 3469 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 3174 | 
            -
                 | 
| 3470 | 
            +
                GVL_STRUCT_TYPE(CompareImages) args = { image, r_image, metric_type, &distortion, exception };
         | 
| 3471 | 
            +
                difference_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImages), &args);
         | 
| 3175 3472 | 
             
                END_CHANNEL_MASK(image);
         | 
| 3176 3473 | 
             
            #else
         | 
| 3177 | 
            -
                 | 
| 3474 | 
            +
                GVL_STRUCT_TYPE(CompareImageChannels) args = { image, r_image, channels, metric_type, &distortion, exception };
         | 
| 3475 | 
            +
                difference_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImageChannels), &args);
         | 
| 3178 3476 | 
             
            #endif
         | 
| 3179 3477 | 
             
                rm_check_exception(exception, difference_image, DestroyOnError);
         | 
| 3180 3478 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -3372,12 +3670,14 @@ composite(int bang, int argc, VALUE *argv, VALUE self, ChannelType channels) | |
| 3372 3670 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3373 3671 | 
             
                    exception = AcquireExceptionInfo();
         | 
| 3374 3672 | 
             
                    BEGIN_CHANNEL_MASK(image, channels);
         | 
| 3375 | 
            -
                    CompositeImage | 
| 3673 | 
            +
                    GVL_STRUCT_TYPE(CompositeImage) args = { image, comp_image, operator, MagickTrue, x_offset, y_offset, exception };
         | 
| 3674 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 3376 3675 | 
             
                    END_CHANNEL_MASK(image);
         | 
| 3377 3676 | 
             
                    CHECK_EXCEPTION();
         | 
| 3378 3677 | 
             
                    DestroyExceptionInfo(exception);
         | 
| 3379 3678 | 
             
            #else
         | 
| 3380 | 
            -
                    CompositeImageChannel | 
| 3679 | 
            +
                    GVL_STRUCT_TYPE(CompositeImageChannel) args = { image, channels, operator, comp_image, x_offset, y_offset };
         | 
| 3680 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImageChannel), &args);
         | 
| 3381 3681 | 
             
                    rm_check_image_exception(image, RetainOnError);
         | 
| 3382 3682 | 
             
            #endif
         | 
| 3383 3683 |  | 
| @@ -3390,12 +3690,14 @@ composite(int bang, int argc, VALUE *argv, VALUE self, ChannelType channels) | |
| 3390 3690 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3391 3691 | 
             
                    exception = AcquireExceptionInfo();
         | 
| 3392 3692 | 
             
                    BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 3393 | 
            -
                    CompositeImage | 
| 3693 | 
            +
                    GVL_STRUCT_TYPE(CompositeImage) args = { new_image, comp_image, operator, MagickTrue, x_offset, y_offset, exception };
         | 
| 3694 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 3394 3695 | 
             
                    END_CHANNEL_MASK(new_image);
         | 
| 3395 3696 | 
             
                    rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 3396 3697 | 
             
                    DestroyExceptionInfo(exception);
         | 
| 3397 3698 | 
             
            #else
         | 
| 3398 | 
            -
                    CompositeImageChannel | 
| 3699 | 
            +
                    GVL_STRUCT_TYPE(CompositeImageChannel) args = { new_image, channels, operator, comp_image, x_offset, y_offset };
         | 
| 3700 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImageChannel), &args);
         | 
| 3399 3701 | 
             
                    rm_check_image_exception(new_image, DestroyOnError);
         | 
| 3400 3702 | 
             
            #endif
         | 
| 3401 3703 |  | 
| @@ -3509,11 +3811,13 @@ Image_composite_affine(VALUE self, VALUE source, VALUE affine_matrix) | |
| 3509 3811 |  | 
| 3510 3812 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3511 3813 | 
             
                exception = AcquireExceptionInfo();
         | 
| 3512 | 
            -
                DrawAffineImage | 
| 3814 | 
            +
                GVL_STRUCT_TYPE(DrawAffineImage) args = { new_image, composite_image, &affine, exception };
         | 
| 3815 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DrawAffineImage), &args);
         | 
| 3513 3816 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 3514 3817 | 
             
                DestroyExceptionInfo(exception);
         | 
| 3515 3818 | 
             
            #else
         | 
| 3516 | 
            -
                DrawAffineImage | 
| 3819 | 
            +
                GVL_STRUCT_TYPE(DrawAffineImage) args = { new_image, composite_image, &affine };
         | 
| 3820 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DrawAffineImage), &args);
         | 
| 3517 3821 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 3518 3822 | 
             
            #endif
         | 
| 3519 3823 |  | 
| @@ -3877,11 +4181,13 @@ composite_tiled(int bang, int argc, VALUE *argv, VALUE self) | |
| 3877 4181 | 
             
                    {
         | 
| 3878 4182 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3879 4183 | 
             
                        BEGIN_CHANNEL_MASK(image, channels);
         | 
| 3880 | 
            -
                         | 
| 4184 | 
            +
                        GVL_STRUCT_TYPE(CompositeImage) args = { image, comp_image, operator, MagickTrue, x, y, exception };
         | 
| 4185 | 
            +
                        status = (MagickStatusType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 3881 4186 | 
             
                        END_CHANNEL_MASK(image);
         | 
| 3882 4187 | 
             
                        rm_check_exception(exception, image, bang ? RetainOnError: DestroyOnError);
         | 
| 3883 4188 | 
             
            #else
         | 
| 3884 | 
            -
                         | 
| 4189 | 
            +
                        GVL_STRUCT_TYPE(CompositeImageChannel) args = { image, channels, operator, comp_image, x, y };
         | 
| 4190 | 
            +
                        status = (MagickStatusType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImageChannel), &args);
         | 
| 3885 4191 | 
             
                        rm_check_image_exception(image, bang ? RetainOnError: DestroyOnError);
         | 
| 3886 4192 | 
             
            #endif
         | 
| 3887 4193 | 
             
                    }
         | 
| @@ -3994,11 +4300,13 @@ Image_compress_colormap_bang(VALUE self) | |
| 3994 4300 |  | 
| 3995 4301 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 3996 4302 | 
             
                exception = AcquireExceptionInfo();
         | 
| 3997 | 
            -
                 | 
| 4303 | 
            +
                GVL_STRUCT_TYPE(CompressImageColormap) args = { image, exception };
         | 
| 4304 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompressImageColormap), &args);
         | 
| 3998 4305 | 
             
                CHECK_EXCEPTION();
         | 
| 3999 4306 | 
             
                DestroyExceptionInfo(exception);
         | 
| 4000 4307 | 
             
            #else
         | 
| 4001 | 
            -
                 | 
| 4308 | 
            +
                GVL_STRUCT_TYPE(CompressImageColormap) args = { image };
         | 
| 4309 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompressImageColormap), &args);
         | 
| 4002 4310 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 4003 4311 | 
             
            #endif
         | 
| 4004 4312 | 
             
                if (!okay)
         | 
| @@ -4128,9 +4436,11 @@ Image_constitute(VALUE class ATTRIBUTE_UNUSED, VALUE width_arg, VALUE height_arg | |
| 4128 4436 |  | 
| 4129 4437 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4130 4438 | 
             
                exception = AcquireExceptionInfo();
         | 
| 4131 | 
            -
                SetImageExtent | 
| 4439 | 
            +
                GVL_STRUCT_TYPE(SetImageExtent) args_SetImageExtent = { new_image, width, height, exception };
         | 
| 4440 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageExtent), &args_SetImageExtent);
         | 
| 4132 4441 | 
             
            #else
         | 
| 4133 | 
            -
                SetImageExtent | 
| 4442 | 
            +
                GVL_STRUCT_TYPE(SetImageExtent) args_SetImageExtent = { new_image, width, height };
         | 
| 4443 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageExtent), &args_SetImageExtent);
         | 
| 4134 4444 | 
             
                exception = &new_image->exception;
         | 
| 4135 4445 | 
             
            #endif
         | 
| 4136 4446 |  | 
| @@ -4146,9 +4456,11 @@ Image_constitute(VALUE class ATTRIBUTE_UNUSED, VALUE width_arg, VALUE height_arg | |
| 4146 4456 | 
             
                }
         | 
| 4147 4457 |  | 
| 4148 4458 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4149 | 
            -
                SetImageBackgroundColor | 
| 4459 | 
            +
                GVL_STRUCT_TYPE(SetImageBackgroundColor) args_SetImageBackgroundColor = { new_image, exception };
         | 
| 4460 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageBackgroundColor), &args_SetImageBackgroundColor);
         | 
| 4150 4461 | 
             
            #else
         | 
| 4151 | 
            -
                SetImageBackgroundColor | 
| 4462 | 
            +
                GVL_STRUCT_TYPE(SetImageBackgroundColor) args_SetImageBackgroundColor = { new_image };
         | 
| 4463 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageBackgroundColor), &args_SetImageBackgroundColor);
         | 
| 4152 4464 | 
             
                exception = &new_image->exception;
         | 
| 4153 4465 | 
             
            #endif
         | 
| 4154 4466 |  | 
| @@ -4164,12 +4476,14 @@ Image_constitute(VALUE class ATTRIBUTE_UNUSED, VALUE width_arg, VALUE height_arg | |
| 4164 4476 | 
             
                }
         | 
| 4165 4477 |  | 
| 4166 4478 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4167 | 
            -
                ImportImagePixels | 
| 4479 | 
            +
                GVL_STRUCT_TYPE(ImportImagePixels) args_ImportImagePixels = { new_image, 0, 0, width, height, map, stg_type, (const void *)pixels.v, exception };
         | 
| 4480 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImportImagePixels), &args_ImportImagePixels);
         | 
| 4168 4481 | 
             
                xfree(pixels.v);
         | 
| 4169 4482 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 4170 4483 | 
             
                DestroyExceptionInfo(exception);
         | 
| 4171 4484 | 
             
            #else
         | 
| 4172 | 
            -
                ImportImagePixels | 
| 4485 | 
            +
                GVL_STRUCT_TYPE(ImportImagePixels) args_ImportImagePixels = { new_image, 0, 0, width, height, map, stg_type, (const void *)pixels.v };
         | 
| 4486 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImportImagePixels), &args_ImportImagePixels);
         | 
| 4173 4487 | 
             
                xfree(pixels.v);
         | 
| 4174 4488 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 4175 4489 | 
             
            #endif
         | 
| @@ -4336,12 +4650,14 @@ Image_contrast_stretch_channel(int argc, VALUE *argv, VALUE self) | |
| 4336 4650 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4337 4651 | 
             
                exception = AcquireExceptionInfo();
         | 
| 4338 4652 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 4339 | 
            -
                ContrastStretchImage | 
| 4653 | 
            +
                GVL_STRUCT_TYPE(ContrastStretchImage) args = { new_image, black_point, white_point, exception };
         | 
| 4654 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ContrastStretchImage), &args);
         | 
| 4340 4655 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 4341 4656 | 
             
                CHECK_EXCEPTION();
         | 
| 4342 4657 | 
             
                DestroyExceptionInfo(exception);
         | 
| 4343 4658 | 
             
            #else
         | 
| 4344 | 
            -
                ContrastStretchImageChannel | 
| 4659 | 
            +
                GVL_STRUCT_TYPE(ContrastStretchImageChannel) args = { new_image, channels, black_point, white_point };
         | 
| 4660 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ContrastStretchImageChannel), &args);
         | 
| 4345 4661 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 4346 4662 | 
             
            #endif
         | 
| 4347 4663 |  | 
| @@ -4411,17 +4727,19 @@ Image_morphology_channel(VALUE self, VALUE channel_v, VALUE method_v, VALUE iter | |
| 4411 4727 | 
             
                    rb_raise(rb_eArgError, "expected String or Magick::KernelInfo");
         | 
| 4412 4728 | 
             
                }
         | 
| 4413 4729 |  | 
| 4414 | 
            -
                 | 
| 4730 | 
            +
                TypedData_Get_Struct(kernel_v, KernelInfo, &rm_kernel_info_data_type, kernel);
         | 
| 4415 4731 |  | 
| 4416 4732 | 
             
                exception = AcquireExceptionInfo();
         | 
| 4417 4733 |  | 
| 4418 4734 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4419 4735 | 
             
                BEGIN_CHANNEL_MASK(image, channel);
         | 
| 4420 | 
            -
                 | 
| 4736 | 
            +
                GVL_STRUCT_TYPE(MorphologyImage) args = { image, method, NUM2LONG(iterations), kernel, exception };
         | 
| 4737 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MorphologyImage), &args);
         | 
| 4421 4738 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 4422 4739 | 
             
                END_CHANNEL_MASK(image);
         | 
| 4423 4740 | 
             
            #else
         | 
| 4424 | 
            -
                 | 
| 4741 | 
            +
                GVL_STRUCT_TYPE(MorphologyImageChannel) args = { image, channel, method, NUM2LONG(iterations), kernel, exception };
         | 
| 4742 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MorphologyImageChannel), &args);
         | 
| 4425 4743 | 
             
            #endif
         | 
| 4426 4744 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 4427 4745 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -4532,10 +4850,12 @@ Image_convolve(VALUE self, VALUE order_arg, VALUE kernel_arg) | |
| 4532 4850 | 
             
                exception = AcquireExceptionInfo();
         | 
| 4533 4851 |  | 
| 4534 4852 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4535 | 
            -
                 | 
| 4853 | 
            +
                GVL_STRUCT_TYPE(ConvolveImage) args = { image, kernel, exception };
         | 
| 4854 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ConvolveImage), &args);
         | 
| 4536 4855 | 
             
                DestroyKernelInfo(kernel);
         | 
| 4537 4856 | 
             
            #else
         | 
| 4538 | 
            -
                 | 
| 4857 | 
            +
                GVL_STRUCT_TYPE(ConvolveImage) args = { image, order, kernel, exception };
         | 
| 4858 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ConvolveImage), &args);
         | 
| 4539 4859 | 
             
                xfree((void *)kernel);
         | 
| 4540 4860 | 
             
            #endif
         | 
| 4541 4861 |  | 
| @@ -4624,12 +4944,14 @@ Image_convolve_channel(int argc, VALUE *argv, VALUE self) | |
| 4624 4944 |  | 
| 4625 4945 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4626 4946 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 4627 | 
            -
                 | 
| 4947 | 
            +
                GVL_STRUCT_TYPE(ConvolveImage) args = { image, kernel, exception };
         | 
| 4948 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ConvolveImage), &args);
         | 
| 4628 4949 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 4629 4950 | 
             
                END_CHANNEL_MASK(image);
         | 
| 4630 4951 | 
             
                DestroyKernelInfo(kernel);
         | 
| 4631 4952 | 
             
            #else
         | 
| 4632 | 
            -
                 | 
| 4953 | 
            +
                GVL_STRUCT_TYPE(ConvolveImageChannel) args = { image, channels, order, kernel, exception };
         | 
| 4954 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ConvolveImageChannel), &args);
         | 
| 4633 4955 | 
             
                xfree((void *)kernel);
         | 
| 4634 4956 | 
             
            #endif
         | 
| 4635 4957 |  | 
| @@ -4772,11 +5094,13 @@ Image_cycle_colormap(VALUE self, VALUE amount) | |
| 4772 5094 |  | 
| 4773 5095 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 4774 5096 | 
             
                exception = AcquireExceptionInfo();
         | 
| 4775 | 
            -
                CycleColormapImage | 
| 5097 | 
            +
                GVL_STRUCT_TYPE(CycleColormapImage) args = { new_image, amt, exception };
         | 
| 5098 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CycleColormapImage), &args);
         | 
| 4776 5099 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 4777 5100 | 
             
                DestroyExceptionInfo(exception);
         | 
| 4778 5101 | 
             
            #else
         | 
| 4779 | 
            -
                CycleColormapImage | 
| 5102 | 
            +
                GVL_STRUCT_TYPE(CycleColormapImage) args = { new_image, amt };
         | 
| 5103 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CycleColormapImage), &args);
         | 
| 4780 5104 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 4781 5105 | 
             
            #endif
         | 
| 4782 5106 |  | 
| @@ -4911,7 +5235,8 @@ Image_decipher(VALUE self, VALUE passphrase) | |
| 4911 5235 |  | 
| 4912 5236 | 
             
                new_image = rm_clone_image(image);
         | 
| 4913 5237 |  | 
| 4914 | 
            -
                 | 
| 5238 | 
            +
                GVL_STRUCT_TYPE(DecipherImage) args = { new_image, pf, exception };
         | 
| 5239 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DecipherImage), &args);
         | 
| 4915 5240 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 4916 5241 | 
             
                if (!okay)
         | 
| 4917 5242 | 
             
                {
         | 
| @@ -4978,7 +5303,7 @@ Image_define(VALUE self, VALUE artifact, VALUE value) | |
| 4978 5303 | 
             
            VALUE
         | 
| 4979 5304 | 
             
            Image_delay(VALUE self)
         | 
| 4980 5305 | 
             
            {
         | 
| 4981 | 
            -
                 | 
| 5306 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, delay, ulong, &rm_image_data_type);
         | 
| 4982 5307 | 
             
            }
         | 
| 4983 5308 |  | 
| 4984 5309 | 
             
            /**
         | 
| @@ -4991,7 +5316,7 @@ Image_delay(VALUE self) | |
| 4991 5316 | 
             
            VALUE
         | 
| 4992 5317 | 
             
            Image_delay_eq(VALUE self, VALUE val)
         | 
| 4993 5318 | 
             
            {
         | 
| 4994 | 
            -
                 | 
| 5319 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, delay, ulong, &rm_image_data_type);
         | 
| 4995 5320 | 
             
            }
         | 
| 4996 5321 |  | 
| 4997 5322 |  | 
| @@ -5013,11 +5338,13 @@ Image_delete_compose_mask(VALUE self) | |
| 5013 5338 |  | 
| 5014 5339 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 5015 5340 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5016 | 
            -
                SetImageMask | 
| 5341 | 
            +
                GVL_STRUCT_TYPE(SetImageMask) args = { image, CompositePixelMask, NULL, exception };
         | 
| 5342 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageMask), &args);
         | 
| 5017 5343 | 
             
                CHECK_EXCEPTION();
         | 
| 5018 5344 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5019 5345 | 
             
            #else
         | 
| 5020 | 
            -
                SetImageMask | 
| 5346 | 
            +
                GVL_STRUCT_TYPE(SetImageMask) args = { image, NULL };
         | 
| 5347 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageMask), &args);
         | 
| 5021 5348 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 5022 5349 | 
             
            #endif
         | 
| 5023 5350 |  | 
| @@ -5041,11 +5368,13 @@ Image_delete_profile(VALUE self, VALUE name) | |
| 5041 5368 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 5042 5369 | 
             
                ExceptionInfo *exception = AcquireExceptionInfo();
         | 
| 5043 5370 |  | 
| 5044 | 
            -
                ProfileImage | 
| 5371 | 
            +
                GVL_STRUCT_TYPE(ProfileImage) args = { image, StringValueCStr(name), NULL, 0, exception };
         | 
| 5372 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 5045 5373 | 
             
                CHECK_EXCEPTION();
         | 
| 5046 5374 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5047 5375 | 
             
            #else
         | 
| 5048 | 
            -
                ProfileImage | 
| 5376 | 
            +
                GVL_STRUCT_TYPE(ProfileImage) args = { image, StringValueCStr(name), NULL, 0, MagickTrue };
         | 
| 5377 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ProfileImage), &args);
         | 
| 5049 5378 | 
             
            #endif
         | 
| 5050 5379 | 
             
                return self;
         | 
| 5051 5380 | 
             
            }
         | 
| @@ -5063,13 +5392,14 @@ VALUE | |
| 5063 5392 | 
             
            Image_depth(VALUE self)
         | 
| 5064 5393 | 
             
            {
         | 
| 5065 5394 | 
             
                Image *image;
         | 
| 5066 | 
            -
                 | 
| 5395 | 
            +
                size_t depth = 0;
         | 
| 5067 5396 | 
             
                ExceptionInfo *exception;
         | 
| 5068 5397 |  | 
| 5069 5398 | 
             
                image = rm_check_destroyed(self);
         | 
| 5070 5399 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5071 5400 |  | 
| 5072 | 
            -
                 | 
| 5401 | 
            +
                GVL_STRUCT_TYPE(GetImageDepth) args = { image, exception };
         | 
| 5402 | 
            +
                depth = (size_t)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageDepth), &args);
         | 
| 5073 5403 | 
             
                CHECK_EXCEPTION();
         | 
| 5074 5404 |  | 
| 5075 5405 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -5116,7 +5446,8 @@ Image_deskew(int argc, VALUE *argv, VALUE self) | |
| 5116 5446 | 
             
                }
         | 
| 5117 5447 |  | 
| 5118 5448 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5119 | 
            -
                 | 
| 5449 | 
            +
                GVL_STRUCT_TYPE(DeskewImage) args = { image, threshold, exception };
         | 
| 5450 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DeskewImage), &args);
         | 
| 5120 5451 | 
             
                CHECK_EXCEPTION();
         | 
| 5121 5452 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5122 5453 |  | 
| @@ -5138,7 +5469,8 @@ Image_despeckle(VALUE self) | |
| 5138 5469 | 
             
                image = rm_check_destroyed(self);
         | 
| 5139 5470 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5140 5471 |  | 
| 5141 | 
            -
                 | 
| 5472 | 
            +
                GVL_STRUCT_TYPE(DespeckleImage) args = { image, exception };
         | 
| 5473 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DespeckleImage), &args);
         | 
| 5142 5474 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 5143 5475 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5144 5476 |  | 
| @@ -5157,7 +5489,7 @@ Image_destroy_bang(VALUE self) | |
| 5157 5489 | 
             
                Image *image;
         | 
| 5158 5490 |  | 
| 5159 5491 | 
             
                rb_check_frozen(self);
         | 
| 5160 | 
            -
                 | 
| 5492 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 5161 5493 | 
             
                rm_image_destroy(image);
         | 
| 5162 5494 | 
             
                DATA_PTR(self) = NULL;
         | 
| 5163 5495 | 
             
                return self;
         | 
| @@ -5174,7 +5506,7 @@ Image_destroyed_q(VALUE self) | |
| 5174 5506 | 
             
            {
         | 
| 5175 5507 | 
             
                Image *image;
         | 
| 5176 5508 |  | 
| 5177 | 
            -
                 | 
| 5509 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 5178 5510 | 
             
                return image ? Qfalse : Qtrue;
         | 
| 5179 5511 | 
             
            }
         | 
| 5180 5512 |  | 
| @@ -5213,11 +5545,13 @@ Image_difference(VALUE self, VALUE other) | |
| 5213 5545 |  | 
| 5214 5546 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 5215 5547 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5216 | 
            -
                GetImageDistortion | 
| 5548 | 
            +
                GVL_STRUCT_TYPE(GetImageDistortion) args = { image, image2, MeanErrorPerPixelErrorMetric, &distortion, exception };
         | 
| 5549 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageDistortion), &args);
         | 
| 5217 5550 | 
             
                CHECK_EXCEPTION();
         | 
| 5218 5551 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5219 5552 | 
             
            #else
         | 
| 5220 | 
            -
                IsImagesEqual | 
| 5553 | 
            +
                GVL_STRUCT_TYPE(IsImagesEqual) args = { image, image2 };
         | 
| 5554 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(IsImagesEqual), &args);
         | 
| 5221 5555 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 5222 5556 | 
             
            #endif
         | 
| 5223 5557 |  | 
| @@ -5241,7 +5575,7 @@ Image_difference(VALUE self, VALUE other) | |
| 5241 5575 | 
             
            VALUE
         | 
| 5242 5576 | 
             
            Image_directory(VALUE self)
         | 
| 5243 5577 | 
             
            {
         | 
| 5244 | 
            -
                 | 
| 5578 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, directory, str, &rm_image_data_type);
         | 
| 5245 5579 | 
             
            }
         | 
| 5246 5580 |  | 
| 5247 5581 |  | 
| @@ -5366,10 +5700,11 @@ Image_dispatch(int argc, VALUE *argv, VALUE self) | |
| 5366 5700 | 
             
                // Create the Ruby array for the pixels. Return this even if ExportImagePixels fails.
         | 
| 5367 5701 | 
             
                pixels_ary = rb_ary_new();
         | 
| 5368 5702 |  | 
| 5369 | 
            -
                 | 
| 5703 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 5370 5704 |  | 
| 5371 5705 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5372 | 
            -
                 | 
| 5706 | 
            +
                GVL_STRUCT_TYPE(ExportImagePixels) args = { image, x, y, columns, rows, map, stg_type, (void *)pixels.v, exception };
         | 
| 5707 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExportImagePixels), &args);
         | 
| 5373 5708 |  | 
| 5374 5709 | 
             
                if (!okay)
         | 
| 5375 5710 | 
             
                {
         | 
| @@ -5428,7 +5763,7 @@ Image_display(VALUE self) | |
| 5428 5763 | 
             
                }
         | 
| 5429 5764 |  | 
| 5430 5765 | 
             
                info_obj = rm_info_new();
         | 
| 5431 | 
            -
                 | 
| 5766 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 5432 5767 |  | 
| 5433 5768 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 5434 5769 | 
             
                exception = AcquireExceptionInfo();
         | 
| @@ -5631,7 +5966,8 @@ Image_distort(int argc, VALUE *argv, VALUE self) | |
| 5631 5966 | 
             
                }
         | 
| 5632 5967 |  | 
| 5633 5968 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5634 | 
            -
                 | 
| 5969 | 
            +
                GVL_STRUCT_TYPE(DistortImage) args = { image, distortion_method, npoints, points, bestfit, exception };
         | 
| 5970 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DistortImage), &args);
         | 
| 5635 5971 | 
             
                xfree(points);
         | 
| 5636 5972 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 5637 5973 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -5690,11 +6026,13 @@ Image_distortion_channel(int argc, VALUE *argv, VALUE self) | |
| 5690 6026 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5691 6027 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 5692 6028 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 5693 | 
            -
                 | 
| 6029 | 
            +
                GVL_STRUCT_TYPE(CompareImages) args = { image, reconstruct, metric, &distortion, exception };
         | 
| 6030 | 
            +
                difference_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImages), &args);
         | 
| 5694 6031 | 
             
                END_CHANNEL_MASK(image);
         | 
| 5695 6032 | 
             
                DestroyImage(difference_image);
         | 
| 5696 6033 | 
             
            #else
         | 
| 5697 | 
            -
                GetImageChannelDistortion | 
| 6034 | 
            +
                GVL_STRUCT_TYPE(GetImageChannelDistortion) args = { image, reconstruct, channels, metric, &distortion, exception };
         | 
| 6035 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageChannelDistortion), &args);
         | 
| 5698 6036 | 
             
            #endif
         | 
| 5699 6037 |  | 
| 5700 6038 | 
             
                CHECK_EXCEPTION();
         | 
| @@ -5734,7 +6072,8 @@ Image__dump(VALUE self, VALUE depth ATTRIBUTE_UNUSED) | |
| 5734 6072 | 
             
                strlcpy(info->magick, image->magick, sizeof(info->magick));
         | 
| 5735 6073 |  | 
| 5736 6074 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5737 | 
            -
                 | 
| 6075 | 
            +
                GVL_STRUCT_TYPE(ImageToBlob) args = { info, image, &length, exception };
         | 
| 6076 | 
            +
                blob = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImageToBlob), &args);
         | 
| 5738 6077 |  | 
| 5739 6078 | 
             
                // Free ImageInfo first - error handling may raise an exception
         | 
| 5740 6079 | 
             
                DestroyImageInfo(info);
         | 
| @@ -5780,7 +6119,7 @@ Image_dup(VALUE self) | |
| 5780 6119 | 
             
                VALUE dup;
         | 
| 5781 6120 |  | 
| 5782 6121 | 
             
                rm_check_destroyed(self);
         | 
| 5783 | 
            -
                dup =  | 
| 6122 | 
            +
                dup = TypedData_Wrap_Struct(CLASS_OF(self), &rm_image_data_type, NULL);
         | 
| 5784 6123 | 
             
                RB_GC_GUARD(dup);
         | 
| 5785 6124 |  | 
| 5786 6125 | 
             
                return rb_funcall(dup, rm_ID_initialize_copy, 1, self);
         | 
| @@ -5862,7 +6201,8 @@ Image_edge(int argc, VALUE *argv, VALUE self) | |
| 5862 6201 |  | 
| 5863 6202 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5864 6203 |  | 
| 5865 | 
            -
                 | 
| 6204 | 
            +
                GVL_STRUCT_TYPE(EdgeImage) args = { image, radius, exception };
         | 
| 6205 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EdgeImage), &args);
         | 
| 5866 6206 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 5867 6207 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5868 6208 |  | 
| @@ -5870,6 +6210,9 @@ Image_edge(int argc, VALUE *argv, VALUE self) | |
| 5870 6210 | 
             
            }
         | 
| 5871 6211 |  | 
| 5872 6212 |  | 
| 6213 | 
            +
            // aliases for common use of structure types; BlurImage, CharcoalImage, EmbossImage, GaussianBlurImage, SharpenImage
         | 
| 6214 | 
            +
            typedef GVL_STRUCT_TYPE(BlurImage) GVL_STRUCT_TYPE(effect_image);
         | 
| 6215 | 
            +
             | 
| 5873 6216 | 
             
            /**
         | 
| 5874 6217 | 
             
             * Call one of the effects methods.
         | 
| 5875 6218 | 
             
             *
         | 
| @@ -5882,7 +6225,7 @@ Image_edge(int argc, VALUE *argv, VALUE self) | |
| 5882 6225 | 
             
             * @return a new image
         | 
| 5883 6226 | 
             
             */
         | 
| 5884 6227 | 
             
            static VALUE
         | 
| 5885 | 
            -
            effect_image(VALUE self, int argc, VALUE *argv,  | 
| 6228 | 
            +
            effect_image(VALUE self, int argc, VALUE *argv, gvl_function_t fp)
         | 
| 5886 6229 | 
             
            {
         | 
| 5887 6230 | 
             
                Image *image, *new_image;
         | 
| 5888 6231 | 
             
                ExceptionInfo *exception;
         | 
| @@ -5909,7 +6252,8 @@ effect_image(VALUE self, int argc, VALUE *argv, effector_t effector) | |
| 5909 6252 | 
             
                }
         | 
| 5910 6253 |  | 
| 5911 6254 | 
             
                exception = AcquireExceptionInfo();
         | 
| 5912 | 
            -
                 | 
| 6255 | 
            +
                GVL_STRUCT_TYPE(effect_image) args = { image, radius, sigma, exception };
         | 
| 6256 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 5913 6257 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 5914 6258 | 
             
                DestroyExceptionInfo(exception);
         | 
| 5915 6259 |  | 
| @@ -5928,7 +6272,7 @@ effect_image(VALUE self, int argc, VALUE *argv, effector_t effector) | |
| 5928 6272 | 
             
            VALUE
         | 
| 5929 6273 | 
             
            Image_emboss(int argc, VALUE *argv, VALUE self)
         | 
| 5930 6274 | 
             
            {
         | 
| 5931 | 
            -
                return effect_image(self, argc, argv, EmbossImage);
         | 
| 6275 | 
            +
                return effect_image(self, argc, argv, GVL_FUNC(EmbossImage));
         | 
| 5932 6276 | 
             
            }
         | 
| 5933 6277 |  | 
| 5934 6278 |  | 
| @@ -5954,7 +6298,8 @@ Image_encipher(VALUE self, VALUE passphrase) | |
| 5954 6298 |  | 
| 5955 6299 | 
             
                new_image = rm_clone_image(image);
         | 
| 5956 6300 |  | 
| 5957 | 
            -
                 | 
| 6301 | 
            +
                GVL_STRUCT_TYPE(EncipherImage) args = { new_image, pf, exception };
         | 
| 6302 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EncipherImage), &args);
         | 
| 5958 6303 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 5959 6304 | 
             
                if (!okay)
         | 
| 5960 6305 | 
             
                {
         | 
| @@ -6010,7 +6355,8 @@ Image_enhance(VALUE self) | |
| 6010 6355 | 
             
                image = rm_check_destroyed(self);
         | 
| 6011 6356 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6012 6357 |  | 
| 6013 | 
            -
                 | 
| 6358 | 
            +
                GVL_STRUCT_TYPE(EnhanceImage) args = { image, exception };
         | 
| 6359 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EnhanceImage), &args);
         | 
| 6014 6360 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6015 6361 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6016 6362 |  | 
| @@ -6036,11 +6382,13 @@ Image_equalize(VALUE self) | |
| 6036 6382 |  | 
| 6037 6383 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 6038 6384 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6039 | 
            -
                EqualizeImage | 
| 6385 | 
            +
                GVL_STRUCT_TYPE(EqualizeImage) args = { new_image, exception };
         | 
| 6386 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EqualizeImage), &args);
         | 
| 6040 6387 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6041 6388 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6042 6389 | 
             
            #else
         | 
| 6043 | 
            -
                EqualizeImage | 
| 6390 | 
            +
                GVL_STRUCT_TYPE(EqualizeImage) args = { new_image };
         | 
| 6391 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EqualizeImage), &args);
         | 
| 6044 6392 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 6045 6393 | 
             
            #endif
         | 
| 6046 6394 |  | 
| @@ -6080,12 +6428,14 @@ Image_equalize_channel(int argc, VALUE *argv, VALUE self) | |
| 6080 6428 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 6081 6429 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6082 6430 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 6083 | 
            -
                EqualizeImage | 
| 6431 | 
            +
                GVL_STRUCT_TYPE(EqualizeImage) args = { new_image, exception };
         | 
| 6432 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EqualizeImage), &args);
         | 
| 6084 6433 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 6085 6434 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6086 6435 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6087 6436 | 
             
            #else
         | 
| 6088 | 
            -
                EqualizeImageChannel | 
| 6437 | 
            +
                GVL_STRUCT_TYPE(EqualizeImageChannel) args = { new_image, channels };
         | 
| 6438 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EqualizeImageChannel), &args);
         | 
| 6089 6439 |  | 
| 6090 6440 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 6091 6441 | 
             
            #endif
         | 
| @@ -6111,11 +6461,13 @@ Image_erase_bang(VALUE self) | |
| 6111 6461 |  | 
| 6112 6462 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 6113 6463 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6114 | 
            -
                SetImageBackgroundColor | 
| 6464 | 
            +
                GVL_STRUCT_TYPE(SetImageBackgroundColor) args = { image, exception };
         | 
| 6465 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageBackgroundColor), &args);
         | 
| 6115 6466 | 
             
                CHECK_EXCEPTION();
         | 
| 6116 6467 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6117 6468 | 
             
            #else
         | 
| 6118 | 
            -
                SetImageBackgroundColor | 
| 6469 | 
            +
                GVL_STRUCT_TYPE(SetImageBackgroundColor) args = { image };
         | 
| 6470 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageBackgroundColor), &args);
         | 
| 6119 6471 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 6120 6472 | 
             
            #endif
         | 
| 6121 6473 |  | 
| @@ -6157,10 +6509,11 @@ excerpt(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) | |
| 6157 6509 | 
             
                rect.width = NUM2ULONG(width);
         | 
| 6158 6510 | 
             
                rect.height = NUM2ULONG(height);
         | 
| 6159 6511 |  | 
| 6160 | 
            -
                 | 
| 6512 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 6161 6513 |  | 
| 6162 6514 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6163 | 
            -
                 | 
| 6515 | 
            +
                GVL_STRUCT_TYPE(ExcerptImage) args = { image, &rect, exception };
         | 
| 6516 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExcerptImage), &args);
         | 
| 6164 6517 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6165 6518 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6166 6519 |  | 
| @@ -6248,7 +6601,7 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self) | |
| 6248 6601 | 
             
                long x_off = 0L, y_off = 0L;
         | 
| 6249 6602 | 
             
                unsigned long cols, rows;
         | 
| 6250 6603 | 
             
                long n, npixels;
         | 
| 6251 | 
            -
                 | 
| 6604 | 
            +
                MagickBooleanType okay;
         | 
| 6252 6605 | 
             
                const char *map = "RGB";
         | 
| 6253 6606 | 
             
                Quantum *pixels;
         | 
| 6254 6607 | 
             
                VALUE ary;
         | 
| @@ -6295,7 +6648,8 @@ Image_export_pixels(int argc, VALUE *argv, VALUE self) | |
| 6295 6648 |  | 
| 6296 6649 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6297 6650 |  | 
| 6298 | 
            -
                 | 
| 6651 | 
            +
                GVL_STRUCT_TYPE(ExportImagePixels) args = { image, x_off, y_off, cols, rows, map, QuantumPixel, (void *)pixels, exception };
         | 
| 6652 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExportImagePixels), &args);
         | 
| 6299 6653 | 
             
                if (!okay)
         | 
| 6300 6654 | 
             
                {
         | 
| 6301 6655 | 
             
                    xfree((void *)pixels);
         | 
| @@ -6377,10 +6731,11 @@ Image_extent(int argc, VALUE *argv, VALUE self) | |
| 6377 6731 | 
             
                }
         | 
| 6378 6732 |  | 
| 6379 6733 |  | 
| 6380 | 
            -
                 | 
| 6734 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 6381 6735 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6382 6736 |  | 
| 6383 | 
            -
                 | 
| 6737 | 
            +
                GVL_STRUCT_TYPE(ExtentImage) args = { image, &geometry, exception };
         | 
| 6738 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExtentImage), &args);
         | 
| 6384 6739 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6385 6740 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6386 6741 |  | 
| @@ -6412,7 +6767,7 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self) | |
| 6412 6767 | 
             
                unsigned long cols, rows;
         | 
| 6413 6768 | 
             
                unsigned long npixels;
         | 
| 6414 6769 | 
             
                size_t sz;
         | 
| 6415 | 
            -
                 | 
| 6770 | 
            +
                MagickBooleanType okay;
         | 
| 6416 6771 | 
             
                const char *map = "RGB";
         | 
| 6417 6772 | 
             
                StorageType type = CharPixel;
         | 
| 6418 6773 | 
             
                VALUE string;
         | 
| @@ -6485,7 +6840,8 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self) | |
| 6485 6840 |  | 
| 6486 6841 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6487 6842 |  | 
| 6488 | 
            -
                 | 
| 6843 | 
            +
                GVL_STRUCT_TYPE(ExportImagePixels) args = { image, x_off, y_off, cols, rows, map, type, (void *)RSTRING_PTR(string), exception };
         | 
| 6844 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ExportImagePixels), &args);
         | 
| 6489 6845 | 
             
                if (!okay)
         | 
| 6490 6846 | 
             
                {
         | 
| 6491 6847 | 
             
                    // Let GC have the string buffer.
         | 
| @@ -6540,7 +6896,7 @@ Image_extract_info_eq(VALUE self, VALUE rect) | |
| 6540 6896 | 
             
            VALUE
         | 
| 6541 6897 | 
             
            Image_filename(VALUE self)
         | 
| 6542 6898 | 
             
            {
         | 
| 6543 | 
            -
                 | 
| 6899 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, filename, str, &rm_image_data_type);
         | 
| 6544 6900 | 
             
            }
         | 
| 6545 6901 |  | 
| 6546 6902 |  | 
| @@ -6607,7 +6963,7 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self) | |
| 6607 6963 | 
             
                VALUE region, targ;
         | 
| 6608 6964 | 
             
                ssize_t x = 0L, y = 0L;
         | 
| 6609 6965 | 
             
                ExceptionInfo *exception;
         | 
| 6610 | 
            -
                 | 
| 6966 | 
            +
                MagickBooleanType okay;
         | 
| 6611 6967 |  | 
| 6612 6968 | 
             
                image = rm_check_destroyed(self);
         | 
| 6613 6969 |  | 
| @@ -6627,7 +6983,13 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self) | |
| 6627 6983 | 
             
                }
         | 
| 6628 6984 |  | 
| 6629 6985 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6630 | 
            -
             | 
| 6986 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 6987 | 
            +
                GVL_STRUCT_TYPE(IsEquivalentImage) args = { image, target, &x, &y, exception };
         | 
| 6988 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(IsEquivalentImage), &args);
         | 
| 6989 | 
            +
            #else
         | 
| 6990 | 
            +
                GVL_STRUCT_TYPE(IsImageSimilar) args = { image, target, &x, &y, exception };
         | 
| 6991 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(IsImageSimilar), &args);
         | 
| 6992 | 
            +
            #endif
         | 
| 6631 6993 | 
             
                CHECK_EXCEPTION();
         | 
| 6632 6994 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6633 6995 |  | 
| @@ -6647,6 +7009,9 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self) | |
| 6647 7009 | 
             
            }
         | 
| 6648 7010 |  | 
| 6649 7011 |  | 
| 7012 | 
            +
            // aliases for common use of structure types; FlopImage, FlipImage
         | 
| 7013 | 
            +
            typedef GVL_STRUCT_TYPE(FlipImage) GVL_STRUCT_TYPE(flipflop);
         | 
| 7014 | 
            +
             | 
| 6650 7015 | 
             
            /**
         | 
| 6651 7016 | 
             
             * Call a flipflopper (a function that either flips or flops the image).
         | 
| 6652 7017 | 
             
             *
         | 
| @@ -6662,15 +7027,16 @@ Image_find_similar_region(int argc, VALUE *argv, VALUE self) | |
| 6662 7027 | 
             
             * @see Image_flop_bang
         | 
| 6663 7028 | 
             
             */
         | 
| 6664 7029 | 
             
            static VALUE
         | 
| 6665 | 
            -
            flipflop(int bang, VALUE self,  | 
| 7030 | 
            +
            flipflop(int bang, VALUE self, gvl_function_t fp)
         | 
| 6666 7031 | 
             
            {
         | 
| 6667 7032 | 
             
                Image *image, *new_image;
         | 
| 6668 7033 | 
             
                ExceptionInfo *exception;
         | 
| 6669 7034 |  | 
| 6670 | 
            -
                 | 
| 7035 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 6671 7036 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6672 7037 |  | 
| 6673 | 
            -
                 | 
| 7038 | 
            +
                GVL_STRUCT_TYPE(flipflop) args = { image, exception };
         | 
| 7039 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 6674 7040 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6675 7041 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6676 7042 |  | 
| @@ -6698,7 +7064,7 @@ VALUE | |
| 6698 7064 | 
             
            Image_flip(VALUE self)
         | 
| 6699 7065 | 
             
            {
         | 
| 6700 7066 | 
             
                rm_check_destroyed(self);
         | 
| 6701 | 
            -
                return flipflop(False, self, FlipImage);
         | 
| 7067 | 
            +
                return flipflop(False, self, GVL_FUNC(FlipImage));
         | 
| 6702 7068 | 
             
            }
         | 
| 6703 7069 |  | 
| 6704 7070 |  | 
| @@ -6715,7 +7081,7 @@ VALUE | |
| 6715 7081 | 
             
            Image_flip_bang(VALUE self)
         | 
| 6716 7082 | 
             
            {
         | 
| 6717 7083 | 
             
                rm_check_frozen(self);
         | 
| 6718 | 
            -
                return flipflop(True, self, FlipImage);
         | 
| 7084 | 
            +
                return flipflop(True, self, GVL_FUNC(FlipImage));
         | 
| 6719 7085 | 
             
            }
         | 
| 6720 7086 |  | 
| 6721 7087 |  | 
| @@ -6731,7 +7097,7 @@ VALUE | |
| 6731 7097 | 
             
            Image_flop(VALUE self)
         | 
| 6732 7098 | 
             
            {
         | 
| 6733 7099 | 
             
                rm_check_destroyed(self);
         | 
| 6734 | 
            -
                return flipflop(False, self, FlopImage);
         | 
| 7100 | 
            +
                return flipflop(False, self, GVL_FUNC(FlopImage));
         | 
| 6735 7101 | 
             
            }
         | 
| 6736 7102 |  | 
| 6737 7103 |  | 
| @@ -6748,7 +7114,7 @@ VALUE | |
| 6748 7114 | 
             
            Image_flop_bang(VALUE self)
         | 
| 6749 7115 | 
             
            {
         | 
| 6750 7116 | 
             
                rm_check_frozen(self);
         | 
| 6751 | 
            -
                return flipflop(True, self, FlopImage);
         | 
| 7117 | 
            +
                return flipflop(True, self, GVL_FUNC(FlopImage));
         | 
| 6752 7118 | 
             
            }
         | 
| 6753 7119 |  | 
| 6754 7120 |  | 
| @@ -6868,10 +7234,11 @@ Image_frame(int argc, VALUE *argv, VALUE self) | |
| 6868 7234 |  | 
| 6869 7235 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6870 7236 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 6871 | 
            -
                 | 
| 7237 | 
            +
                GVL_STRUCT_TYPE(FrameImage) args = { image, &frame_info, image->compose, exception };
         | 
| 6872 7238 | 
             
            #else
         | 
| 6873 | 
            -
                 | 
| 7239 | 
            +
                GVL_STRUCT_TYPE(FrameImage) args = { image, &frame_info, exception };
         | 
| 6874 7240 | 
             
            #endif
         | 
| 7241 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FrameImage), &args);
         | 
| 6875 7242 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 6876 7243 | 
             
                DestroyExceptionInfo(exception);
         | 
| 6877 7244 |  | 
| @@ -6907,10 +7274,11 @@ Image_from_blob(VALUE class ATTRIBUTE_UNUSED, VALUE blob_arg) | |
| 6907 7274 |  | 
| 6908 7275 | 
             
                // Get a new Info object - run the parm block if supplied
         | 
| 6909 7276 | 
             
                info_obj = rm_info_new();
         | 
| 6910 | 
            -
                 | 
| 7277 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 6911 7278 |  | 
| 6912 7279 | 
             
                exception = AcquireExceptionInfo();
         | 
| 6913 | 
            -
                 | 
| 7280 | 
            +
                GVL_STRUCT_TYPE(BlobToImage) args = { info,  blob, (size_t)length, exception };
         | 
| 7281 | 
            +
                images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlobToImage), &args);
         | 
| 6914 7282 | 
             
                rm_check_exception(exception, images, DestroyOnError);
         | 
| 6915 7283 |  | 
| 6916 7284 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -7010,10 +7378,12 @@ Image_function_channel(int argc, VALUE *argv, VALUE self) | |
| 7010 7378 | 
             
                new_image = rm_clone_image(image);
         | 
| 7011 7379 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7012 7380 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 7013 | 
            -
                FunctionImage | 
| 7381 | 
            +
                GVL_STRUCT_TYPE(FunctionImage) args = { new_image, function, nparms, parms, exception };
         | 
| 7382 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FunctionImage), &args);
         | 
| 7014 7383 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 7015 7384 | 
             
            #else
         | 
| 7016 | 
            -
                FunctionImageChannel | 
| 7385 | 
            +
                GVL_STRUCT_TYPE(FunctionImageChannel) args = { new_image, channels, function, nparms, parms, exception };
         | 
| 7386 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FunctionImageChannel), &args);
         | 
| 7017 7387 | 
             
            #endif
         | 
| 7018 7388 | 
             
                xfree(parms);
         | 
| 7019 7389 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| @@ -7034,7 +7404,7 @@ Image_function_channel(int argc, VALUE *argv, VALUE self) | |
| 7034 7404 | 
             
            VALUE
         | 
| 7035 7405 | 
             
            Image_fuzz(VALUE self)
         | 
| 7036 7406 | 
             
            {
         | 
| 7037 | 
            -
                 | 
| 7407 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, fuzz, dbl, &rm_image_data_type);
         | 
| 7038 7408 | 
             
            }
         | 
| 7039 7409 |  | 
| 7040 7410 |  | 
| @@ -7094,11 +7464,13 @@ Image_fx(int argc, VALUE *argv, VALUE self) | |
| 7094 7464 | 
             
                exception = AcquireExceptionInfo();
         | 
| 7095 7465 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7096 7466 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 7097 | 
            -
                 | 
| 7467 | 
            +
                GVL_STRUCT_TYPE(FxImage) args = { image, expression, exception };
         | 
| 7468 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FxImage), &args);
         | 
| 7098 7469 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 7099 7470 | 
             
                END_CHANNEL_MASK(image);
         | 
| 7100 7471 | 
             
            #else
         | 
| 7101 | 
            -
                 | 
| 7472 | 
            +
                GVL_STRUCT_TYPE(FxImageChannel) args = { image, channels, expression, exception };
         | 
| 7473 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FxImageChannel), &args);
         | 
| 7102 7474 | 
             
            #endif
         | 
| 7103 7475 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 7104 7476 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -7114,7 +7486,7 @@ Image_fx(int argc, VALUE *argv, VALUE self) | |
| 7114 7486 | 
             
            VALUE
         | 
| 7115 7487 | 
             
            Image_gamma(VALUE self)
         | 
| 7116 7488 | 
             
            {
         | 
| 7117 | 
            -
                 | 
| 7489 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, gamma, dbl, &rm_image_data_type);
         | 
| 7118 7490 | 
             
            }
         | 
| 7119 7491 |  | 
| 7120 7492 | 
             
            /**
         | 
| @@ -7126,7 +7498,7 @@ Image_gamma(VALUE self) | |
| 7126 7498 | 
             
            VALUE
         | 
| 7127 7499 | 
             
            Image_gamma_eq(VALUE self, VALUE val)
         | 
| 7128 7500 | 
             
            {
         | 
| 7129 | 
            -
                 | 
| 7501 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, gamma, dbl, &rm_image_data_type);
         | 
| 7130 7502 | 
             
            }
         | 
| 7131 7503 |  | 
| 7132 7504 |  | 
| @@ -7174,12 +7546,14 @@ Image_gamma_channel(int argc, VALUE *argv, VALUE self) | |
| 7174 7546 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7175 7547 | 
             
                exception = AcquireExceptionInfo();
         | 
| 7176 7548 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 7177 | 
            -
                GammaImage | 
| 7549 | 
            +
                GVL_STRUCT_TYPE(GammaImage) args = { new_image, gamma, exception };
         | 
| 7550 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImage), &args);
         | 
| 7178 7551 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 7179 7552 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 7180 7553 | 
             
                DestroyExceptionInfo(exception);
         | 
| 7181 7554 | 
             
            #else
         | 
| 7182 | 
            -
                GammaImageChannel | 
| 7555 | 
            +
                GVL_STRUCT_TYPE(GammaImageChannel) args = { new_image, channels, gamma };
         | 
| 7556 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImageChannel), &args);
         | 
| 7183 7557 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 7184 7558 | 
             
            #endif
         | 
| 7185 7559 |  | 
| @@ -7235,30 +7609,40 @@ Image_gamma_correct(int argc, VALUE *argv, VALUE self) | |
| 7235 7609 | 
             
                {
         | 
| 7236 7610 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7237 7611 | 
             
                    BEGIN_CHANNEL_MASK(new_image, (ChannelType) (RedChannel | GreenChannel | BlueChannel));
         | 
| 7238 | 
            -
                    GammaImage | 
| 7612 | 
            +
                    GVL_STRUCT_TYPE(GammaImage) args = { new_image, red_gamma, exception };
         | 
| 7613 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImage), &args);
         | 
| 7239 7614 | 
             
                    END_CHANNEL_MASK(new_image);
         | 
| 7240 7615 | 
             
            #else
         | 
| 7241 | 
            -
                    GammaImageChannel | 
| 7616 | 
            +
                    GVL_STRUCT_TYPE(GammaImageChannel) args = { new_image, (ChannelType) (RedChannel | GreenChannel | BlueChannel), red_gamma };
         | 
| 7617 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImageChannel), &args);
         | 
| 7242 7618 | 
             
            #endif
         | 
| 7243 7619 | 
             
                }
         | 
| 7244 7620 | 
             
                else
         | 
| 7245 7621 | 
             
                {
         | 
| 7246 7622 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7247 7623 | 
             
                    BEGIN_CHANNEL_MASK(new_image, RedChannel);
         | 
| 7248 | 
            -
                    GammaImage | 
| 7624 | 
            +
                    GVL_STRUCT_TYPE(GammaImage) args1 = { new_image, red_gamma, exception };
         | 
| 7625 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImage), &args1);
         | 
| 7249 7626 | 
             
                    END_CHANNEL_MASK(new_image);
         | 
| 7250 7627 |  | 
| 7251 7628 | 
             
                    BEGIN_CHANNEL_MASK(new_image, GreenChannel);
         | 
| 7252 | 
            -
                    GammaImage | 
| 7629 | 
            +
                    GVL_STRUCT_TYPE(GammaImage) args2 = { new_image, green_gamma, exception };
         | 
| 7630 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImage), &args2);
         | 
| 7253 7631 | 
             
                    END_CHANNEL_MASK(new_image);
         | 
| 7254 7632 |  | 
| 7255 7633 | 
             
                    BEGIN_CHANNEL_MASK(new_image, BlueChannel);
         | 
| 7256 | 
            -
                    GammaImage | 
| 7634 | 
            +
                    GVL_STRUCT_TYPE(GammaImage) args3 = { new_image, blue_gamma, exception };
         | 
| 7635 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImage), &args3);
         | 
| 7257 7636 | 
             
                    END_CHANNEL_MASK(new_image);
         | 
| 7258 7637 | 
             
            #else
         | 
| 7259 | 
            -
                    GammaImageChannel | 
| 7260 | 
            -
                    GammaImageChannel | 
| 7261 | 
            -
             | 
| 7638 | 
            +
                    GVL_STRUCT_TYPE(GammaImageChannel) args1 = { new_image, RedChannel, red_gamma };
         | 
| 7639 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImageChannel), &args1);
         | 
| 7640 | 
            +
             | 
| 7641 | 
            +
                    GVL_STRUCT_TYPE(GammaImageChannel) args2 = { new_image, GreenChannel, green_gamma };
         | 
| 7642 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImageChannel), &args2);
         | 
| 7643 | 
            +
             | 
| 7644 | 
            +
                    GVL_STRUCT_TYPE(GammaImageChannel) args3 = { new_image, BlueChannel, blue_gamma };
         | 
| 7645 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GammaImageChannel), &args3);
         | 
| 7262 7646 | 
             
            #endif
         | 
| 7263 7647 | 
             
                }
         | 
| 7264 7648 |  | 
| @@ -7284,7 +7668,7 @@ Image_gamma_correct(int argc, VALUE *argv, VALUE self) | |
| 7284 7668 | 
             
            VALUE
         | 
| 7285 7669 | 
             
            Image_gaussian_blur(int argc, VALUE *argv, VALUE self)
         | 
| 7286 7670 | 
             
            {
         | 
| 7287 | 
            -
                return effect_image(self, argc, argv, GaussianBlurImage);
         | 
| 7671 | 
            +
                return effect_image(self, argc, argv, GVL_FUNC(GaussianBlurImage));
         | 
| 7288 7672 | 
             
            }
         | 
| 7289 7673 |  | 
| 7290 7674 |  | 
| @@ -7332,12 +7716,14 @@ Image_gaussian_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 7332 7716 | 
             
                exception = AcquireExceptionInfo();
         | 
| 7333 7717 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7334 7718 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 7335 | 
            -
                 | 
| 7719 | 
            +
                GVL_STRUCT_TYPE(GaussianBlurImage) args = { image, radius, sigma, exception };
         | 
| 7720 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GaussianBlurImage), &args);
         | 
| 7336 7721 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 7337 7722 | 
             
                END_CHANNEL_MASK(image);
         | 
| 7338 7723 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 7339 7724 | 
             
            #else
         | 
| 7340 | 
            -
                 | 
| 7725 | 
            +
                GVL_STRUCT_TYPE(GaussianBlurImageChannel) args = { image, channels, radius, sigma, exception };
         | 
| 7726 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GaussianBlurImageChannel), &args);
         | 
| 7341 7727 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 7342 7728 | 
             
            #endif
         | 
| 7343 7729 |  | 
| @@ -7356,7 +7742,7 @@ Image_gaussian_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 7356 7742 | 
             
            VALUE
         | 
| 7357 7743 | 
             
            Image_geometry(VALUE self)
         | 
| 7358 7744 | 
             
            {
         | 
| 7359 | 
            -
                 | 
| 7745 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, geometry, str, &rm_image_data_type);
         | 
| 7360 7746 | 
             
            }
         | 
| 7361 7747 |  | 
| 7362 7748 |  | 
| @@ -7440,7 +7826,8 @@ Image_get_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, VALUE row | |
| 7440 7826 | 
             
                // Cast AcquireImagePixels to get rid of the const qualifier. We're not going
         | 
| 7441 7827 | 
             
                // to change the pixels but I don't want to make "pixels" const.
         | 
| 7442 7828 | 
             
                exception = AcquireExceptionInfo();
         | 
| 7443 | 
            -
                 | 
| 7829 | 
            +
                GVL_STRUCT_TYPE(GetVirtualPixels) args = { image, x, y, columns, rows, exception };
         | 
| 7830 | 
            +
                pixels = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetVirtualPixels), &args);
         | 
| 7444 7831 | 
             
                CHECK_EXCEPTION();
         | 
| 7445 7832 |  | 
| 7446 7833 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -7617,10 +8004,11 @@ Image_implode(int argc, VALUE *argv, VALUE self) | |
| 7617 8004 | 
             
                exception = AcquireExceptionInfo();
         | 
| 7618 8005 |  | 
| 7619 8006 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7620 | 
            -
                 | 
| 8007 | 
            +
                GVL_STRUCT_TYPE(ImplodeImage) args = { image, amount, image->interpolate, exception };
         | 
| 7621 8008 | 
             
            #else
         | 
| 7622 | 
            -
                 | 
| 8009 | 
            +
                GVL_STRUCT_TYPE(ImplodeImage) args = { image, amount, exception };
         | 
| 7623 8010 | 
             
            #endif
         | 
| 8011 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImplodeImage), &args);
         | 
| 7624 8012 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 7625 8013 | 
             
                DestroyExceptionInfo(exception);
         | 
| 7626 8014 |  | 
| @@ -7660,7 +8048,7 @@ Image_import_pixels(int argc, VALUE *argv, VALUE self) | |
| 7660 8048 | 
             
                Quantum *pixels = NULL;
         | 
| 7661 8049 | 
             
                double *fpixels = NULL;
         | 
| 7662 8050 | 
             
                void *buffer;
         | 
| 7663 | 
            -
                 | 
| 8051 | 
            +
                MagickBooleanType okay;
         | 
| 7664 8052 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7665 8053 | 
             
                ExceptionInfo *exception;
         | 
| 7666 8054 | 
             
            #endif
         | 
| @@ -7797,10 +8185,11 @@ Image_import_pixels(int argc, VALUE *argv, VALUE self) | |
| 7797 8185 |  | 
| 7798 8186 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 7799 8187 | 
             
                exception = AcquireExceptionInfo();
         | 
| 7800 | 
            -
                 | 
| 8188 | 
            +
                GVL_STRUCT_TYPE(ImportImagePixels) args = { image, x_off, y_off, cols, rows, map, stg_type, buffer, exception };
         | 
| 7801 8189 | 
             
            #else
         | 
| 7802 | 
            -
                 | 
| 8190 | 
            +
                GVL_STRUCT_TYPE(ImportImagePixels) args = { image, x_off, y_off, cols, rows, map, stg_type, buffer };
         | 
| 7803 8191 | 
             
            #endif
         | 
| 8192 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImportImagePixels), &args);
         | 
| 7804 8193 |  | 
| 7805 8194 | 
             
                // Free pixel array before checking for errors.
         | 
| 7806 8195 | 
             
                if (pixels)
         | 
| @@ -7987,7 +8376,7 @@ Image_inspect(VALUE self) | |
| 7987 8376 | 
             
                Image *image;
         | 
| 7988 8377 | 
             
                char buffer[MaxTextExtent];          // image description buffer
         | 
| 7989 8378 |  | 
| 7990 | 
            -
                 | 
| 8379 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 7991 8380 | 
             
                if (!image)
         | 
| 7992 8381 | 
             
                {
         | 
| 7993 8382 | 
             
                    return rb_str_new2("#<Magick::Image: (destroyed)>");
         | 
| @@ -8080,12 +8469,12 @@ Image_iptc_profile_eq(VALUE self, VALUE profile) | |
| 8080 8469 | 
             
            VALUE
         | 
| 8081 8470 | 
             
            Image_iterations(VALUE self)
         | 
| 8082 8471 | 
             
            {
         | 
| 8083 | 
            -
                 | 
| 8472 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, iterations, int, &rm_image_data_type);
         | 
| 8084 8473 | 
             
            }
         | 
| 8085 8474 | 
             
            VALUE
         | 
| 8086 8475 | 
             
            Image_iterations_eq(VALUE self, VALUE val)
         | 
| 8087 8476 | 
             
            {
         | 
| 8088 | 
            -
                 | 
| 8477 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, iterations, int, &rm_image_data_type);
         | 
| 8089 8478 | 
             
            }
         | 
| 8090 8479 |  | 
| 8091 8480 | 
             
            /**
         | 
| @@ -8136,12 +8525,14 @@ Image_level2(int argc, VALUE *argv, VALUE self) | |
| 8136 8525 |  | 
| 8137 8526 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 8138 8527 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8139 | 
            -
                LevelImage | 
| 8528 | 
            +
                GVL_STRUCT_TYPE(LevelImage) args = { new_image, black_point, white_point, gamma_val, exception };
         | 
| 8529 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelImage), &args);
         | 
| 8140 8530 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8141 8531 | 
             
                DestroyExceptionInfo(exception);
         | 
| 8142 8532 | 
             
            #else
         | 
| 8143 8533 | 
             
                snprintf(level, sizeof(level), "%gx%g+%g", black_point, white_point, gamma_val);
         | 
| 8144 | 
            -
                LevelImage | 
| 8534 | 
            +
                GVL_STRUCT_TYPE(LevelImage) args = { new_image, level };
         | 
| 8535 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelImage), &args);
         | 
| 8145 8536 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 8146 8537 | 
             
            #endif
         | 
| 8147 8538 |  | 
| @@ -8200,12 +8591,14 @@ Image_level_channel(int argc, VALUE *argv, VALUE self) | |
| 8200 8591 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 8201 8592 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8202 8593 | 
             
                BEGIN_CHANNEL_MASK(new_image, channel);
         | 
| 8203 | 
            -
                LevelImage | 
| 8594 | 
            +
                GVL_STRUCT_TYPE(LevelImage) args = { new_image, black_point, white_point, gamma_val, exception };
         | 
| 8595 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelImage), &args);
         | 
| 8204 8596 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 8205 8597 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8206 8598 | 
             
                DestroyExceptionInfo(exception);
         | 
| 8207 8599 | 
             
            #else
         | 
| 8208 | 
            -
                LevelImageChannel | 
| 8600 | 
            +
                GVL_STRUCT_TYPE(LevelImageChannel) args = { new_image, channel, black_point, white_point, gamma_val };
         | 
| 8601 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelImageChannel), &args);
         | 
| 8209 8602 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 8210 8603 | 
             
            #endif
         | 
| 8211 8604 |  | 
| @@ -8281,12 +8674,14 @@ Image_level_colors(int argc, VALUE *argv, VALUE self) | |
| 8281 8674 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 8282 8675 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8283 8676 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 8284 | 
            -
                 | 
| 8677 | 
            +
                GVL_STRUCT_TYPE(LevelImageColors) args = { new_image, &black_color, &white_color, invert, exception };
         | 
| 8678 | 
            +
                status = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelImageColors), &args);
         | 
| 8285 8679 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 8286 8680 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8287 8681 | 
             
                DestroyExceptionInfo(exception);
         | 
| 8288 8682 | 
             
            #else
         | 
| 8289 | 
            -
                 | 
| 8683 | 
            +
                GVL_STRUCT_TYPE(LevelColorsImageChannel) args = { new_image, channels, &black_color, &white_color, invert };
         | 
| 8684 | 
            +
                status = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelColorsImageChannel), &args);
         | 
| 8290 8685 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 8291 8686 | 
             
            #endif
         | 
| 8292 8687 | 
             
                if (!status)
         | 
| @@ -8356,12 +8751,14 @@ Image_levelize_channel(int argc, VALUE *argv, VALUE self) | |
| 8356 8751 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 8357 8752 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8358 8753 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 8359 | 
            -
                 | 
| 8754 | 
            +
                GVL_STRUCT_TYPE(LevelizeImage) args = { new_image, black_point, white_point, gamma, exception };
         | 
| 8755 | 
            +
                status = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelizeImage), &args);
         | 
| 8360 8756 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 8361 8757 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8362 8758 | 
             
                DestroyExceptionInfo(exception);
         | 
| 8363 8759 | 
             
            #else
         | 
| 8364 | 
            -
                 | 
| 8760 | 
            +
                GVL_STRUCT_TYPE(LevelizeImageChannel) args = { new_image, channels, black_point, white_point, gamma };
         | 
| 8761 | 
            +
                status = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LevelizeImageChannel), &args);
         | 
| 8365 8762 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 8366 8763 | 
             
            #endif
         | 
| 8367 8764 |  | 
| @@ -8402,11 +8799,13 @@ Image_linear_stretch(int argc, VALUE *argv, VALUE self) | |
| 8402 8799 |  | 
| 8403 8800 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 8404 8801 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8405 | 
            -
                LinearStretchImage | 
| 8802 | 
            +
                GVL_STRUCT_TYPE(LinearStretchImage) args = { new_image, black_point, white_point, exception };
         | 
| 8803 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LinearStretchImage), &args);
         | 
| 8406 8804 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8407 8805 | 
             
                DestroyExceptionInfo(exception);
         | 
| 8408 8806 | 
             
            #else
         | 
| 8409 | 
            -
                LinearStretchImage | 
| 8807 | 
            +
                GVL_STRUCT_TYPE(LinearStretchImage) args = { new_image, black_point, white_point };
         | 
| 8808 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LinearStretchImage), &args);
         | 
| 8410 8809 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 8411 8810 | 
             
            #endif
         | 
| 8412 8811 |  | 
| @@ -8452,7 +8851,8 @@ Image_liquid_rescale(int argc, VALUE *argv, VALUE self) | |
| 8452 8851 | 
             
                }
         | 
| 8453 8852 |  | 
| 8454 8853 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8455 | 
            -
                 | 
| 8854 | 
            +
                GVL_STRUCT_TYPE(LiquidRescaleImage) args = { image, cols, rows, delta_x, rigidity, exception };
         | 
| 8855 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(LiquidRescaleImage), &args);
         | 
| 8456 8856 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8457 8857 | 
             
                DestroyExceptionInfo(exception);
         | 
| 8458 8858 |  | 
| @@ -8520,7 +8920,8 @@ Image__load(VALUE class ATTRIBUTE_UNUSED, VALUE str) | |
| 8520 8920 |  | 
| 8521 8921 | 
             
                blob += offsetof(DumpedImage, magick) + mi.len;
         | 
| 8522 8922 | 
             
                length -= offsetof(DumpedImage, magick) + mi.len;
         | 
| 8523 | 
            -
                 | 
| 8923 | 
            +
                GVL_STRUCT_TYPE(BlobToImage) args = { info, blob, (size_t)length, exception };
         | 
| 8924 | 
            +
                image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlobToImage), &args);
         | 
| 8524 8925 | 
             
                DestroyImageInfo(info);
         | 
| 8525 8926 |  | 
| 8526 8927 | 
             
                rm_check_exception(exception, image, DestroyOnError);
         | 
| @@ -8530,6 +8931,9 @@ Image__load(VALUE class ATTRIBUTE_UNUSED, VALUE str) | |
| 8530 8931 | 
             
            }
         | 
| 8531 8932 |  | 
| 8532 8933 |  | 
| 8934 | 
            +
            // aliases for common use of structure types; MagnifyImage, MinifyImage
         | 
| 8935 | 
            +
            typedef GVL_STRUCT_TYPE(MagnifyImage) GVL_STRUCT_TYPE(magnify);
         | 
| 8936 | 
            +
             | 
| 8533 8937 | 
             
            /**
         | 
| 8534 8938 | 
             
             * Scale an image proportionally to twice its size.
         | 
| 8535 8939 | 
             
             *
         | 
| @@ -8541,16 +8945,17 @@ Image__load(VALUE class ATTRIBUTE_UNUSED, VALUE str) | |
| 8541 8945 | 
             
             * @return self if bang, otherwise a new image
         | 
| 8542 8946 | 
             
             */
         | 
| 8543 8947 | 
             
            static VALUE
         | 
| 8544 | 
            -
            magnify(int bang, VALUE self,  | 
| 8948 | 
            +
            magnify(int bang, VALUE self, gvl_function_t fp)
         | 
| 8545 8949 | 
             
            {
         | 
| 8546 8950 | 
             
                Image *image;
         | 
| 8547 8951 | 
             
                Image *new_image;
         | 
| 8548 8952 | 
             
                ExceptionInfo *exception;
         | 
| 8549 8953 |  | 
| 8550 | 
            -
                 | 
| 8954 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 8551 8955 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8552 8956 |  | 
| 8553 | 
            -
                 | 
| 8957 | 
            +
                GVL_STRUCT_TYPE(magnify) args = { image, exception };
         | 
| 8958 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 8554 8959 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 8555 8960 |  | 
| 8556 8961 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -8577,7 +8982,7 @@ VALUE | |
| 8577 8982 | 
             
            Image_magnify(VALUE self)
         | 
| 8578 8983 | 
             
            {
         | 
| 8579 8984 | 
             
                rm_check_destroyed(self);
         | 
| 8580 | 
            -
                return magnify(False, self, MagnifyImage);
         | 
| 8985 | 
            +
                return magnify(False, self, GVL_FUNC(MagnifyImage));
         | 
| 8581 8986 | 
             
            }
         | 
| 8582 8987 |  | 
| 8583 8988 |  | 
| @@ -8592,7 +8997,7 @@ VALUE | |
| 8592 8997 | 
             
            Image_magnify_bang(VALUE self)
         | 
| 8593 8998 | 
             
            {
         | 
| 8594 8999 | 
             
                rm_check_frozen(self);
         | 
| 8595 | 
            -
                return magnify(True, self, MagnifyImage);
         | 
| 9000 | 
            +
                return magnify(True, self, GVL_FUNC(MagnifyImage));
         | 
| 8596 9001 | 
             
            }
         | 
| 8597 9002 |  | 
| 8598 9003 |  | 
| @@ -8624,7 +9029,8 @@ Image_marshal_dump(VALUE self) | |
| 8624 9029 | 
             
                rb_ary_store(ary, 0, rb_str_new2(image->filename));
         | 
| 8625 9030 |  | 
| 8626 9031 | 
             
                exception = AcquireExceptionInfo();
         | 
| 8627 | 
            -
                 | 
| 9032 | 
            +
                GVL_STRUCT_TYPE(ImageToBlob) args = { info, image, &length, exception };
         | 
| 9033 | 
            +
                blob = (unsigned char *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImageToBlob), &args);
         | 
| 8628 9034 |  | 
| 8629 9035 | 
             
                // Destroy info before raising an exception
         | 
| 8630 9036 | 
             
                DestroyImageInfo(info);
         | 
| @@ -8669,7 +9075,8 @@ Image_marshal_load(VALUE self, VALUE ary) | |
| 8669 9075 | 
             
                {
         | 
| 8670 9076 | 
             
                    strlcpy(info->filename, RSTRING_PTR(filename), sizeof(info->filename));
         | 
| 8671 9077 | 
             
                }
         | 
| 8672 | 
            -
                 | 
| 9078 | 
            +
                GVL_STRUCT_TYPE(BlobToImage) args = { info, RSTRING_PTR(blob), RSTRING_LEN(blob), exception };
         | 
| 9079 | 
            +
                image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlobToImage), &args);
         | 
| 8673 9080 |  | 
| 8674 9081 | 
             
                // Destroy info before raising an exception
         | 
| 8675 9082 | 
             
                DestroyImageInfo(info);
         | 
| @@ -8702,9 +9109,11 @@ get_image_mask(Image *image) | |
| 8702 9109 |  | 
| 8703 9110 | 
             
                // The returned clip mask is a clone, ours to keep.
         | 
| 8704 9111 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 8705 | 
            -
                 | 
| 9112 | 
            +
                GVL_STRUCT_TYPE(GetImageMask) args = { image, WritePixelMask, exception };
         | 
| 9113 | 
            +
                mask = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageMask), &args);
         | 
| 8706 9114 | 
             
            #else
         | 
| 8707 | 
            -
                 | 
| 9115 | 
            +
                GVL_STRUCT_TYPE(GetImageClipMask) args = { image, exception };
         | 
| 9116 | 
            +
                mask = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetImageClipMask), &args);
         | 
| 8708 9117 | 
             
            #endif
         | 
| 8709 9118 | 
             
                rm_check_exception(exception, mask, DestroyOnError);
         | 
| 8710 9119 |  | 
| @@ -8742,19 +9151,22 @@ set_image_mask(Image *image, VALUE mask) | |
| 8742 9151 | 
             
                    // Resize if necessary
         | 
| 8743 9152 | 
             
                    if (clip_mask->columns != image->columns || clip_mask->rows != image->rows)
         | 
| 8744 9153 | 
             
                    {
         | 
| 8745 | 
            -
                         | 
| 9154 | 
            +
                        GVL_STRUCT_TYPE(ResizeImage) args = { clip_mask, image->columns, image->rows, image->filter, exception };
         | 
| 9155 | 
            +
                        resized_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ResizeImage), &args);
         | 
| 8746 9156 | 
             
                        DestroyImage(clip_mask);
         | 
| 8747 9157 | 
             
                        rm_check_exception(exception, resized_image, DestroyOnError);
         | 
| 8748 9158 | 
             
                        rm_ensure_result(resized_image);
         | 
| 8749 9159 | 
             
                        clip_mask = resized_image;
         | 
| 8750 9160 | 
             
                    }
         | 
| 8751 9161 |  | 
| 8752 | 
            -
                    SetImageMask | 
| 9162 | 
            +
                    GVL_STRUCT_TYPE(SetImageMask) args = { image, WritePixelMask, clip_mask, exception };
         | 
| 9163 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageMask), &args);
         | 
| 8753 9164 | 
             
                    DestroyImage(clip_mask);
         | 
| 8754 9165 | 
             
                }
         | 
| 8755 9166 | 
             
                else
         | 
| 8756 9167 | 
             
                {
         | 
| 8757 | 
            -
                    SetImageMask | 
| 9168 | 
            +
                    GVL_STRUCT_TYPE(SetImageMask) args = { image, WritePixelMask, NULL, exception };
         | 
| 9169 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageMask), &args);
         | 
| 8758 9170 | 
             
                }
         | 
| 8759 9171 | 
             
                CHECK_EXCEPTION();
         | 
| 8760 9172 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -8782,8 +9194,8 @@ set_image_mask(Image *image, VALUE mask) | |
| 8782 9194 | 
             
                    if (clip_mask->columns != image->columns || clip_mask->rows != image->rows)
         | 
| 8783 9195 | 
             
                    {
         | 
| 8784 9196 | 
             
                        exception = AcquireExceptionInfo();
         | 
| 8785 | 
            -
                         | 
| 8786 | 
            -
             | 
| 9197 | 
            +
                        GVL_STRUCT_TYPE(ResizeImage) args = { clip_mask, image->columns, image->rows, UndefinedFilter, 0.0, exception };
         | 
| 9198 | 
            +
                        resized_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ResizeImage), &args);
         | 
| 8787 9199 | 
             
                        rm_check_exception(exception, resized_image, DestroyOnError);
         | 
| 8788 9200 | 
             
                        DestroyExceptionInfo(exception);
         | 
| 8789 9201 | 
             
                        rm_ensure_result(resized_image);
         | 
| @@ -8796,7 +9208,8 @@ set_image_mask(Image *image, VALUE mask) | |
| 8796 9208 |  | 
| 8797 9209 | 
             
                    for (y = 0; y < (long) clip_mask->rows; y++)
         | 
| 8798 9210 | 
             
                    {
         | 
| 8799 | 
            -
                         | 
| 9211 | 
            +
                        GVL_STRUCT_TYPE(GetAuthenticPixels) args_GetAuthenticPixels = { clip_mask, 0, y, clip_mask->columns, 1, exception };
         | 
| 9212 | 
            +
                        q = (PixelPacket *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetAuthenticPixels), &args_GetAuthenticPixels);
         | 
| 8800 9213 | 
             
                        rm_check_exception(exception, clip_mask, DestroyOnError);
         | 
| 8801 9214 |  | 
| 8802 9215 | 
             
                        if (!q)
         | 
| @@ -8815,12 +9228,14 @@ set_image_mask(Image *image, VALUE mask) | |
| 8815 9228 | 
             
                            q += 1;
         | 
| 8816 9229 | 
             
                        }
         | 
| 8817 9230 |  | 
| 8818 | 
            -
                        SyncAuthenticPixels | 
| 9231 | 
            +
                        GVL_STRUCT_TYPE(SyncAuthenticPixels) args_SyncAuthenticPixels = { clip_mask, exception };
         | 
| 9232 | 
            +
                        CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args_SyncAuthenticPixels);
         | 
| 8819 9233 | 
             
                        rm_check_exception(exception, clip_mask, DestroyOnError);
         | 
| 8820 9234 | 
             
                    }
         | 
| 8821 9235 | 
             
                    DestroyExceptionInfo(exception);
         | 
| 8822 9236 |  | 
| 8823 | 
            -
                    SetImageStorageClass | 
| 9237 | 
            +
                    GVL_STRUCT_TYPE(SetImageStorageClass) args_SetImageStorageClass = { clip_mask, DirectClass };
         | 
| 9238 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args_SetImageStorageClass);
         | 
| 8824 9239 | 
             
                    rm_check_image_exception(clip_mask, DestroyOnError);
         | 
| 8825 9240 |  | 
| 8826 9241 | 
             
                    clip_mask->matte = MagickTrue;
         | 
| @@ -8828,12 +9243,14 @@ set_image_mask(Image *image, VALUE mask) | |
| 8828 9243 | 
             
                    // SetImageClipMask clones the clip_mask image. We can
         | 
| 8829 9244 | 
             
                    // destroy our copy after SetImageClipMask is done with it.
         | 
| 8830 9245 |  | 
| 8831 | 
            -
                    SetImageClipMask | 
| 9246 | 
            +
                    GVL_STRUCT_TYPE(SetImageClipMask) args_SetImageClipMask = { image, clip_mask };
         | 
| 9247 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageClipMask), &args_SetImageClipMask);
         | 
| 8832 9248 | 
             
                    DestroyImage(clip_mask);
         | 
| 8833 9249 | 
             
                }
         | 
| 8834 9250 | 
             
                else
         | 
| 8835 9251 | 
             
                {
         | 
| 8836 | 
            -
                    SetImageClipMask | 
| 9252 | 
            +
                    GVL_STRUCT_TYPE(SetImageClipMask) args_SetImageClipMask = { image, NULL };
         | 
| 9253 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageClipMask), &args_SetImageClipMask);
         | 
| 8837 9254 | 
             
                }
         | 
| 8838 9255 |  | 
| 8839 9256 | 
             
                RB_GC_GUARD(mask);
         | 
| @@ -9007,13 +9424,15 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self) | |
| 9007 9424 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9008 9425 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9009 9426 | 
             
                BEGIN_CHANNEL_MASK(new_image, OpacityChannel);
         | 
| 9010 | 
            -
                FloodfillPaintImage | 
| 9427 | 
            +
                GVL_STRUCT_TYPE(FloodfillPaintImage) args = { new_image, draw_info, &target_mpp, x, y, invert, exception };
         | 
| 9428 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FloodfillPaintImage), &args);
         | 
| 9011 9429 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 9012 9430 | 
             
                DestroyDrawInfo(draw_info);
         | 
| 9013 9431 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9014 9432 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9015 9433 | 
             
            #else
         | 
| 9016 | 
            -
                FloodfillPaintImage | 
| 9434 | 
            +
                GVL_STRUCT_TYPE(FloodfillPaintImage) args = { new_image, OpacityChannel, draw_info, &target_mpp, x, y, invert };
         | 
| 9435 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FloodfillPaintImage), &args);
         | 
| 9017 9436 | 
             
                DestroyDrawInfo(draw_info);
         | 
| 9018 9437 |  | 
| 9019 9438 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| @@ -9051,7 +9470,8 @@ Image_median_filter(int argc, VALUE *argv, VALUE self) | |
| 9051 9470 | 
             
                }
         | 
| 9052 9471 |  | 
| 9053 9472 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9054 | 
            -
                 | 
| 9473 | 
            +
                GVL_STRUCT_TYPE(StatisticImage) args = { image, MedianStatistic, (size_t)radius, (size_t)radius, exception };
         | 
| 9474 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(StatisticImage), &args);
         | 
| 9055 9475 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9056 9476 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9057 9477 |  | 
| @@ -9067,7 +9487,7 @@ Image_median_filter(int argc, VALUE *argv, VALUE self) | |
| 9067 9487 | 
             
            VALUE
         | 
| 9068 9488 | 
             
            Image_mean_error_per_pixel(VALUE self)
         | 
| 9069 9489 | 
             
            {
         | 
| 9070 | 
            -
                 | 
| 9490 | 
            +
                IMPLEMENT_TYPED_ATTR_READERF(Image, mean_error_per_pixel, error.mean_error_per_pixel, dbl, &rm_image_data_type);
         | 
| 9071 9491 | 
             
            }
         | 
| 9072 9492 |  | 
| 9073 9493 |  | 
| @@ -9110,7 +9530,7 @@ VALUE | |
| 9110 9530 | 
             
            Image_minify(VALUE self)
         | 
| 9111 9531 | 
             
            {
         | 
| 9112 9532 | 
             
                rm_check_destroyed(self);
         | 
| 9113 | 
            -
                return magnify(False, self, MinifyImage);
         | 
| 9533 | 
            +
                return magnify(False, self, GVL_FUNC(MinifyImage));
         | 
| 9114 9534 | 
             
            }
         | 
| 9115 9535 |  | 
| 9116 9536 |  | 
| @@ -9124,7 +9544,7 @@ VALUE | |
| 9124 9544 | 
             
            Image_minify_bang(VALUE self)
         | 
| 9125 9545 | 
             
            {
         | 
| 9126 9546 | 
             
                rm_check_frozen(self);
         | 
| 9127 | 
            -
                return magnify(True, self, MinifyImage);
         | 
| 9547 | 
            +
                return magnify(True, self, GVL_FUNC(MinifyImage));
         | 
| 9128 9548 | 
             
            }
         | 
| 9129 9549 |  | 
| 9130 9550 |  | 
| @@ -9176,11 +9596,13 @@ Image_modulate(int argc, VALUE *argv, VALUE self) | |
| 9176 9596 |  | 
| 9177 9597 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9178 9598 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9179 | 
            -
                ModulateImage | 
| 9599 | 
            +
                GVL_STRUCT_TYPE(ModulateImage) args = { new_image, modulate, exception };
         | 
| 9600 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ModulateImage), &args);
         | 
| 9180 9601 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9181 9602 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9182 9603 | 
             
            #else
         | 
| 9183 | 
            -
                ModulateImage | 
| 9604 | 
            +
                GVL_STRUCT_TYPE(ModulateImage) args = { new_image, modulate };
         | 
| 9605 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ModulateImage), &args);
         | 
| 9184 9606 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 9185 9607 | 
             
            #endif
         | 
| 9186 9608 |  | 
| @@ -9213,10 +9635,13 @@ Image_monochrome_q(VALUE self) | |
| 9213 9635 | 
             
            VALUE
         | 
| 9214 9636 | 
             
            Image_montage(VALUE self)
         | 
| 9215 9637 | 
             
            {
         | 
| 9216 | 
            -
                 | 
| 9638 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, montage, str, &rm_image_data_type);
         | 
| 9217 9639 | 
             
            }
         | 
| 9218 9640 |  | 
| 9219 9641 |  | 
| 9642 | 
            +
            // aliases for common use of structure types; MotionBlurImage, SketchImage
         | 
| 9643 | 
            +
            typedef GVL_STRUCT_TYPE(MotionBlurImage) GVL_STRUCT_TYPE(motion_blur);
         | 
| 9644 | 
            +
             | 
| 9220 9645 | 
             
            /**
         | 
| 9221 9646 | 
             
             * Called from Image_motion_blur and Image_sketch.
         | 
| 9222 9647 | 
             
             *
         | 
| @@ -9231,8 +9656,7 @@ Image_montage(VALUE self) | |
| 9231 9656 | 
             
             * @see Image_sketch
         | 
| 9232 9657 | 
             
             */
         | 
| 9233 9658 | 
             
            static VALUE
         | 
| 9234 | 
            -
            motion_blur(int argc, VALUE *argv, VALUE self,
         | 
| 9235 | 
            -
                        Image *fp(const Image *, const double, const double, const double, ExceptionInfo *))
         | 
| 9659 | 
            +
            motion_blur(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
         | 
| 9236 9660 | 
             
            {
         | 
| 9237 9661 | 
             
                Image *image, *new_image;
         | 
| 9238 9662 | 
             
                double radius = 0.0;
         | 
| @@ -9260,10 +9684,11 @@ motion_blur(int argc, VALUE *argv, VALUE self, | |
| 9260 9684 | 
             
                    rb_raise(rb_eArgError, "sigma must be != 0.0");
         | 
| 9261 9685 | 
             
                }
         | 
| 9262 9686 |  | 
| 9263 | 
            -
                 | 
| 9687 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 9264 9688 |  | 
| 9265 9689 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9266 | 
            -
                 | 
| 9690 | 
            +
                GVL_STRUCT_TYPE(motion_blur) args = { image, radius, sigma, angle, exception };
         | 
| 9691 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 9267 9692 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9268 9693 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9269 9694 |  | 
| @@ -9287,7 +9712,7 @@ VALUE | |
| 9287 9712 | 
             
            Image_motion_blur(int argc, VALUE *argv, VALUE self)
         | 
| 9288 9713 | 
             
            {
         | 
| 9289 9714 | 
             
                rm_check_destroyed(self);
         | 
| 9290 | 
            -
                return motion_blur(argc, argv, self, MotionBlurImage);
         | 
| 9715 | 
            +
                return motion_blur(argc, argv, self, GVL_FUNC(MotionBlurImage));
         | 
| 9291 9716 | 
             
            }
         | 
| 9292 9717 |  | 
| 9293 9718 |  | 
| @@ -9322,11 +9747,13 @@ Image_negate(int argc, VALUE *argv, VALUE self) | |
| 9322 9747 |  | 
| 9323 9748 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9324 9749 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9325 | 
            -
                NegateImage | 
| 9750 | 
            +
                GVL_STRUCT_TYPE(NegateImage) args = { new_image, grayscale, exception };
         | 
| 9751 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NegateImage), &args);
         | 
| 9326 9752 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9327 9753 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9328 9754 | 
             
            #else
         | 
| 9329 | 
            -
                NegateImage | 
| 9755 | 
            +
                GVL_STRUCT_TYPE(NegateImage) args = { new_image, grayscale };
         | 
| 9756 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NegateImage), &args);
         | 
| 9330 9757 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 9331 9758 | 
             
            #endif
         | 
| 9332 9759 |  | 
| @@ -9379,12 +9806,14 @@ Image_negate_channel(int argc, VALUE *argv, VALUE self) | |
| 9379 9806 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9380 9807 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9381 9808 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 9382 | 
            -
                NegateImage | 
| 9809 | 
            +
                GVL_STRUCT_TYPE(NegateImage) args = { new_image, grayscale, exception };
         | 
| 9810 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NegateImage), &args);
         | 
| 9383 9811 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 9384 9812 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9385 9813 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9386 9814 | 
             
            #else
         | 
| 9387 | 
            -
                NegateImageChannel | 
| 9815 | 
            +
                GVL_STRUCT_TYPE(NegateImageChannel) args = { new_image, channels, grayscale };
         | 
| 9816 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NegateImageChannel), &args);
         | 
| 9388 9817 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 9389 9818 | 
             
            #endif
         | 
| 9390 9819 |  | 
| @@ -9402,7 +9831,7 @@ Image_alloc(VALUE class) | |
| 9402 9831 | 
             
            {
         | 
| 9403 9832 | 
             
                VALUE image_obj;
         | 
| 9404 9833 |  | 
| 9405 | 
            -
                image_obj =  | 
| 9834 | 
            +
                image_obj = TypedData_Wrap_Struct(class, &rm_image_data_type, NULL);
         | 
| 9406 9835 |  | 
| 9407 9836 | 
             
                RB_GC_GUARD(image_obj);
         | 
| 9408 9837 |  | 
| @@ -9446,7 +9875,7 @@ Image_initialize(int argc, VALUE *argv, VALUE self) | |
| 9446 9875 |  | 
| 9447 9876 | 
             
                // Create a new Info object to use when creating this image.
         | 
| 9448 9877 | 
             
                info_obj = rm_info_new();
         | 
| 9449 | 
            -
                 | 
| 9878 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 9450 9879 |  | 
| 9451 9880 | 
             
                image = rm_acquire_image(info);
         | 
| 9452 9881 | 
             
                if (!image)
         | 
| @@ -9461,11 +9890,13 @@ Image_initialize(int argc, VALUE *argv, VALUE self) | |
| 9461 9890 |  | 
| 9462 9891 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9463 9892 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9464 | 
            -
                SetImageExtent | 
| 9893 | 
            +
                GVL_STRUCT_TYPE(SetImageExtent) args = { image, cols, rows, exception };
         | 
| 9894 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageExtent), &args);
         | 
| 9465 9895 | 
             
                CHECK_EXCEPTION();
         | 
| 9466 9896 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9467 9897 | 
             
            #else
         | 
| 9468 | 
            -
                SetImageExtent | 
| 9898 | 
            +
                GVL_STRUCT_TYPE(SetImageExtent) args = { image, cols, rows };
         | 
| 9899 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageExtent), &args);
         | 
| 9469 9900 | 
             
            #endif
         | 
| 9470 9901 |  | 
| 9471 9902 | 
             
                // If the caller did not supply a fill argument, call SetImageBackgroundColor
         | 
| @@ -9475,11 +9906,13 @@ Image_initialize(int argc, VALUE *argv, VALUE self) | |
| 9475 9906 | 
             
                {
         | 
| 9476 9907 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9477 9908 | 
             
                    exception = AcquireExceptionInfo();
         | 
| 9478 | 
            -
                    SetImageBackgroundColor | 
| 9909 | 
            +
                    GVL_STRUCT_TYPE(SetImageBackgroundColor) args = { image, exception };
         | 
| 9910 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageBackgroundColor), &args);
         | 
| 9479 9911 | 
             
                    CHECK_EXCEPTION();
         | 
| 9480 9912 | 
             
                    DestroyExceptionInfo(exception);
         | 
| 9481 9913 | 
             
            #else
         | 
| 9482 | 
            -
                    SetImageBackgroundColor | 
| 9914 | 
            +
                    GVL_STRUCT_TYPE(SetImageBackgroundColor) args = { image };
         | 
| 9915 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageBackgroundColor), &args);
         | 
| 9483 9916 | 
             
            #endif
         | 
| 9484 9917 | 
             
                }
         | 
| 9485 9918 | 
             
                // fillobj.fill(self)
         | 
| @@ -9512,7 +9945,7 @@ rm_image_new(Image *image) | |
| 9512 9945 | 
             
            {
         | 
| 9513 9946 | 
             
                rm_ensure_result(image);
         | 
| 9514 9947 |  | 
| 9515 | 
            -
                return  | 
| 9948 | 
            +
                return TypedData_Wrap_Struct(Class_Image, &rm_image_data_type, image);
         | 
| 9516 9949 | 
             
            }
         | 
| 9517 9950 |  | 
| 9518 9951 |  | 
| @@ -9535,11 +9968,13 @@ Image_normalize(VALUE self) | |
| 9535 9968 |  | 
| 9536 9969 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9537 9970 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9538 | 
            -
                NormalizeImage | 
| 9971 | 
            +
                GVL_STRUCT_TYPE(NormalizeImage) args = { new_image, exception };
         | 
| 9972 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NormalizeImage), &args);
         | 
| 9539 9973 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9540 9974 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9541 9975 | 
             
            #else
         | 
| 9542 | 
            -
                NormalizeImage | 
| 9976 | 
            +
                GVL_STRUCT_TYPE(NormalizeImage) args = { new_image };
         | 
| 9977 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NormalizeImage), &args);
         | 
| 9543 9978 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 9544 9979 | 
             
            #endif
         | 
| 9545 9980 |  | 
| @@ -9577,12 +10012,14 @@ Image_normalize_channel(int argc, VALUE *argv, VALUE self) | |
| 9577 10012 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9578 10013 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9579 10014 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 9580 | 
            -
                NormalizeImage | 
| 10015 | 
            +
                GVL_STRUCT_TYPE(NormalizeImage) args = { new_image, exception };
         | 
| 10016 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NormalizeImage), &args);
         | 
| 9581 10017 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 9582 10018 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9583 10019 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9584 10020 | 
             
            #else
         | 
| 9585 | 
            -
                NormalizeImageChannel | 
| 10021 | 
            +
                GVL_STRUCT_TYPE(NormalizeImageChannel) args = { new_image, channels };
         | 
| 10022 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(NormalizeImageChannel), &args);
         | 
| 9586 10023 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 9587 10024 | 
             
            #endif
         | 
| 9588 10025 |  | 
| @@ -9598,7 +10035,7 @@ Image_normalize_channel(int argc, VALUE *argv, VALUE self) | |
| 9598 10035 | 
             
            VALUE
         | 
| 9599 10036 | 
             
            Image_normalized_mean_error(VALUE self)
         | 
| 9600 10037 | 
             
            {
         | 
| 9601 | 
            -
                 | 
| 10038 | 
            +
                IMPLEMENT_TYPED_ATTR_READERF(Image, normalized_mean_error, error.normalized_mean_error, dbl, &rm_image_data_type);
         | 
| 9602 10039 | 
             
            }
         | 
| 9603 10040 |  | 
| 9604 10041 | 
             
            /**
         | 
| @@ -9609,7 +10046,7 @@ Image_normalized_mean_error(VALUE self) | |
| 9609 10046 | 
             
            VALUE
         | 
| 9610 10047 | 
             
            Image_normalized_maximum_error(VALUE self)
         | 
| 9611 10048 | 
             
            {
         | 
| 9612 | 
            -
                 | 
| 10049 | 
            +
                IMPLEMENT_TYPED_ATTR_READERF(Image, normalized_maximum_error, error.normalized_maximum_error, dbl, &rm_image_data_type);
         | 
| 9613 10050 | 
             
            }
         | 
| 9614 10051 |  | 
| 9615 10052 |  | 
| @@ -9623,12 +10060,13 @@ Image_number_colors(VALUE self) | |
| 9623 10060 | 
             
            {
         | 
| 9624 10061 | 
             
                Image *image;
         | 
| 9625 10062 | 
             
                ExceptionInfo *exception;
         | 
| 9626 | 
            -
                 | 
| 10063 | 
            +
                size_t n = 0;
         | 
| 9627 10064 |  | 
| 9628 10065 | 
             
                image = rm_check_destroyed(self);
         | 
| 9629 10066 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9630 10067 |  | 
| 9631 | 
            -
                 | 
| 10068 | 
            +
                GVL_STRUCT_TYPE(GetNumberColors) args = { image, NULL, exception };
         | 
| 10069 | 
            +
                n = (size_t)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetNumberColors), &args);
         | 
| 9632 10070 | 
             
                CHECK_EXCEPTION();
         | 
| 9633 10071 |  | 
| 9634 10072 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -9645,7 +10083,7 @@ Image_number_colors(VALUE self) | |
| 9645 10083 | 
             
            VALUE
         | 
| 9646 10084 | 
             
            Image_offset(VALUE self)
         | 
| 9647 10085 | 
             
            {
         | 
| 9648 | 
            -
                 | 
| 10086 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, offset, long, &rm_image_data_type);
         | 
| 9649 10087 | 
             
            }
         | 
| 9650 10088 |  | 
| 9651 10089 | 
             
            /**
         | 
| @@ -9657,7 +10095,7 @@ Image_offset(VALUE self) | |
| 9657 10095 | 
             
            VALUE
         | 
| 9658 10096 | 
             
            Image_offset_eq(VALUE self, VALUE val)
         | 
| 9659 10097 | 
             
            {
         | 
| 9660 | 
            -
                 | 
| 10098 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, offset, long, &rm_image_data_type);
         | 
| 9661 10099 | 
             
            }
         | 
| 9662 10100 |  | 
| 9663 10101 |  | 
| @@ -9693,10 +10131,11 @@ Image_oil_paint(int argc, VALUE *argv, VALUE self) | |
| 9693 10131 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9694 10132 |  | 
| 9695 10133 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9696 | 
            -
                 | 
| 10134 | 
            +
                GVL_STRUCT_TYPE(OilPaintImage) args = { image, radius, sigma, exception };
         | 
| 9697 10135 | 
             
            #else
         | 
| 9698 | 
            -
                 | 
| 10136 | 
            +
                GVL_STRUCT_TYPE(OilPaintImage) args = { image, radius, exception };
         | 
| 9699 10137 | 
             
            #endif
         | 
| 10138 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OilPaintImage), &args);
         | 
| 9700 10139 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9701 10140 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9702 10141 |  | 
| @@ -9737,11 +10176,13 @@ Image_opaque(VALUE self, VALUE target, VALUE fill) | |
| 9737 10176 |  | 
| 9738 10177 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9739 10178 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9740 | 
            -
                 | 
| 10179 | 
            +
                GVL_STRUCT_TYPE(OpaquePaintImage) args = { new_image, &target_pp, &fill_pp, MagickFalse, exception };
         | 
| 10180 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImage), &args);
         | 
| 9741 10181 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9742 10182 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9743 10183 | 
             
            #else
         | 
| 9744 | 
            -
                 | 
| 10184 | 
            +
                GVL_STRUCT_TYPE(OpaquePaintImageChannel) args = { new_image, DefaultChannels, &target_pp, &fill_pp, MagickFalse };
         | 
| 10185 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImageChannel), &args);
         | 
| 9745 10186 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 9746 10187 | 
             
            #endif
         | 
| 9747 10188 |  | 
| @@ -9827,13 +10268,15 @@ Image_opaque_channel(int argc, VALUE *argv, VALUE self) | |
| 9827 10268 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 9828 10269 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9829 10270 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 9830 | 
            -
                 | 
| 10271 | 
            +
                GVL_STRUCT_TYPE(OpaquePaintImage) args = { new_image, &target_pp, &fill_pp, invert, exception };
         | 
| 10272 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImage), &args);
         | 
| 9831 10273 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 9832 10274 | 
             
                new_image->fuzz = keep;
         | 
| 9833 10275 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9834 10276 | 
             
                DestroyExceptionInfo(exception);
         | 
| 9835 10277 | 
             
            #else
         | 
| 9836 | 
            -
                 | 
| 10278 | 
            +
                GVL_STRUCT_TYPE(OpaquePaintImageChannel) args = { new_image, channels, &target_pp, &fill_pp, invert };
         | 
| 10279 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OpaquePaintImageChannel), &args);
         | 
| 9837 10280 |  | 
| 9838 10281 | 
             
                new_image->fuzz = keep;
         | 
| 9839 10282 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| @@ -9918,7 +10361,13 @@ Image_ordered_dither(int argc, VALUE *argv, VALUE self) | |
| 9918 10361 |  | 
| 9919 10362 | 
             
                exception = AcquireExceptionInfo();
         | 
| 9920 10363 |  | 
| 9921 | 
            -
             | 
| 10364 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 10365 | 
            +
                GVL_STRUCT_TYPE(OrderedDitherImage) args = { new_image, threshold_map, exception };
         | 
| 10366 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OrderedDitherImage), &args);
         | 
| 10367 | 
            +
            #else
         | 
| 10368 | 
            +
                GVL_STRUCT_TYPE(OrderedPosterizeImage) args = { new_image, threshold_map, exception };
         | 
| 10369 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OrderedPosterizeImage), &args);
         | 
| 10370 | 
            +
            #endif
         | 
| 9922 10371 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 9923 10372 |  | 
| 9924 10373 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -10053,12 +10502,14 @@ Image_paint_transparent(int argc, VALUE *argv, VALUE self) | |
| 10053 10502 |  | 
| 10054 10503 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10055 10504 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10056 | 
            -
                 | 
| 10505 | 
            +
                GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, (const MagickPixel *)&color, alpha, invert, exception };
         | 
| 10506 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args);
         | 
| 10057 10507 | 
             
                new_image->fuzz = keep;
         | 
| 10058 10508 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10059 10509 | 
             
                DestroyExceptionInfo(exception);
         | 
| 10060 10510 | 
             
            #else
         | 
| 10061 | 
            -
                 | 
| 10511 | 
            +
                GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, (const MagickPixel *)&color, QuantumRange - alpha, invert };
         | 
| 10512 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args);
         | 
| 10062 10513 | 
             
                new_image->fuzz = keep;
         | 
| 10063 10514 |  | 
| 10064 10515 | 
             
                // Is it possible for TransparentPaintImage to silently fail?
         | 
| @@ -10101,7 +10552,7 @@ Image_palette_q(VALUE self) | |
| 10101 10552 | 
             
            VALUE
         | 
| 10102 10553 | 
             
            Image_ping(VALUE class, VALUE file_arg)
         | 
| 10103 10554 | 
             
            {
         | 
| 10104 | 
            -
                return rd_image(class, file_arg, PingImage);
         | 
| 10555 | 
            +
                return rd_image(class, file_arg, GVL_FUNC(PingImage));
         | 
| 10105 10556 | 
             
            }
         | 
| 10106 10557 |  | 
| 10107 10558 |  | 
| @@ -10167,7 +10618,8 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10167 10618 | 
             
                if (!set)
         | 
| 10168 10619 | 
             
                {
         | 
| 10169 10620 | 
             
                    exception = AcquireExceptionInfo();
         | 
| 10170 | 
            -
                     | 
| 10621 | 
            +
                    GVL_STRUCT_TYPE(GetVirtualPixels) args = { image, x, y, 1, 1, exception };
         | 
| 10622 | 
            +
                    old_pixel = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetVirtualPixels), &args);
         | 
| 10171 10623 | 
             
                    CHECK_EXCEPTION();
         | 
| 10172 10624 |  | 
| 10173 10625 | 
             
                    DestroyExceptionInfo(exception);
         | 
| @@ -10219,7 +10671,8 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10219 10671 | 
             
                if (image->storage_class == PseudoClass)
         | 
| 10220 10672 | 
             
                {
         | 
| 10221 10673 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10222 | 
            -
                     | 
| 10674 | 
            +
                    GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass, exception };
         | 
| 10675 | 
            +
                    okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 10223 10676 | 
             
                    CHECK_EXCEPTION();
         | 
| 10224 10677 | 
             
                    if (!okay)
         | 
| 10225 10678 | 
             
                    {
         | 
| @@ -10227,7 +10680,8 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10227 10680 | 
             
                        rb_raise(Class_ImageMagickError, "SetImageStorageClass failed. Can't set pixel color.");
         | 
| 10228 10681 | 
             
                    }
         | 
| 10229 10682 | 
             
            #else
         | 
| 10230 | 
            -
                     | 
| 10683 | 
            +
                    GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass };
         | 
| 10684 | 
            +
                    okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 10231 10685 | 
             
                    rm_check_image_exception(image, RetainOnError);
         | 
| 10232 10686 | 
             
                    if (!okay)
         | 
| 10233 10687 | 
             
                    {
         | 
| @@ -10240,7 +10694,8 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10240 10694 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10241 10695 | 
             
            #endif
         | 
| 10242 10696 |  | 
| 10243 | 
            -
                 | 
| 10697 | 
            +
                GVL_STRUCT_TYPE(GetAuthenticPixels) args = { image, x, y, 1, 1, exception };
         | 
| 10698 | 
            +
                pixel = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetAuthenticPixels), &args);
         | 
| 10244 10699 | 
             
                CHECK_EXCEPTION();
         | 
| 10245 10700 |  | 
| 10246 10701 | 
             
                if (pixel)
         | 
| @@ -10275,7 +10730,8 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10275 10730 | 
             
                    }
         | 
| 10276 10731 | 
             
            #endif
         | 
| 10277 10732 |  | 
| 10278 | 
            -
                    SyncAuthenticPixels | 
| 10733 | 
            +
                    GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
         | 
| 10734 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
         | 
| 10279 10735 | 
             
                    CHECK_EXCEPTION();
         | 
| 10280 10736 | 
             
                }
         | 
| 10281 10737 |  | 
| @@ -10364,7 +10820,7 @@ Image_polaroid(int argc, VALUE *argv, VALUE self) | |
| 10364 10820 | 
             
                }
         | 
| 10365 10821 |  | 
| 10366 10822 | 
             
                options = rm_polaroid_new();
         | 
| 10367 | 
            -
                 | 
| 10823 | 
            +
                TypedData_Get_Struct(options, Draw, &rm_draw_data_type, draw);
         | 
| 10368 10824 |  | 
| 10369 10825 | 
             
                clone = rm_clone_image(image);
         | 
| 10370 10826 | 
             
                clone->background_color = draw->shadow_color;
         | 
| @@ -10373,9 +10829,11 @@ Image_polaroid(int argc, VALUE *argv, VALUE self) | |
| 10373 10829 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10374 10830 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10375 10831 | 
             
                caption = GetImageProperty(clone, "Caption", exception);
         | 
| 10376 | 
            -
                 | 
| 10832 | 
            +
                GVL_STRUCT_TYPE(PolaroidImage) args = { clone, draw->info, caption, angle, image->interpolate, exception };
         | 
| 10833 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(PolaroidImage), &args);
         | 
| 10377 10834 | 
             
            #else
         | 
| 10378 | 
            -
                 | 
| 10835 | 
            +
                GVL_STRUCT_TYPE(PolaroidImage) args = { clone, draw->info, angle, exception };
         | 
| 10836 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(PolaroidImage), &args);
         | 
| 10379 10837 | 
             
            #endif
         | 
| 10380 10838 | 
             
                rm_check_exception(exception, clone, DestroyOnError);
         | 
| 10381 10839 |  | 
| @@ -10427,11 +10885,13 @@ Image_posterize(int argc, VALUE *argv, VALUE self) | |
| 10427 10885 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10428 10886 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10429 10887 | 
             
                dither_method = dither ? RiemersmaDitherMethod : NoDitherMethod;
         | 
| 10430 | 
            -
                PosterizeImage | 
| 10888 | 
            +
                GVL_STRUCT_TYPE(PosterizeImage) args = { new_image, levels, dither_method, exception };
         | 
| 10889 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(PosterizeImage), &args);
         | 
| 10431 10890 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10432 10891 | 
             
                DestroyExceptionInfo(exception);
         | 
| 10433 10892 | 
             
            #else
         | 
| 10434 | 
            -
                PosterizeImage | 
| 10893 | 
            +
                GVL_STRUCT_TYPE(PosterizeImage) args = { new_image, levels, dither };
         | 
| 10894 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(PosterizeImage), &args);
         | 
| 10435 10895 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 10436 10896 | 
             
            #endif
         | 
| 10437 10897 |  | 
| @@ -10457,7 +10917,8 @@ Image_preview(VALUE self, VALUE preview) | |
| 10457 10917 | 
             
                VALUE_TO_ENUM(preview, preview_type, PreviewType);
         | 
| 10458 10918 |  | 
| 10459 10919 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10460 | 
            -
                 | 
| 10920 | 
            +
                GVL_STRUCT_TYPE(PreviewImage) args = { image, preview_type, exception };
         | 
| 10921 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(PreviewImage), &args);
         | 
| 10461 10922 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10462 10923 |  | 
| 10463 10924 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -10498,7 +10959,7 @@ Image_profile_bang(VALUE self, VALUE name, VALUE profile) | |
| 10498 10959 | 
             
            VALUE
         | 
| 10499 10960 | 
             
            Image_quality(VALUE self)
         | 
| 10500 10961 | 
             
            {
         | 
| 10501 | 
            -
                 | 
| 10962 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, quality, ulong, &rm_image_data_type);
         | 
| 10502 10963 | 
             
            }
         | 
| 10503 10964 |  | 
| 10504 10965 |  | 
| @@ -10684,10 +11145,12 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self) | |
| 10684 11145 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10685 11146 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10686 11147 | 
             
                BEGIN_CHANNEL_MASK(image, channel);
         | 
| 10687 | 
            -
                EvaluateImage | 
| 11148 | 
            +
                GVL_STRUCT_TYPE(EvaluateImage) args = { image, qop, rvalue, exception };
         | 
| 11149 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EvaluateImage), &args);
         | 
| 10688 11150 | 
             
                END_CHANNEL_MASK(image);
         | 
| 10689 11151 | 
             
            #else
         | 
| 10690 | 
            -
                EvaluateImageChannel | 
| 11152 | 
            +
                GVL_STRUCT_TYPE(EvaluateImageChannel) args = { image, channel, qop, rvalue, exception };
         | 
| 11153 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EvaluateImageChannel), &args);
         | 
| 10691 11154 | 
             
            #endif
         | 
| 10692 11155 | 
             
                CHECK_EXCEPTION();
         | 
| 10693 11156 |  | 
| @@ -10764,11 +11227,13 @@ Image_quantize(int argc, VALUE *argv, VALUE self) | |
| 10764 11227 |  | 
| 10765 11228 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10766 11229 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10767 | 
            -
                QuantizeImage | 
| 11230 | 
            +
                GVL_STRUCT_TYPE(QuantizeImage) args = { &quantize_info, new_image, exception };
         | 
| 11231 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImage), &args);
         | 
| 10768 11232 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10769 11233 | 
             
                DestroyExceptionInfo(exception);
         | 
| 10770 11234 | 
             
            #else
         | 
| 10771 | 
            -
                QuantizeImage | 
| 11235 | 
            +
                GVL_STRUCT_TYPE(QuantizeImage) args = { &quantize_info, new_image };
         | 
| 11236 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImage), &args);
         | 
| 10772 11237 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 10773 11238 | 
             
            #endif
         | 
| 10774 11239 |  | 
| @@ -10793,9 +11258,11 @@ Image_radial_blur(VALUE self, VALUE angle_obj) | |
| 10793 11258 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10794 11259 |  | 
| 10795 11260 | 
             
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 10796 | 
            -
                 | 
| 11261 | 
            +
                GVL_STRUCT_TYPE(RotationalBlurImage) args = { image, angle, exception };
         | 
| 11262 | 
            +
                new_image = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImage), &args);
         | 
| 10797 11263 | 
             
            #else
         | 
| 10798 | 
            -
                 | 
| 11264 | 
            +
                GVL_STRUCT_TYPE(RadialBlurImage) args = { image, angle, exception };
         | 
| 11265 | 
            +
                new_image = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RadialBlurImage), &args);
         | 
| 10799 11266 | 
             
            #endif
         | 
| 10800 11267 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10801 11268 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -10843,13 +11310,16 @@ Image_radial_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 10843 11310 |  | 
| 10844 11311 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10845 11312 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 10846 | 
            -
                 | 
| 11313 | 
            +
                GVL_STRUCT_TYPE(RotationalBlurImage) args = { image, angle, exception };
         | 
| 11314 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImage), &args);
         | 
| 10847 11315 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 10848 11316 | 
             
                END_CHANNEL_MASK(image);
         | 
| 10849 11317 | 
             
            #elif defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 10850 | 
            -
                 | 
| 11318 | 
            +
                GVL_STRUCT_TYPE(RotationalBlurImageChannel) args = { image, channels, angle, exception };
         | 
| 11319 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImageChannel), &args);
         | 
| 10851 11320 | 
             
            #else
         | 
| 10852 | 
            -
                 | 
| 11321 | 
            +
                GVL_STRUCT_TYPE(RadialBlurImageChannel) args = { image, channels, angle, exception };
         | 
| 11322 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RadialBlurImageChannel), &args);
         | 
| 10853 11323 | 
             
            #endif
         | 
| 10854 11324 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10855 11325 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -10910,11 +11380,13 @@ Image_random_threshold_channel(int argc, VALUE *argv, VALUE self) | |
| 10910 11380 | 
             
                    GeometryInfo geometry_info;
         | 
| 10911 11381 |  | 
| 10912 11382 | 
             
                    ParseGeometry(thresholds, &geometry_info);
         | 
| 10913 | 
            -
                    RandomThresholdImage | 
| 11383 | 
            +
                    GVL_STRUCT_TYPE(RandomThresholdImage) args = { new_image, geometry_info.rho, geometry_info.sigma, exception };
         | 
| 11384 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RandomThresholdImage), &args);
         | 
| 10914 11385 | 
             
                }
         | 
| 10915 11386 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 10916 11387 | 
             
            #else
         | 
| 10917 | 
            -
                RandomThresholdImageChannel | 
| 11388 | 
            +
                GVL_STRUCT_TYPE(RandomThresholdImageChannel) args = { new_image, channels, thresholds, exception };
         | 
| 11389 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RandomThresholdImageChannel), &args);
         | 
| 10918 11390 | 
             
            #endif
         | 
| 10919 11391 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10920 11392 |  | 
| @@ -10971,11 +11443,13 @@ Image_raise(int argc, VALUE *argv, VALUE self) | |
| 10971 11443 |  | 
| 10972 11444 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10973 11445 | 
             
                exception = AcquireExceptionInfo();
         | 
| 10974 | 
            -
                RaiseImage | 
| 11446 | 
            +
                GVL_STRUCT_TYPE(RaiseImage) args = { new_image, &rect, raised, exception };
         | 
| 11447 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RaiseImage), &args);
         | 
| 10975 11448 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 10976 11449 | 
             
                DestroyExceptionInfo(exception);
         | 
| 10977 11450 | 
             
            #else
         | 
| 10978 | 
            -
                RaiseImage | 
| 11451 | 
            +
                GVL_STRUCT_TYPE(RaiseImage) args = { new_image, &rect, raised };
         | 
| 11452 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RaiseImage), &args);
         | 
| 10979 11453 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 10980 11454 | 
             
            #endif
         | 
| 10981 11455 |  | 
| @@ -10992,7 +11466,7 @@ Image_raise(int argc, VALUE *argv, VALUE self) | |
| 10992 11466 | 
             
            VALUE
         | 
| 10993 11467 | 
             
            Image_read(VALUE class, VALUE file_arg)
         | 
| 10994 11468 | 
             
            {
         | 
| 10995 | 
            -
                return rd_image(class, file_arg, ReadImage);
         | 
| 11469 | 
            +
                return rd_image(class, file_arg, GVL_FUNC(ReadImage));
         | 
| 10996 11470 | 
             
            }
         | 
| 10997 11471 |  | 
| 10998 11472 |  | 
| @@ -11012,6 +11486,9 @@ file_arg_rescue(VALUE arg, VALUE raised_exc ATTRIBUTE_UNUSED) | |
| 11012 11486 | 
             
            }
         | 
| 11013 11487 |  | 
| 11014 11488 |  | 
| 11489 | 
            +
            // aliases for common use of structure types; PingImage, ReadImage
         | 
| 11490 | 
            +
            typedef GVL_STRUCT_TYPE(PingImage) GVL_STRUCT_TYPE(rd_image);
         | 
| 11491 | 
            +
             | 
| 11015 11492 | 
             
            /**
         | 
| 11016 11493 | 
             
             * Transform arguments, call either ReadImage or PingImage.
         | 
| 11017 11494 | 
             
             *
         | 
| @@ -11037,7 +11514,7 @@ void sig_handler(int sig ATTRIBUTE_UNUSED) | |
| 11037 11514 | 
             
            #endif
         | 
| 11038 11515 |  | 
| 11039 11516 | 
             
            static VALUE
         | 
| 11040 | 
            -
            rd_image(VALUE class ATTRIBUTE_UNUSED, VALUE file,  | 
| 11517 | 
            +
            rd_image(VALUE class ATTRIBUTE_UNUSED, VALUE file, gvl_function_t fp)
         | 
| 11041 11518 | 
             
            {
         | 
| 11042 11519 | 
             
                char *filename;
         | 
| 11043 11520 | 
             
                long filename_l;
         | 
| @@ -11048,7 +11525,7 @@ rd_image(VALUE class ATTRIBUTE_UNUSED, VALUE file, reader_t reader) | |
| 11048 11525 |  | 
| 11049 11526 | 
             
                // Create a new Info structure for this read/ping
         | 
| 11050 11527 | 
             
                info_obj = rm_info_new();
         | 
| 11051 | 
            -
                 | 
| 11528 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 11052 11529 |  | 
| 11053 11530 | 
             
                if (TYPE(file) == T_FILE)
         | 
| 11054 11531 | 
             
                {
         | 
| @@ -11088,7 +11565,8 @@ rd_image(VALUE class ATTRIBUTE_UNUSED, VALUE file, reader_t reader) | |
| 11088 11565 | 
             
                }
         | 
| 11089 11566 | 
             
            #endif
         | 
| 11090 11567 |  | 
| 11091 | 
            -
                 | 
| 11568 | 
            +
                GVL_STRUCT_TYPE(rd_image) args = { info, exception };
         | 
| 11569 | 
            +
                images = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 11092 11570 |  | 
| 11093 11571 | 
             
            #if defined(__APPLE__) || defined(__FreeBSD__)
         | 
| 11094 11572 | 
             
                if (sigaction(SIGCHLD, &oldact, NULL) < 0)
         | 
| @@ -11173,7 +11651,8 @@ Image_recolor(VALUE self, VALUE color_matrix) | |
| 11173 11651 | 
             
                kernel_info->height = order;
         | 
| 11174 11652 | 
             
                kernel_info->values = (double *) matrix;
         | 
| 11175 11653 |  | 
| 11176 | 
            -
                 | 
| 11654 | 
            +
                GVL_STRUCT_TYPE(ColorMatrixImage) args = { image, kernel_info, exception };
         | 
| 11655 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ColorMatrixImage), &args);
         | 
| 11177 11656 | 
             
                kernel_info->values = (double *) NULL;
         | 
| 11178 11657 | 
             
                DestroyKernelInfo(kernel_info);
         | 
| 11179 11658 | 
             
                xfree((void *) matrix);
         | 
| @@ -11220,7 +11699,8 @@ Image_read_inline(VALUE self ATTRIBUTE_UNUSED, VALUE content) | |
| 11220 11699 | 
             
                    image_data += x + 1;
         | 
| 11221 11700 | 
             
                }
         | 
| 11222 11701 |  | 
| 11223 | 
            -
                 | 
| 11702 | 
            +
                GVL_STRUCT_TYPE(Base64Decode) args_Base64Decode = { image_data, &blob_l };
         | 
| 11703 | 
            +
                blob = (unsigned char *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(Base64Decode), &args_Base64Decode);
         | 
| 11224 11704 | 
             
                if (blob_l == 0)
         | 
| 11225 11705 | 
             
                {
         | 
| 11226 11706 | 
             
                    rb_raise(rb_eArgError, "can't decode image");
         | 
| @@ -11231,9 +11711,10 @@ Image_read_inline(VALUE self ATTRIBUTE_UNUSED, VALUE content) | |
| 11231 11711 | 
             
                // Create a new Info structure for this read. About the
         | 
| 11232 11712 | 
             
                // only useful attribute that can be set is `format'.
         | 
| 11233 11713 | 
             
                info_obj = rm_info_new();
         | 
| 11234 | 
            -
                 | 
| 11714 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 11235 11715 |  | 
| 11236 | 
            -
                 | 
| 11716 | 
            +
                GVL_STRUCT_TYPE(BlobToImage) args_BlobToImage = { info, blob, blob_l, exception };
         | 
| 11717 | 
            +
                images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlobToImage), &args_BlobToImage);
         | 
| 11237 11718 | 
             
                magick_free((void *)blob);
         | 
| 11238 11719 |  | 
| 11239 11720 | 
             
                rm_check_exception(exception, images, DestroyOnError);
         | 
| @@ -11295,7 +11776,8 @@ Image_reduce_noise(VALUE self, VALUE radius) | |
| 11295 11776 | 
             
                image = rm_check_destroyed(self);
         | 
| 11296 11777 |  | 
| 11297 11778 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11298 | 
            -
                 | 
| 11779 | 
            +
                GVL_STRUCT_TYPE(StatisticImage) args = { image, NonpeakStatistic, radius_size, radius_size, exception };
         | 
| 11780 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(StatisticImage), &args);
         | 
| 11299 11781 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11300 11782 |  | 
| 11301 11783 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -11347,11 +11829,13 @@ Image_remap(int argc, VALUE *argv, VALUE self) | |
| 11347 11829 |  | 
| 11348 11830 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 11349 11831 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11350 | 
            -
                RemapImage | 
| 11832 | 
            +
                GVL_STRUCT_TYPE(RemapImage) args = { &quantize_info, image, remap_image, exception };
         | 
| 11833 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImage), &args);
         | 
| 11351 11834 | 
             
                CHECK_EXCEPTION();
         | 
| 11352 11835 | 
             
                DestroyExceptionInfo(exception);
         | 
| 11353 11836 | 
             
            #else
         | 
| 11354 | 
            -
                RemapImage | 
| 11837 | 
            +
                GVL_STRUCT_TYPE(RemapImage) args = { &quantize_info, image, remap_image };
         | 
| 11838 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImage), &args);
         | 
| 11355 11839 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 11356 11840 | 
             
            #endif
         | 
| 11357 11841 |  | 
| @@ -11406,11 +11890,13 @@ blurred_image(Image* image, double blur) | |
| 11406 11890 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11407 11891 | 
             
                if (blur > 1.0)
         | 
| 11408 11892 | 
             
                {
         | 
| 11409 | 
            -
                     | 
| 11893 | 
            +
                    GVL_STRUCT_TYPE(BlurImage) args = { image, blur, blur, exception };
         | 
| 11894 | 
            +
                    new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlurImage), &args);
         | 
| 11410 11895 | 
             
                }
         | 
| 11411 11896 | 
             
                else
         | 
| 11412 11897 | 
             
                {
         | 
| 11413 | 
            -
                     | 
| 11898 | 
            +
                    GVL_STRUCT_TYPE(SharpenImage) args = { image, blur, blur, exception };
         | 
| 11899 | 
            +
                    new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SharpenImage), &args);
         | 
| 11414 11900 | 
             
                }
         | 
| 11415 11901 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11416 11902 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -11443,7 +11929,7 @@ resample(int bang, int argc, VALUE *argv, VALUE self) | |
| 11443 11929 | 
             
                double width, height;
         | 
| 11444 11930 | 
             
                ExceptionInfo *exception;
         | 
| 11445 11931 |  | 
| 11446 | 
            -
                 | 
| 11932 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 11447 11933 |  | 
| 11448 11934 | 
             
                // Set up defaults
         | 
| 11449 11935 | 
             
                filter  = image->filter;
         | 
| @@ -11503,10 +11989,12 @@ resample(int bang, int argc, VALUE *argv, VALUE self) | |
| 11503 11989 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11504 11990 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 11505 11991 | 
             
                Image *preprocess = blurred_image(image, blur);
         | 
| 11506 | 
            -
                 | 
| 11992 | 
            +
                GVL_STRUCT_TYPE(ResampleImage) args = { preprocess, x_resolution, y_resolution, filter, exception };
         | 
| 11993 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ResampleImage), &args);
         | 
| 11507 11994 | 
             
                DestroyImage(preprocess);
         | 
| 11508 11995 | 
             
            #else
         | 
| 11509 | 
            -
                 | 
| 11996 | 
            +
                GVL_STRUCT_TYPE(ResampleImage) args = { image, x_resolution, y_resolution, filter, blur, exception };
         | 
| 11997 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ResampleImage), &args);
         | 
| 11510 11998 | 
             
            #endif
         | 
| 11511 11999 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11512 12000 |  | 
| @@ -11593,7 +12081,7 @@ resize(int bang, int argc, VALUE *argv, VALUE self) | |
| 11593 12081 | 
             
                double blur, drows, dcols;
         | 
| 11594 12082 | 
             
                ExceptionInfo *exception;
         | 
| 11595 12083 |  | 
| 11596 | 
            -
                 | 
| 12084 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 11597 12085 |  | 
| 11598 12086 | 
             
                // Set up defaults
         | 
| 11599 12087 | 
             
                filter  = image->filter;
         | 
| @@ -11642,13 +12130,15 @@ resize(int bang, int argc, VALUE *argv, VALUE self) | |
| 11642 12130 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11643 12131 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 11644 12132 | 
             
                Image *preprocess = (argc == 4) ? blurred_image(image, blur) : image;
         | 
| 11645 | 
            -
                 | 
| 12133 | 
            +
                GVL_STRUCT_TYPE(ResizeImage) args = { preprocess, columns, rows, filter, exception };
         | 
| 12134 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ResizeImage), &args);
         | 
| 11646 12135 | 
             
                if (argc == 4)
         | 
| 11647 12136 | 
             
                {
         | 
| 11648 12137 | 
             
                    DestroyImage(preprocess);
         | 
| 11649 12138 | 
             
                }
         | 
| 11650 12139 | 
             
            #else
         | 
| 11651 | 
            -
                 | 
| 12140 | 
            +
                GVL_STRUCT_TYPE(ResizeImage) args = { image, columns, rows, filter, blur, exception };
         | 
| 12141 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ResizeImage), &args);
         | 
| 11652 12142 | 
             
            #endif
         | 
| 11653 12143 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11654 12144 |  | 
| @@ -11734,7 +12224,8 @@ Image_roll(VALUE self, VALUE x_offset, VALUE y_offset) | |
| 11734 12224 | 
             
                image = rm_check_destroyed(self);
         | 
| 11735 12225 |  | 
| 11736 12226 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11737 | 
            -
                 | 
| 12227 | 
            +
                GVL_STRUCT_TYPE(RollImage) args = { image, x, y, exception };
         | 
| 12228 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RollImage), &args);
         | 
| 11738 12229 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11739 12230 | 
             
                DestroyExceptionInfo(exception);
         | 
| 11740 12231 |  | 
| @@ -11764,7 +12255,7 @@ rotate(int bang, int argc, VALUE *argv, VALUE self) | |
| 11764 12255 | 
             
                long arrow_l;
         | 
| 11765 12256 | 
             
                ExceptionInfo *exception;
         | 
| 11766 12257 |  | 
| 11767 | 
            -
                 | 
| 12258 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 11768 12259 |  | 
| 11769 12260 | 
             
                switch (argc)
         | 
| 11770 12261 | 
             
                {
         | 
| @@ -11792,7 +12283,8 @@ rotate(int bang, int argc, VALUE *argv, VALUE self) | |
| 11792 12283 |  | 
| 11793 12284 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11794 12285 |  | 
| 11795 | 
            -
                 | 
| 12286 | 
            +
                GVL_STRUCT_TYPE(RotateImage) args = { image, degrees, exception };
         | 
| 12287 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotateImage), &args);
         | 
| 11796 12288 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11797 12289 | 
             
                DestroyExceptionInfo(exception);
         | 
| 11798 12290 |  | 
| @@ -11865,7 +12357,7 @@ Image_rotate_bang(int argc, VALUE *argv, VALUE self) | |
| 11865 12357 | 
             
            VALUE
         | 
| 11866 12358 | 
             
            Image_rows(VALUE self)
         | 
| 11867 12359 | 
             
            {
         | 
| 11868 | 
            -
                 | 
| 12360 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, rows, int, &rm_image_data_type);
         | 
| 11869 12361 | 
             
            }
         | 
| 11870 12362 |  | 
| 11871 12363 |  | 
| @@ -11889,7 +12381,7 @@ VALUE | |
| 11889 12381 | 
             
            Image_sample(int argc, VALUE *argv, VALUE self)
         | 
| 11890 12382 | 
             
            {
         | 
| 11891 12383 | 
             
                rm_check_destroyed(self);
         | 
| 11892 | 
            -
                return scale(False, argc, argv, self, SampleImage);
         | 
| 12384 | 
            +
                return scale(False, argc, argv, self, GVL_FUNC(SampleImage));
         | 
| 11893 12385 | 
             
            }
         | 
| 11894 12386 |  | 
| 11895 12387 |  | 
| @@ -11913,7 +12405,7 @@ VALUE | |
| 11913 12405 | 
             
            Image_sample_bang(int argc, VALUE *argv, VALUE self)
         | 
| 11914 12406 | 
             
            {
         | 
| 11915 12407 | 
             
                rm_check_frozen(self);
         | 
| 11916 | 
            -
                return scale(True, argc, argv, self, SampleImage);
         | 
| 12408 | 
            +
                return scale(True, argc, argv, self, GVL_FUNC(SampleImage));
         | 
| 11917 12409 | 
             
            }
         | 
| 11918 12410 |  | 
| 11919 12411 |  | 
| @@ -11937,7 +12429,7 @@ VALUE | |
| 11937 12429 | 
             
            Image_scale(int argc, VALUE *argv, VALUE self)
         | 
| 11938 12430 | 
             
            {
         | 
| 11939 12431 | 
             
                rm_check_destroyed(self);
         | 
| 11940 | 
            -
                return scale(False, argc, argv, self, ScaleImage);
         | 
| 12432 | 
            +
                return scale(False, argc, argv, self, GVL_FUNC(ScaleImage));
         | 
| 11941 12433 | 
             
            }
         | 
| 11942 12434 |  | 
| 11943 12435 |  | 
| @@ -11961,10 +12453,13 @@ VALUE | |
| 11961 12453 | 
             
            Image_scale_bang(int argc, VALUE *argv, VALUE self)
         | 
| 11962 12454 | 
             
            {
         | 
| 11963 12455 | 
             
                rm_check_frozen(self);
         | 
| 11964 | 
            -
                return scale(True, argc, argv, self, ScaleImage);
         | 
| 12456 | 
            +
                return scale(True, argc, argv, self, GVL_FUNC(ScaleImage));
         | 
| 11965 12457 | 
             
            }
         | 
| 11966 12458 |  | 
| 11967 12459 |  | 
| 12460 | 
            +
            // aliases for common use of structure types; SampleImage, ScaleImage,
         | 
| 12461 | 
            +
            typedef GVL_STRUCT_TYPE(SampleImage) GVL_STRUCT_TYPE(scale);
         | 
| 12462 | 
            +
             | 
| 11968 12463 | 
             
            /**
         | 
| 11969 12464 | 
             
             * Call ScaleImage or SampleImage
         | 
| 11970 12465 | 
             
             *
         | 
| @@ -11986,14 +12481,14 @@ Image_scale_bang(int argc, VALUE *argv, VALUE self) | |
| 11986 12481 | 
             
             * @see Image_scale_bang
         | 
| 11987 12482 | 
             
             */
         | 
| 11988 12483 | 
             
            static VALUE
         | 
| 11989 | 
            -
            scale(int bang, int argc, VALUE *argv, VALUE self,  | 
| 12484 | 
            +
            scale(int bang, int argc, VALUE *argv, VALUE self, gvl_function_t fp)
         | 
| 11990 12485 | 
             
            {
         | 
| 11991 12486 | 
             
                Image *image, *new_image;
         | 
| 11992 12487 | 
             
                unsigned long columns, rows;
         | 
| 11993 12488 | 
             
                double scale_arg, drows, dcols;
         | 
| 11994 12489 | 
             
                ExceptionInfo *exception;
         | 
| 11995 12490 |  | 
| 11996 | 
            -
                 | 
| 12491 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 11997 12492 |  | 
| 11998 12493 | 
             
                switch (argc)
         | 
| 11999 12494 | 
             
                {
         | 
| @@ -12026,7 +12521,8 @@ scale(int bang, int argc, VALUE *argv, VALUE self, scaler_t scaler) | |
| 12026 12521 | 
             
                }
         | 
| 12027 12522 |  | 
| 12028 12523 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12029 | 
            -
                 | 
| 12524 | 
            +
                GVL_STRUCT_TYPE(scale) args = { image, columns, rows, exception };
         | 
| 12525 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 12030 12526 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12031 12527 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12032 12528 |  | 
| @@ -12051,7 +12547,7 @@ scale(int bang, int argc, VALUE *argv, VALUE self, scaler_t scaler) | |
| 12051 12547 | 
             
            VALUE
         | 
| 12052 12548 | 
             
            Image_scene(VALUE self)
         | 
| 12053 12549 | 
             
            {
         | 
| 12054 | 
            -
                 | 
| 12550 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, scene, ulong, &rm_image_data_type);
         | 
| 12055 12551 | 
             
            }
         | 
| 12056 12552 |  | 
| 12057 12553 |  | 
| @@ -12102,11 +12598,13 @@ Image_selective_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 12102 12598 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12103 12599 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12104 12600 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 12105 | 
            -
                 | 
| 12601 | 
            +
                GVL_STRUCT_TYPE(SelectiveBlurImage) args = { image, radius, sigma, threshold, exception };
         | 
| 12602 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SelectiveBlurImage), &args);
         | 
| 12106 12603 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 12107 12604 | 
             
                END_CHANNEL_MASK(image);
         | 
| 12108 12605 | 
             
            #else
         | 
| 12109 | 
            -
                 | 
| 12606 | 
            +
                GVL_STRUCT_TYPE(SelectiveBlurImageChannel) args = { image, channels, radius, sigma, threshold, exception };
         | 
| 12607 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SelectiveBlurImageChannel), &args);
         | 
| 12110 12608 | 
             
            #endif
         | 
| 12111 12609 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12112 12610 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -12140,12 +12638,14 @@ Image_set_channel_depth(VALUE self, VALUE channel_arg, VALUE depth) | |
| 12140 12638 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12141 12639 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12142 12640 | 
             
                BEGIN_CHANNEL_MASK(image, channel);
         | 
| 12143 | 
            -
                SetImageDepth | 
| 12641 | 
            +
                GVL_STRUCT_TYPE(SetImageDepth) args = { image, channel_depth, exception };
         | 
| 12642 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageDepth), &args);
         | 
| 12144 12643 | 
             
                END_CHANNEL_MASK(image);
         | 
| 12145 12644 | 
             
                CHECK_EXCEPTION();
         | 
| 12146 12645 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12147 12646 | 
             
            #else
         | 
| 12148 | 
            -
                SetImageChannelDepth | 
| 12647 | 
            +
                GVL_STRUCT_TYPE(SetImageChannelDepth) args = { image, channel, channel_depth };
         | 
| 12648 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageChannelDepth), &args);
         | 
| 12149 12649 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 12150 12650 | 
             
            #endif
         | 
| 12151 12651 |  | 
| @@ -12183,11 +12683,13 @@ Image_separate(int argc, VALUE *argv, VALUE self) | |
| 12183 12683 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12184 12684 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12185 12685 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 12186 | 
            -
                 | 
| 12686 | 
            +
                GVL_STRUCT_TYPE(SeparateImages) args = { image, exception };
         | 
| 12687 | 
            +
                new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SeparateImages), &args);
         | 
| 12187 12688 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_images);
         | 
| 12188 12689 | 
             
                END_CHANNEL_MASK(image);
         | 
| 12189 12690 | 
             
            #else
         | 
| 12190 | 
            -
                 | 
| 12691 | 
            +
                GVL_STRUCT_TYPE(SeparateImages) args = { image, channels, exception };
         | 
| 12692 | 
            +
                new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SeparateImages), &args);
         | 
| 12191 12693 | 
             
            #endif
         | 
| 12192 12694 | 
             
                rm_check_exception(exception, new_images, DestroyOnError);
         | 
| 12193 12695 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -12226,7 +12728,8 @@ Image_sepiatone(int argc, VALUE *argv, VALUE self) | |
| 12226 12728 | 
             
                }
         | 
| 12227 12729 |  | 
| 12228 12730 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12229 | 
            -
                 | 
| 12731 | 
            +
                GVL_STRUCT_TYPE(SepiaToneImage) args = { image, threshold, exception };
         | 
| 12732 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SepiaToneImage), &args);
         | 
| 12230 12733 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12231 12734 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12232 12735 |  | 
| @@ -12284,11 +12787,13 @@ Image_segment(int argc, VALUE *argv, VALUE self) | |
| 12284 12787 |  | 
| 12285 12788 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12286 12789 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12287 | 
            -
                SegmentImage | 
| 12790 | 
            +
                GVL_STRUCT_TYPE(SegmentImage) args = { new_image, colorspace, verbose, cluster_threshold, smoothing_threshold, exception };
         | 
| 12791 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SegmentImage), &args);
         | 
| 12288 12792 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12289 12793 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12290 12794 | 
             
            #else
         | 
| 12291 | 
            -
                SegmentImage | 
| 12795 | 
            +
                GVL_STRUCT_TYPE(SegmentImage) args = { new_image, colorspace, verbose, cluster_threshold, smoothing_threshold };
         | 
| 12796 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SegmentImage), &args);
         | 
| 12292 12797 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 12293 12798 | 
             
            #endif
         | 
| 12294 12799 |  | 
| @@ -12424,7 +12929,8 @@ Image_shade(int argc, VALUE *argv, VALUE self) | |
| 12424 12929 | 
             
                }
         | 
| 12425 12930 |  | 
| 12426 12931 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12427 | 
            -
                 | 
| 12932 | 
            +
                GVL_STRUCT_TYPE(ShadeImage) args = { image, shading, azimuth, elevation, exception };
         | 
| 12933 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ShadeImage), &args);
         | 
| 12428 12934 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12429 12935 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12430 12936 |  | 
| @@ -12482,7 +12988,8 @@ Image_shadow(int argc, VALUE *argv, VALUE self) | |
| 12482 12988 | 
             
                }
         | 
| 12483 12989 |  | 
| 12484 12990 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12485 | 
            -
                 | 
| 12991 | 
            +
                GVL_STRUCT_TYPE(ShadowImage) args = { image, alpha, sigma, x_offset, y_offset, exception };
         | 
| 12992 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ShadowImage), &args);
         | 
| 12486 12993 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12487 12994 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12488 12995 |  | 
| @@ -12501,7 +13008,7 @@ Image_shadow(int argc, VALUE *argv, VALUE self) | |
| 12501 13008 | 
             
            VALUE
         | 
| 12502 13009 | 
             
            Image_sharpen(int argc, VALUE *argv, VALUE self)
         | 
| 12503 13010 | 
             
            {
         | 
| 12504 | 
            -
                return effect_image(self, argc, argv, SharpenImage);
         | 
| 13011 | 
            +
                return effect_image(self, argc, argv, GVL_FUNC(SharpenImage));
         | 
| 12505 13012 | 
             
            }
         | 
| 12506 13013 |  | 
| 12507 13014 |  | 
| @@ -12549,11 +13056,13 @@ Image_sharpen_channel(int argc, VALUE *argv, VALUE self) | |
| 12549 13056 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12550 13057 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12551 13058 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 12552 | 
            -
                 | 
| 13059 | 
            +
                GVL_STRUCT_TYPE(SharpenImage) args = { image, radius, sigma, exception };
         | 
| 13060 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SharpenImage), &args);
         | 
| 12553 13061 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 12554 13062 | 
             
                END_CHANNEL_MASK(image);
         | 
| 12555 13063 | 
             
            #else
         | 
| 12556 | 
            -
                 | 
| 13064 | 
            +
                GVL_STRUCT_TYPE(SharpenImageChannel) args = { image, channels, radius, sigma, exception };
         | 
| 13065 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SharpenImageChannel), &args);
         | 
| 12557 13066 | 
             
            #endif
         | 
| 12558 13067 |  | 
| 12559 13068 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| @@ -12576,7 +13085,7 @@ VALUE | |
| 12576 13085 | 
             
            Image_shave(VALUE self, VALUE width, VALUE height)
         | 
| 12577 13086 | 
             
            {
         | 
| 12578 13087 | 
             
                rm_check_destroyed(self);
         | 
| 12579 | 
            -
                return xform_image(False, self, INT2FIX(0), INT2FIX(0), width, height, ShaveImage);
         | 
| 13088 | 
            +
                return xform_image(False, self, INT2FIX(0), INT2FIX(0), width, height, GVL_FUNC(ShaveImage));
         | 
| 12580 13089 | 
             
            }
         | 
| 12581 13090 |  | 
| 12582 13091 |  | 
| @@ -12594,7 +13103,7 @@ VALUE | |
| 12594 13103 | 
             
            Image_shave_bang(VALUE self, VALUE width, VALUE height)
         | 
| 12595 13104 | 
             
            {
         | 
| 12596 13105 | 
             
                rm_check_frozen(self);
         | 
| 12597 | 
            -
                return xform_image(True, self, INT2FIX(0), INT2FIX(0), width, height, ShaveImage);
         | 
| 13106 | 
            +
                return xform_image(True, self, INT2FIX(0), INT2FIX(0), width, height, GVL_FUNC(ShaveImage));
         | 
| 12598 13107 | 
             
            }
         | 
| 12599 13108 |  | 
| 12600 13109 |  | 
| @@ -12621,7 +13130,8 @@ Image_shear(VALUE self, VALUE x_shear, VALUE y_shear) | |
| 12621 13130 | 
             
                image = rm_check_destroyed(self);
         | 
| 12622 13131 |  | 
| 12623 13132 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12624 | 
            -
                 | 
| 13133 | 
            +
                GVL_STRUCT_TYPE(ShearImage) args = { image, x, y, exception };
         | 
| 13134 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ShearImage), &args);
         | 
| 12625 13135 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12626 13136 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12627 13137 |  | 
| @@ -12692,12 +13202,14 @@ Image_sigmoidal_contrast_channel(int argc, VALUE *argv, VALUE self) | |
| 12692 13202 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12693 13203 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12694 13204 | 
             
                BEGIN_CHANNEL_MASK(new_image, channels);
         | 
| 12695 | 
            -
                SigmoidalContrastImage | 
| 13205 | 
            +
                GVL_STRUCT_TYPE(SigmoidalContrastImage) args = { new_image, sharpen, contrast, midpoint, exception };
         | 
| 13206 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SigmoidalContrastImage), &args);
         | 
| 12696 13207 | 
             
                END_CHANNEL_MASK(new_image);
         | 
| 12697 13208 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12698 13209 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12699 13210 | 
             
            #else
         | 
| 12700 | 
            -
                SigmoidalContrastImageChannel | 
| 13211 | 
            +
                GVL_STRUCT_TYPE(SigmoidalContrastImageChannel) args = { new_image, channels, sharpen, contrast, midpoint };
         | 
| 13212 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SigmoidalContrastImageChannel), &args);
         | 
| 12701 13213 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 12702 13214 | 
             
            #endif
         | 
| 12703 13215 |  | 
| @@ -12724,11 +13236,13 @@ Image_signature(VALUE self) | |
| 12724 13236 |  | 
| 12725 13237 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12726 13238 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12727 | 
            -
                SignatureImage | 
| 13239 | 
            +
                GVL_STRUCT_TYPE(SignatureImage) args = { image, exception };
         | 
| 13240 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args);
         | 
| 12728 13241 | 
             
                CHECK_EXCEPTION();
         | 
| 12729 13242 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12730 13243 | 
             
            #else
         | 
| 12731 | 
            -
                SignatureImage | 
| 13244 | 
            +
                GVL_STRUCT_TYPE(SignatureImage) args = { image };
         | 
| 13245 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args);
         | 
| 12732 13246 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 12733 13247 | 
             
            #endif
         | 
| 12734 13248 | 
             
                signature = rm_get_property(image, "signature");
         | 
| @@ -12754,7 +13268,7 @@ VALUE | |
| 12754 13268 | 
             
            Image_sketch(int argc, VALUE *argv, VALUE self)
         | 
| 12755 13269 | 
             
            {
         | 
| 12756 13270 | 
             
                rm_check_destroyed(self);
         | 
| 12757 | 
            -
                return motion_blur(argc, argv, self, SketchImage);
         | 
| 13271 | 
            +
                return motion_blur(argc, argv, self, GVL_FUNC(SketchImage));
         | 
| 12758 13272 | 
             
            }
         | 
| 12759 13273 |  | 
| 12760 13274 |  | 
| @@ -12797,11 +13311,13 @@ Image_solarize(int argc, VALUE *argv, VALUE self) | |
| 12797 13311 |  | 
| 12798 13312 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12799 13313 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12800 | 
            -
                SolarizeImage | 
| 13314 | 
            +
                GVL_STRUCT_TYPE(SolarizeImage) args = { new_image, threshold, exception };
         | 
| 13315 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SolarizeImage), &args);
         | 
| 12801 13316 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 12802 13317 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12803 13318 | 
             
            #else
         | 
| 12804 | 
            -
                SolarizeImage | 
| 13319 | 
            +
                GVL_STRUCT_TYPE(SolarizeImage) args = { new_image, threshold };
         | 
| 13320 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SolarizeImage), &args);
         | 
| 12805 13321 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 12806 13322 | 
             
            #endif
         | 
| 12807 13323 |  | 
| @@ -12837,14 +13353,18 @@ Image_spaceship(VALUE self, VALUE other) | |
| 12837 13353 |  | 
| 12838 13354 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 12839 13355 | 
             
                exception = AcquireExceptionInfo();
         | 
| 12840 | 
            -
                SignatureImage | 
| 13356 | 
            +
                GVL_STRUCT_TYPE(SignatureImage) args1 = { imageA, exception };
         | 
| 13357 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args1);
         | 
| 12841 13358 | 
             
                CHECK_EXCEPTION();
         | 
| 12842 | 
            -
                SignatureImage | 
| 13359 | 
            +
                GVL_STRUCT_TYPE(SignatureImage) args2 = { imageB, exception };
         | 
| 13360 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args2);
         | 
| 12843 13361 | 
             
                CHECK_EXCEPTION();
         | 
| 12844 13362 | 
             
                DestroyExceptionInfo(exception);
         | 
| 12845 13363 | 
             
            #else
         | 
| 12846 | 
            -
                SignatureImage | 
| 12847 | 
            -
                SignatureImage | 
| 13364 | 
            +
                GVL_STRUCT_TYPE(SignatureImage) args1 = { imageA };
         | 
| 13365 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args1);
         | 
| 13366 | 
            +
                GVL_STRUCT_TYPE(SignatureImage) args2 = { imageB };
         | 
| 13367 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SignatureImage), &args2);
         | 
| 12848 13368 | 
             
            #endif
         | 
| 12849 13369 | 
             
                sigA = rm_get_property(imageA, "signature");
         | 
| 12850 13370 | 
             
                sigB = rm_get_property(imageB, "signature");
         | 
| @@ -13021,11 +13541,13 @@ Image_sparse_color(int argc, VALUE *argv, VALUE self) | |
| 13021 13541 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13022 13542 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13023 13543 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 13024 | 
            -
                 | 
| 13544 | 
            +
                GVL_STRUCT_TYPE(SparseColorImage) args_SparseColorImage = { image, method, nargs, args, exception };
         | 
| 13545 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SparseColorImage), &args_SparseColorImage);
         | 
| 13025 13546 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 13026 13547 | 
             
                END_CHANNEL_MASK(image);
         | 
| 13027 13548 | 
             
            #else
         | 
| 13028 | 
            -
                 | 
| 13549 | 
            +
                GVL_STRUCT_TYPE(SparseColorImage) args_SparseColorImage = { image, channels, method, nargs, args, exception };
         | 
| 13550 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SparseColorImage), &args_SparseColorImage);
         | 
| 13029 13551 | 
             
            #endif
         | 
| 13030 13552 | 
             
                xfree((void *) args);
         | 
| 13031 13553 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| @@ -13084,7 +13606,8 @@ Image_splice(int argc, VALUE *argv, VALUE self) | |
| 13084 13606 | 
             
                // Swap in color for the duration of this call.
         | 
| 13085 13607 | 
             
                old_color = image->background_color;
         | 
| 13086 13608 | 
             
                image->background_color = color;
         | 
| 13087 | 
            -
                 | 
| 13609 | 
            +
                GVL_STRUCT_TYPE(SpliceImage) args = { image, &rectangle, exception };
         | 
| 13610 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SpliceImage), &args);
         | 
| 13088 13611 | 
             
                image->background_color = old_color;
         | 
| 13089 13612 |  | 
| 13090 13613 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| @@ -13122,10 +13645,11 @@ Image_spread(int argc, VALUE *argv, VALUE self) | |
| 13122 13645 |  | 
| 13123 13646 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13124 13647 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13125 | 
            -
                 | 
| 13648 | 
            +
                GVL_STRUCT_TYPE(SpreadImage) args = { image, image->interpolate, radius, exception };
         | 
| 13126 13649 | 
             
            #else
         | 
| 13127 | 
            -
                 | 
| 13650 | 
            +
                GVL_STRUCT_TYPE(SpreadImage) args = { image, radius, exception };
         | 
| 13128 13651 | 
             
            #endif
         | 
| 13652 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SpreadImage), &args);
         | 
| 13129 13653 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13130 13654 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13131 13655 |  | 
| @@ -13141,7 +13665,7 @@ Image_spread(int argc, VALUE *argv, VALUE self) | |
| 13141 13665 | 
             
            VALUE
         | 
| 13142 13666 | 
             
            Image_start_loop(VALUE self)
         | 
| 13143 13667 | 
             
            {
         | 
| 13144 | 
            -
                 | 
| 13668 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, start_loop, boolean, &rm_image_data_type);
         | 
| 13145 13669 | 
             
            }
         | 
| 13146 13670 |  | 
| 13147 13671 | 
             
            /**
         | 
| @@ -13153,7 +13677,7 @@ Image_start_loop(VALUE self) | |
| 13153 13677 | 
             
            VALUE
         | 
| 13154 13678 | 
             
            Image_start_loop_eq(VALUE self, VALUE val)
         | 
| 13155 13679 | 
             
            {
         | 
| 13156 | 
            -
                 | 
| 13680 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, start_loop, boolean, &rm_image_data_type);
         | 
| 13157 13681 | 
             
            }
         | 
| 13158 13682 |  | 
| 13159 13683 |  | 
| @@ -13185,7 +13709,8 @@ Image_stegano(VALUE self, VALUE watermark_image, VALUE offset) | |
| 13185 13709 | 
             
                image->offset = NUM2LONG(offset);
         | 
| 13186 13710 |  | 
| 13187 13711 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13188 | 
            -
                 | 
| 13712 | 
            +
                GVL_STRUCT_TYPE(SteganoImage) args = { image, watermark, exception };
         | 
| 13713 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SteganoImage), &args);
         | 
| 13189 13714 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13190 13715 |  | 
| 13191 13716 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -13217,7 +13742,8 @@ Image_stereo(VALUE self, VALUE offset_image_arg) | |
| 13217 13742 | 
             
                offset = rm_check_destroyed(offset_image);
         | 
| 13218 13743 |  | 
| 13219 13744 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13220 | 
            -
                 | 
| 13745 | 
            +
                GVL_STRUCT_TYPE(StereoImage) args = { image, offset, exception };
         | 
| 13746 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(StereoImage), &args);
         | 
| 13221 13747 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13222 13748 |  | 
| 13223 13749 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -13275,10 +13801,12 @@ Image_class_type_eq(VALUE self, VALUE new_class_type) | |
| 13275 13801 | 
             
                if (image->storage_class == PseudoClass && class_type == DirectClass)
         | 
| 13276 13802 | 
             
                {
         | 
| 13277 13803 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13278 | 
            -
                    SyncImage | 
| 13804 | 
            +
                    GVL_STRUCT_TYPE(SyncImage) args = { image, exception };
         | 
| 13805 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncImage), &args);
         | 
| 13279 13806 | 
             
                    CHECK_EXCEPTION();
         | 
| 13280 13807 | 
             
            #else
         | 
| 13281 | 
            -
                    SyncImage | 
| 13808 | 
            +
                    GVL_STRUCT_TYPE(SyncImage) args = { image };
         | 
| 13809 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncImage), &args);
         | 
| 13282 13810 | 
             
            #endif
         | 
| 13283 13811 | 
             
                    magick_free(image->colormap);
         | 
| 13284 13812 | 
             
                    image->colormap = NULL;
         | 
| @@ -13288,19 +13816,23 @@ Image_class_type_eq(VALUE self, VALUE new_class_type) | |
| 13288 13816 | 
             
                    GetQuantizeInfo(&qinfo);
         | 
| 13289 13817 | 
             
                    qinfo.number_colors = QuantumRange+1;
         | 
| 13290 13818 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13291 | 
            -
                    QuantizeImage | 
| 13819 | 
            +
                    GVL_STRUCT_TYPE(QuantizeImage) args = { &qinfo, image, exception };
         | 
| 13820 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImage), &args);
         | 
| 13292 13821 | 
             
                    CHECK_EXCEPTION();
         | 
| 13293 13822 | 
             
            #else
         | 
| 13294 | 
            -
                    QuantizeImage | 
| 13823 | 
            +
                    GVL_STRUCT_TYPE(QuantizeImage) args = { &qinfo, image };
         | 
| 13824 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImage), &args);
         | 
| 13295 13825 | 
             
            #endif
         | 
| 13296 13826 | 
             
                }
         | 
| 13297 13827 |  | 
| 13298 13828 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13299 | 
            -
                SetImageStorageClass | 
| 13829 | 
            +
                GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, class_type, exception };
         | 
| 13830 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 13300 13831 | 
             
                CHECK_EXCEPTION();
         | 
| 13301 13832 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13302 13833 | 
             
            #else
         | 
| 13303 | 
            -
                SetImageStorageClass | 
| 13834 | 
            +
                GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, class_type };
         | 
| 13835 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 13304 13836 | 
             
            #endif
         | 
| 13305 13837 | 
             
                return new_class_type;
         | 
| 13306 13838 | 
             
            }
         | 
| @@ -13329,7 +13861,7 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, | |
| 13329 13861 | 
             
                long n, size;
         | 
| 13330 13862 | 
             
                long x, y;
         | 
| 13331 13863 | 
             
                unsigned long cols, rows;
         | 
| 13332 | 
            -
                 | 
| 13864 | 
            +
                MagickBooleanType okay;
         | 
| 13333 13865 | 
             
                ExceptionInfo *exception;
         | 
| 13334 13866 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13335 13867 | 
             
                Quantum *pixels;
         | 
| @@ -13355,7 +13887,8 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, | |
| 13355 13887 |  | 
| 13356 13888 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13357 13889 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13358 | 
            -
                 | 
| 13890 | 
            +
                GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass, exception };
         | 
| 13891 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 13359 13892 | 
             
                CHECK_EXCEPTION();
         | 
| 13360 13893 | 
             
                if (!okay)
         | 
| 13361 13894 | 
             
                {
         | 
| @@ -13363,7 +13896,8 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, | |
| 13363 13896 | 
             
                    rb_raise(Class_ImageMagickError, "SetImageStorageClass failed. Can't store pixels.");
         | 
| 13364 13897 | 
             
                }
         | 
| 13365 13898 | 
             
            #else
         | 
| 13366 | 
            -
                 | 
| 13899 | 
            +
                GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, DirectClass };
         | 
| 13900 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
         | 
| 13367 13901 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 13368 13902 | 
             
                if (!okay)
         | 
| 13369 13903 | 
             
                {
         | 
| @@ -13375,7 +13909,8 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, | |
| 13375 13909 | 
             
                // Get a pointer to the pixels. Replace the values with the PixelPackets
         | 
| 13376 13910 | 
             
                // from the pixels argument.
         | 
| 13377 13911 | 
             
                {
         | 
| 13378 | 
            -
                     | 
| 13912 | 
            +
                    GVL_STRUCT_TYPE(GetAuthenticPixels) args = { image, x, y, cols, rows, exception };
         | 
| 13913 | 
            +
                    pixels = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetAuthenticPixels), &args);
         | 
| 13379 13914 | 
             
                    CHECK_EXCEPTION();
         | 
| 13380 13915 |  | 
| 13381 13916 | 
             
                    if (pixels)
         | 
| @@ -13391,7 +13926,7 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, | |
| 13391 13926 | 
             
                                DestroyExceptionInfo(exception);
         | 
| 13392 13927 | 
             
                                rb_raise(rb_eTypeError, "Item in array should be a Pixel.");
         | 
| 13393 13928 | 
             
                            }
         | 
| 13394 | 
            -
                             | 
| 13929 | 
            +
                            TypedData_Get_Struct(new_pixel, Pixel, &rm_pixel_data_type, pixel);
         | 
| 13395 13930 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13396 13931 | 
             
                            SetPixelRed(image,   pixel->red,   pixels);
         | 
| 13397 13932 | 
             
                            SetPixelGreen(image, pixel->green, pixels);
         | 
| @@ -13411,7 +13946,8 @@ Image_store_pixels(VALUE self, VALUE x_arg, VALUE y_arg, VALUE cols_arg, | |
| 13411 13946 | 
             
                            pixels++;
         | 
| 13412 13947 | 
             
            #endif
         | 
| 13413 13948 | 
             
                        }
         | 
| 13414 | 
            -
                        SyncAuthenticPixels | 
| 13949 | 
            +
                        GVL_STRUCT_TYPE(SyncAuthenticPixels) args = { image, exception };
         | 
| 13950 | 
            +
                        CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args);
         | 
| 13415 13951 | 
             
                        CHECK_EXCEPTION();
         | 
| 13416 13952 | 
             
                    }
         | 
| 13417 13953 |  | 
| @@ -13471,10 +14007,11 @@ Image_swirl(VALUE self, VALUE degrees_obj) | |
| 13471 14007 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13472 14008 |  | 
| 13473 14009 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13474 | 
            -
                 | 
| 14010 | 
            +
                GVL_STRUCT_TYPE(SwirlImage) args = { image, degrees, image->interpolate, exception };
         | 
| 13475 14011 | 
             
            #else
         | 
| 13476 | 
            -
                 | 
| 14012 | 
            +
                GVL_STRUCT_TYPE(SwirlImage) args = { image, degrees, exception };
         | 
| 13477 14013 | 
             
            #endif
         | 
| 14014 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SwirlImage), &args);
         | 
| 13478 14015 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13479 14016 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13480 14017 |  | 
| @@ -13565,12 +14102,14 @@ Image_texture_flood_fill(VALUE self, VALUE color_obj, VALUE texture_obj, | |
| 13565 14102 |  | 
| 13566 14103 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13567 14104 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13568 | 
            -
                FloodfillPaintImage | 
| 14105 | 
            +
                GVL_STRUCT_TYPE(FloodfillPaintImage) args = { new_image, draw_info, &color_mpp, x, y, invert, exception };
         | 
| 14106 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FloodfillPaintImage), &args);
         | 
| 13569 14107 | 
             
                DestroyDrawInfo(draw_info);
         | 
| 13570 14108 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13571 14109 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13572 14110 | 
             
            #else
         | 
| 13573 | 
            -
                FloodfillPaintImage | 
| 14111 | 
            +
                GVL_STRUCT_TYPE(FloodfillPaintImage) args = { new_image, DefaultChannels, draw_info, &color_mpp, x, y, invert };
         | 
| 14112 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FloodfillPaintImage), &args);
         | 
| 13574 14113 |  | 
| 13575 14114 | 
             
                DestroyDrawInfo(draw_info);
         | 
| 13576 14115 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| @@ -13603,11 +14142,13 @@ Image_threshold(VALUE self, VALUE threshold_obj) | |
| 13603 14142 |  | 
| 13604 14143 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13605 14144 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13606 | 
            -
                BilevelImage | 
| 14145 | 
            +
                GVL_STRUCT_TYPE(BilevelImage) args = { new_image, threshold, exception };
         | 
| 14146 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BilevelImage), &args);
         | 
| 13607 14147 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13608 14148 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13609 14149 | 
             
            #else
         | 
| 13610 | 
            -
                BilevelImageChannel | 
| 14150 | 
            +
                GVL_STRUCT_TYPE(BilevelImageChannel) args = { new_image, DefaultChannels, threshold };
         | 
| 14151 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BilevelImageChannel), &args);
         | 
| 13611 14152 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 13612 14153 | 
             
            #endif
         | 
| 13613 14154 |  | 
| @@ -13615,6 +14156,9 @@ Image_threshold(VALUE self, VALUE threshold_obj) | |
| 13615 14156 | 
             
            }
         | 
| 13616 14157 |  | 
| 13617 14158 |  | 
| 14159 | 
            +
            // aliases for common use of structure types; WhiteThresholdImage
         | 
| 14160 | 
            +
            typedef GVL_STRUCT_TYPE(WhiteThresholdImage) GVL_STRUCT_TYPE(threshold_image);
         | 
| 14161 | 
            +
             | 
| 13618 14162 | 
             
            /**
         | 
| 13619 14163 | 
             
             * Call one of the xxxxThresholdImage methods.
         | 
| 13620 14164 | 
             
             *
         | 
| @@ -13626,8 +14170,8 @@ Image_threshold(VALUE self, VALUE threshold_obj) | |
| 13626 14170 | 
             
             * @param thresholder which xxxxThresholdImage method to call
         | 
| 13627 14171 | 
             
             * @return a new image
         | 
| 13628 14172 | 
             
             */
         | 
| 13629 | 
            -
            static
         | 
| 13630 | 
            -
             | 
| 14173 | 
            +
            static VALUE
         | 
| 14174 | 
            +
            threshold_image(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
         | 
| 13631 14175 | 
             
            {
         | 
| 13632 14176 | 
             
                Image *image, *new_image;
         | 
| 13633 14177 | 
             
                double red, green, blue, alpha;
         | 
| @@ -13670,11 +14214,13 @@ VALUE threshold_image(int argc, VALUE *argv, VALUE self, thresholder_t threshold | |
| 13670 14214 |  | 
| 13671 14215 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13672 14216 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13673 | 
            -
                ( | 
| 14217 | 
            +
                GVL_STRUCT_TYPE(threshold_image) args = { new_image, ctarg, exception };
         | 
| 14218 | 
            +
                CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 13674 14219 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13675 14220 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13676 14221 | 
             
            #else
         | 
| 13677 | 
            -
                ( | 
| 14222 | 
            +
                GVL_STRUCT_TYPE(threshold_image) args = { new_image, ctarg };
         | 
| 14223 | 
            +
                CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 13678 14224 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 13679 14225 | 
             
            #endif
         | 
| 13680 14226 |  | 
| @@ -13708,7 +14254,7 @@ thumbnail(int bang, int argc, VALUE *argv, VALUE self) | |
| 13708 14254 | 
             
                RectangleInfo geometry;
         | 
| 13709 14255 | 
             
                ExceptionInfo *exception;
         | 
| 13710 14256 |  | 
| 13711 | 
            -
                 | 
| 14257 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 13712 14258 |  | 
| 13713 14259 | 
             
                switch (argc)
         | 
| 13714 14260 | 
             
                {
         | 
| @@ -13746,7 +14292,8 @@ thumbnail(int bang, int argc, VALUE *argv, VALUE self) | |
| 13746 14292 | 
             
                ParseRegionGeometry(image, image_geometry, &geometry, exception);
         | 
| 13747 14293 | 
             
                rm_check_exception(exception, image, RetainOnError);
         | 
| 13748 14294 |  | 
| 13749 | 
            -
                 | 
| 14295 | 
            +
                GVL_STRUCT_TYPE(ThumbnailImage) args = { image, geometry.width, geometry.height, exception };
         | 
| 14296 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ThumbnailImage), &args);
         | 
| 13750 14297 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13751 14298 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13752 14299 |  | 
| @@ -13904,10 +14451,11 @@ Image_tint(int argc, VALUE *argv, VALUE self) | |
| 13904 14451 | 
             
                exception = AcquireExceptionInfo();
         | 
| 13905 14452 |  | 
| 13906 14453 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13907 | 
            -
                 | 
| 14454 | 
            +
                GVL_STRUCT_TYPE(TintImage) args = { image, alpha, &tint, exception };
         | 
| 13908 14455 | 
             
            #else
         | 
| 13909 | 
            -
                 | 
| 14456 | 
            +
                GVL_STRUCT_TYPE(TintImage) args = { image, alpha, tint, exception };
         | 
| 13910 14457 | 
             
            #endif
         | 
| 14458 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TintImage), &args);
         | 
| 13911 14459 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 13912 14460 | 
             
                DestroyExceptionInfo(exception);
         | 
| 13913 14461 |  | 
| @@ -13940,7 +14488,7 @@ Image_to_blob(VALUE self) | |
| 13940 14488 | 
             
                // both) and the image format by setting the depth and format
         | 
| 13941 14489 | 
             
                // values in the info parm block.
         | 
| 13942 14490 | 
             
                info_obj = rm_info_new();
         | 
| 13943 | 
            -
                 | 
| 14491 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 13944 14492 |  | 
| 13945 14493 | 
             
                image = rm_check_destroyed(self);
         | 
| 13946 14494 |  | 
| @@ -13950,10 +14498,12 @@ Image_to_blob(VALUE self) | |
| 13950 14498 | 
             
                if (info->depth != 0)
         | 
| 13951 14499 | 
             
                {
         | 
| 13952 14500 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 13953 | 
            -
                    SetImageDepth | 
| 14501 | 
            +
                    GVL_STRUCT_TYPE(SetImageDepth) args = { image, info->depth, exception };
         | 
| 14502 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageDepth), &args);
         | 
| 13954 14503 | 
             
                    CHECK_EXCEPTION();
         | 
| 13955 14504 | 
             
            #else
         | 
| 13956 | 
            -
                    SetImageDepth | 
| 14505 | 
            +
                    GVL_STRUCT_TYPE(SetImageDepth) args = { image, info->depth };
         | 
| 14506 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageDepth), &args);
         | 
| 13957 14507 | 
             
                    rm_check_image_exception(image, RetainOnError);
         | 
| 13958 14508 | 
             
            #endif
         | 
| 13959 14509 | 
             
                }
         | 
| @@ -13987,7 +14537,8 @@ Image_to_blob(VALUE self) | |
| 13987 14537 |  | 
| 13988 14538 | 
             
                rm_sync_image_options(image, info);
         | 
| 13989 14539 |  | 
| 13990 | 
            -
                 | 
| 14540 | 
            +
                GVL_STRUCT_TYPE(ImageToBlob) args = { info, image, &length, exception };
         | 
| 14541 | 
            +
                blob = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImageToBlob), &args);
         | 
| 13991 14542 | 
             
                CHECK_EXCEPTION();
         | 
| 13992 14543 |  | 
| 13993 14544 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -14133,11 +14684,13 @@ Image_transparent(int argc, VALUE *argv, VALUE self) | |
| 14133 14684 |  | 
| 14134 14685 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 14135 14686 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14136 | 
            -
                 | 
| 14687 | 
            +
                GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, &color, alpha, MagickFalse, exception };
         | 
| 14688 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args);
         | 
| 14137 14689 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14138 14690 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14139 14691 | 
             
            #else
         | 
| 14140 | 
            -
                 | 
| 14692 | 
            +
                GVL_STRUCT_TYPE(TransparentPaintImage) args = { new_image, &color, QuantumRange - alpha, MagickFalse };
         | 
| 14693 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImage), &args);
         | 
| 14141 14694 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 14142 14695 | 
             
            #endif
         | 
| 14143 14696 | 
             
                if (!okay)
         | 
| @@ -14207,11 +14760,13 @@ Image_transparent_chroma(int argc, VALUE *argv, VALUE self) | |
| 14207 14760 |  | 
| 14208 14761 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 14209 14762 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14210 | 
            -
                 | 
| 14763 | 
            +
                GVL_STRUCT_TYPE(TransparentPaintImageChroma) args = { new_image, &low, &high, alpha, invert, exception };
         | 
| 14764 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImageChroma), &args);
         | 
| 14211 14765 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14212 14766 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14213 14767 | 
             
            #else
         | 
| 14214 | 
            -
                 | 
| 14768 | 
            +
                GVL_STRUCT_TYPE(TransparentPaintImageChroma) args = { new_image, &low, &high, QuantumRange - alpha, invert };
         | 
| 14769 | 
            +
                okay = (MagickBooleanType)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransparentPaintImageChroma), &args);
         | 
| 14215 14770 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 14216 14771 | 
             
            #endif
         | 
| 14217 14772 | 
             
                if (!okay)
         | 
| @@ -14264,7 +14819,7 @@ VALUE | |
| 14264 14819 | 
             
            Image_transpose(VALUE self)
         | 
| 14265 14820 | 
             
            {
         | 
| 14266 14821 | 
             
                rm_check_destroyed(self);
         | 
| 14267 | 
            -
                return crisscross(False, self, TransposeImage);
         | 
| 14822 | 
            +
                return crisscross(False, self, GVL_FUNC(TransposeImage));
         | 
| 14268 14823 | 
             
            }
         | 
| 14269 14824 |  | 
| 14270 14825 |  | 
| @@ -14280,7 +14835,7 @@ VALUE | |
| 14280 14835 | 
             
            Image_transpose_bang(VALUE self)
         | 
| 14281 14836 | 
             
            {
         | 
| 14282 14837 | 
             
                rm_check_frozen(self);
         | 
| 14283 | 
            -
                return crisscross(True, self, TransposeImage);
         | 
| 14838 | 
            +
                return crisscross(True, self, GVL_FUNC(TransposeImage));
         | 
| 14284 14839 | 
             
            }
         | 
| 14285 14840 |  | 
| 14286 14841 |  | 
| @@ -14295,7 +14850,7 @@ VALUE | |
| 14295 14850 | 
             
            Image_transverse(VALUE self)
         | 
| 14296 14851 | 
             
            {
         | 
| 14297 14852 | 
             
                rm_check_destroyed(self);
         | 
| 14298 | 
            -
                return crisscross(False, self, TransverseImage);
         | 
| 14853 | 
            +
                return crisscross(False, self, GVL_FUNC(TransverseImage));
         | 
| 14299 14854 | 
             
            }
         | 
| 14300 14855 |  | 
| 14301 14856 | 
             
            /**
         | 
| @@ -14310,7 +14865,7 @@ VALUE | |
| 14310 14865 | 
             
            Image_transverse_bang(VALUE self)
         | 
| 14311 14866 | 
             
            {
         | 
| 14312 14867 | 
             
                rm_check_frozen(self);
         | 
| 14313 | 
            -
                return crisscross(True, self, TransverseImage);
         | 
| 14868 | 
            +
                return crisscross(True, self, GVL_FUNC(TransverseImage));
         | 
| 14314 14869 | 
             
            }
         | 
| 14315 14870 |  | 
| 14316 14871 |  | 
| @@ -14348,10 +14903,11 @@ trimmer(int bang, int argc, VALUE *argv, VALUE self) | |
| 14348 14903 | 
             
                        break;
         | 
| 14349 14904 | 
             
                }
         | 
| 14350 14905 |  | 
| 14351 | 
            -
                 | 
| 14906 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 14352 14907 |  | 
| 14353 14908 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14354 | 
            -
                 | 
| 14909 | 
            +
                GVL_STRUCT_TYPE(TrimImage) args = { image, exception };
         | 
| 14910 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TrimImage), &args);
         | 
| 14355 14911 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14356 14912 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14357 14913 |  | 
| @@ -14532,7 +15088,8 @@ Image_unique_colors(VALUE self) | |
| 14532 15088 | 
             
                image = rm_check_destroyed(self);
         | 
| 14533 15089 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14534 15090 |  | 
| 14535 | 
            -
                 | 
| 15091 | 
            +
                GVL_STRUCT_TYPE(UniqueImageColors) args = { image, exception };
         | 
| 15092 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UniqueImageColors), &args);
         | 
| 14536 15093 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14537 15094 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14538 15095 |  | 
| @@ -14698,7 +15255,8 @@ Image_unsharp_mask(int argc, VALUE *argv, VALUE self) | |
| 14698 15255 | 
             
                unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);
         | 
| 14699 15256 |  | 
| 14700 15257 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14701 | 
            -
                 | 
| 15258 | 
            +
                GVL_STRUCT_TYPE(UnsharpMaskImage) args = { image, radius, sigma, amount, threshold, exception };
         | 
| 15259 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnsharpMaskImage), &args);
         | 
| 14702 15260 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14703 15261 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14704 15262 |  | 
| @@ -14753,11 +15311,13 @@ Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self) | |
| 14753 15311 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14754 15312 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 14755 15313 | 
             
                BEGIN_CHANNEL_MASK(image, channels);
         | 
| 14756 | 
            -
                 | 
| 15314 | 
            +
                GVL_STRUCT_TYPE(UnsharpMaskImage) args = { image, radius, sigma, amount, threshold, exception };
         | 
| 15315 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnsharpMaskImage), &args);
         | 
| 14757 15316 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 14758 15317 | 
             
                END_CHANNEL_MASK(image);
         | 
| 14759 15318 | 
             
            #else
         | 
| 14760 | 
            -
                 | 
| 15319 | 
            +
                GVL_STRUCT_TYPE(UnsharpMaskImageChannel) args = { image, channels, radius, sigma, amount, threshold, exception };
         | 
| 15320 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnsharpMaskImageChannel), &args);
         | 
| 14761 15321 | 
             
            #endif
         | 
| 14762 15322 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14763 15323 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -14808,7 +15368,8 @@ Image_vignette(int argc, VALUE *argv, VALUE self) | |
| 14808 15368 |  | 
| 14809 15369 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14810 15370 |  | 
| 14811 | 
            -
                 | 
| 15371 | 
            +
                GVL_STRUCT_TYPE(VignetteImage) args = { image, radius, sigma, horz_radius, vert_radius, exception };
         | 
| 15372 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(VignetteImage), &args);
         | 
| 14812 15373 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14813 15374 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14814 15375 |  | 
| @@ -14954,11 +15515,13 @@ Image_watermark(int argc, VALUE *argv, VALUE self) | |
| 14954 15515 | 
             
                new_image = rm_clone_image(image);
         | 
| 14955 15516 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 14956 15517 | 
             
                exception = AcquireExceptionInfo();
         | 
| 14957 | 
            -
                CompositeImage | 
| 15518 | 
            +
                GVL_STRUCT_TYPE(CompositeImage) args = { new_image, overlay, ModulateCompositeOp, MagickTrue, x_offset, y_offset, exception };
         | 
| 15519 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 14958 15520 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 14959 15521 | 
             
                DestroyExceptionInfo(exception);
         | 
| 14960 15522 | 
             
            #else
         | 
| 14961 | 
            -
                CompositeImage | 
| 15523 | 
            +
                GVL_STRUCT_TYPE(CompositeImage) args = { new_image, ModulateCompositeOp, overlay, x_offset, y_offset };
         | 
| 15524 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeImage), &args);
         | 
| 14962 15525 |  | 
| 14963 15526 | 
             
                rm_check_image_exception(new_image, DestroyOnError);
         | 
| 14964 15527 | 
             
            #endif
         | 
| @@ -15001,10 +15564,11 @@ Image_wave(int argc, VALUE *argv, VALUE self) | |
| 15001 15564 |  | 
| 15002 15565 | 
             
                exception = AcquireExceptionInfo();
         | 
| 15003 15566 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 15004 | 
            -
                 | 
| 15567 | 
            +
                GVL_STRUCT_TYPE(WaveImage) args = { image, amplitude, wavelength, image->interpolate, exception };
         | 
| 15005 15568 | 
             
            #else
         | 
| 15006 | 
            -
                 | 
| 15569 | 
            +
                GVL_STRUCT_TYPE(WaveImage) args = { image, amplitude, wavelength, exception };
         | 
| 15007 15570 | 
             
            #endif
         | 
| 15571 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WaveImage), &args);
         | 
| 15008 15572 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 15009 15573 | 
             
                DestroyExceptionInfo(exception);
         | 
| 15010 15574 |  | 
| @@ -15100,7 +15664,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self) | |
| 15100 15664 |  | 
| 15101 15665 |  | 
| 15102 15666 | 
             
                exception = AcquireExceptionInfo();
         | 
| 15103 | 
            -
                 | 
| 15667 | 
            +
                GVL_STRUCT_TYPE(FlipImage) args_FlipImage = { image, exception };
         | 
| 15668 | 
            +
                flip_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(FlipImage), &args_FlipImage);
         | 
| 15104 15669 | 
             
                CHECK_EXCEPTION();
         | 
| 15105 15670 |  | 
| 15106 15671 |  | 
| @@ -15108,18 +15673,22 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self) | |
| 15108 15673 | 
             
                geometry.y = 0;
         | 
| 15109 15674 | 
             
                geometry.width = image->columns;
         | 
| 15110 15675 | 
             
                geometry.height = max_rows;
         | 
| 15111 | 
            -
                 | 
| 15676 | 
            +
                GVL_STRUCT_TYPE(CropImage) args_CropImage = { flip_image, &geometry, exception };
         | 
| 15677 | 
            +
                reflection = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CropImage), &args_CropImage);
         | 
| 15112 15678 | 
             
                DestroyImage(flip_image);
         | 
| 15113 15679 | 
             
                CHECK_EXCEPTION();
         | 
| 15114 15680 |  | 
| 15115 15681 |  | 
| 15116 15682 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 15117 | 
            -
                SetImageStorageClass | 
| 15683 | 
            +
                GVL_STRUCT_TYPE(SetImageStorageClass) args_SetImageStorageClass = { reflection, DirectClass, exception };
         | 
| 15684 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args_SetImageStorageClass);
         | 
| 15118 15685 | 
             
                rm_check_exception(exception, reflection, DestroyOnError);
         | 
| 15119 | 
            -
                SetImageAlphaChannel | 
| 15686 | 
            +
                GVL_STRUCT_TYPE(SetImageAlphaChannel) args_SetImageAlphaChannel = { reflection, ActivateAlphaChannel, exception };
         | 
| 15687 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageAlphaChannel), &args_SetImageAlphaChannel);
         | 
| 15120 15688 | 
             
                rm_check_exception(exception, reflection, DestroyOnError);
         | 
| 15121 15689 | 
             
            #else
         | 
| 15122 | 
            -
                SetImageStorageClass | 
| 15690 | 
            +
                GVL_STRUCT_TYPE(SetImageStorageClass) args_SetImageStorageClass = { reflection, DirectClass };
         | 
| 15691 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args_SetImageStorageClass);
         | 
| 15123 15692 | 
             
                rm_check_image_exception(reflection, DestroyOnError);
         | 
| 15124 15693 |  | 
| 15125 15694 |  | 
| @@ -15141,7 +15710,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self) | |
| 15141 15710 | 
             
                    }
         | 
| 15142 15711 | 
             
            #endif
         | 
| 15143 15712 |  | 
| 15144 | 
            -
                     | 
| 15713 | 
            +
                    GVL_STRUCT_TYPE(GetVirtualPixels) args_GetVirtualPixels = { reflection, 0, y, image->columns, 1, exception };
         | 
| 15714 | 
            +
                    p = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(GetVirtualPixels), &args_GetVirtualPixels);
         | 
| 15145 15715 | 
             
                    rm_check_exception(exception, reflection, DestroyOnError);
         | 
| 15146 15716 | 
             
                    if (!p)
         | 
| 15147 15717 | 
             
                    {
         | 
| @@ -15173,8 +15743,8 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self) | |
| 15173 15743 | 
             
            #endif
         | 
| 15174 15744 | 
             
                    }
         | 
| 15175 15745 |  | 
| 15176 | 
            -
             | 
| 15177 | 
            -
                    SyncAuthenticPixels | 
| 15746 | 
            +
                    GVL_STRUCT_TYPE(SyncAuthenticPixels) args_SyncAuthenticPixels = { reflection, exception };
         | 
| 15747 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncAuthenticPixels), &args_SyncAuthenticPixels);
         | 
| 15178 15748 | 
             
                    rm_check_exception(exception, reflection, DestroyOnError);
         | 
| 15179 15749 |  | 
| 15180 15750 | 
             
                    opacity += step;
         | 
| @@ -15207,7 +15777,7 @@ Image_wet_floor(int argc, VALUE *argv, VALUE self) | |
| 15207 15777 | 
             
            VALUE
         | 
| 15208 15778 | 
             
            Image_white_threshold(int argc, VALUE *argv, VALUE self)
         | 
| 15209 15779 | 
             
            {
         | 
| 15210 | 
            -
                return threshold_image(argc, argv, self, WhiteThresholdImage);
         | 
| 15780 | 
            +
                return threshold_image(argc, argv, self, GVL_FUNC(WhiteThresholdImage));
         | 
| 15211 15781 | 
             
            }
         | 
| 15212 15782 |  | 
| 15213 15783 |  | 
| @@ -15320,7 +15890,7 @@ Image_write(VALUE self, VALUE file) | |
| 15320 15890 | 
             
                image = rm_check_destroyed(self);
         | 
| 15321 15891 |  | 
| 15322 15892 | 
             
                info_obj = rm_info_new();
         | 
| 15323 | 
            -
                 | 
| 15893 | 
            +
                TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
         | 
| 15324 15894 |  | 
| 15325 15895 | 
             
                if (TYPE(file) == T_FILE)
         | 
| 15326 15896 | 
             
                {
         | 
| @@ -15350,11 +15920,13 @@ Image_write(VALUE self, VALUE file) | |
| 15350 15920 | 
             
                info->adjoin = MagickFalse;
         | 
| 15351 15921 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 15352 15922 | 
             
                exception = AcquireExceptionInfo();
         | 
| 15353 | 
            -
                WriteImage | 
| 15923 | 
            +
                GVL_STRUCT_TYPE(WriteImage) args = { info, image, exception };
         | 
| 15924 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WriteImage), &args);
         | 
| 15354 15925 | 
             
                CHECK_EXCEPTION();
         | 
| 15355 15926 | 
             
                DestroyExceptionInfo(exception);
         | 
| 15356 15927 | 
             
            #else
         | 
| 15357 | 
            -
                WriteImage | 
| 15928 | 
            +
                GVL_STRUCT_TYPE(WriteImage) args = { info, image };
         | 
| 15929 | 
            +
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WriteImage), &args);
         | 
| 15358 15930 | 
             
                rm_check_image_exception(image, RetainOnError);
         | 
| 15359 15931 | 
             
            #endif
         | 
| 15360 15932 |  | 
| @@ -15372,7 +15944,7 @@ Image_write(VALUE self, VALUE file) | |
| 15372 15944 | 
             
            VALUE
         | 
| 15373 15945 | 
             
            Image_x_resolution(VALUE self)
         | 
| 15374 15946 | 
             
            {
         | 
| 15375 | 
            -
                 | 
| 15947 | 
            +
                IMPLEMENT_TYPED_ATTR_READERF(Image, x_resolution, resolution.x, dbl, &rm_image_data_type);
         | 
| 15376 15948 | 
             
            }
         | 
| 15377 15949 |  | 
| 15378 15950 | 
             
            /**
         | 
| @@ -15384,7 +15956,7 @@ Image_x_resolution(VALUE self) | |
| 15384 15956 | 
             
            VALUE
         | 
| 15385 15957 | 
             
            Image_x_resolution_eq(VALUE self, VALUE val)
         | 
| 15386 15958 | 
             
            {
         | 
| 15387 | 
            -
                 | 
| 15959 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITERF(Image, x_resolution, resolution.x, dbl, &rm_image_data_type);
         | 
| 15388 15960 | 
             
            }
         | 
| 15389 15961 |  | 
| 15390 15962 | 
             
            /**
         | 
| @@ -15395,7 +15967,7 @@ Image_x_resolution_eq(VALUE self, VALUE val) | |
| 15395 15967 | 
             
            VALUE
         | 
| 15396 15968 | 
             
            Image_y_resolution(VALUE self)
         | 
| 15397 15969 | 
             
            {
         | 
| 15398 | 
            -
                 | 
| 15970 | 
            +
                IMPLEMENT_TYPED_ATTR_READERF(Image, y_resolution, resolution.y, dbl, &rm_image_data_type);
         | 
| 15399 15971 | 
             
            }
         | 
| 15400 15972 |  | 
| 15401 15973 | 
             
            /**
         | 
| @@ -15407,7 +15979,7 @@ Image_y_resolution(VALUE self) | |
| 15407 15979 | 
             
            VALUE
         | 
| 15408 15980 | 
             
            Image_y_resolution_eq(VALUE self, VALUE val)
         | 
| 15409 15981 | 
             
            {
         | 
| 15410 | 
            -
                 | 
| 15982 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITERF(Image, y_resolution, resolution.y, dbl, &rm_image_data_type);
         | 
| 15411 15983 | 
             
            }
         | 
| 15412 15984 | 
             
            #else
         | 
| 15413 15985 | 
             
            /**
         | 
| @@ -15418,7 +15990,7 @@ Image_y_resolution_eq(VALUE self, VALUE val) | |
| 15418 15990 | 
             
            VALUE
         | 
| 15419 15991 | 
             
            Image_x_resolution(VALUE self)
         | 
| 15420 15992 | 
             
            {
         | 
| 15421 | 
            -
                 | 
| 15993 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, x_resolution, dbl, &rm_image_data_type);
         | 
| 15422 15994 | 
             
            }
         | 
| 15423 15995 |  | 
| 15424 15996 | 
             
            /**
         | 
| @@ -15430,7 +16002,7 @@ Image_x_resolution(VALUE self) | |
| 15430 16002 | 
             
            VALUE
         | 
| 15431 16003 | 
             
            Image_x_resolution_eq(VALUE self, VALUE val)
         | 
| 15432 16004 | 
             
            {
         | 
| 15433 | 
            -
                 | 
| 16005 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, x_resolution, dbl, &rm_image_data_type);
         | 
| 15434 16006 | 
             
            }
         | 
| 15435 16007 |  | 
| 15436 16008 | 
             
            /**
         | 
| @@ -15441,7 +16013,7 @@ Image_x_resolution_eq(VALUE self, VALUE val) | |
| 15441 16013 | 
             
            VALUE
         | 
| 15442 16014 | 
             
            Image_y_resolution(VALUE self)
         | 
| 15443 16015 | 
             
            {
         | 
| 15444 | 
            -
                 | 
| 16016 | 
            +
                IMPLEMENT_TYPED_ATTR_READER(Image, y_resolution, dbl, &rm_image_data_type);
         | 
| 15445 16017 | 
             
            }
         | 
| 15446 16018 |  | 
| 15447 16019 | 
             
            /**
         | 
| @@ -15453,7 +16025,7 @@ Image_y_resolution(VALUE self) | |
| 15453 16025 | 
             
            VALUE
         | 
| 15454 16026 | 
             
            Image_y_resolution_eq(VALUE self, VALUE val)
         | 
| 15455 16027 | 
             
            {
         | 
| 15456 | 
            -
                 | 
| 16028 | 
            +
                IMPLEMENT_TYPED_ATTR_WRITER(Image, y_resolution, dbl, &rm_image_data_type);
         | 
| 15457 16029 | 
             
            }
         | 
| 15458 16030 | 
             
            #endif
         | 
| 15459 16031 |  | 
| @@ -15512,7 +16084,7 @@ cropper(int bang, int argc, VALUE *argv, VALUE self) | |
| 15512 16084 | 
             
                switch (argc)
         | 
| 15513 16085 | 
             
                {
         | 
| 15514 16086 | 
             
                    case 5:
         | 
| 15515 | 
            -
                         | 
| 16087 | 
            +
                        TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 15516 16088 |  | 
| 15517 16089 | 
             
                        VALUE_TO_ENUM(argv[0], gravity, GravityType);
         | 
| 15518 16090 |  | 
| @@ -15579,7 +16151,7 @@ cropper(int bang, int argc, VALUE *argv, VALUE self) | |
| 15579 16151 | 
             
                        columns = NUM2ULONG(width);
         | 
| 15580 16152 | 
             
                        rows    = NUM2ULONG(height);
         | 
| 15581 16153 |  | 
| 15582 | 
            -
                         | 
| 16154 | 
            +
                        TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 15583 16155 |  | 
| 15584 16156 | 
             
                        switch (gravity)
         | 
| 15585 16157 | 
             
                        {
         | 
| @@ -15642,10 +16214,10 @@ cropper(int bang, int argc, VALUE *argv, VALUE self) | |
| 15642 16214 | 
             
                        break;
         | 
| 15643 16215 | 
             
                }
         | 
| 15644 16216 |  | 
| 15645 | 
            -
                cropped = xform_image(bang, self, x, y, width, height, CropImage);
         | 
| 16217 | 
            +
                cropped = xform_image(bang, self, x, y, width, height, GVL_FUNC(CropImage));
         | 
| 15646 16218 | 
             
                if (reset_page)
         | 
| 15647 16219 | 
             
                {
         | 
| 15648 | 
            -
                     | 
| 16220 | 
            +
                    TypedData_Get_Struct(cropped, Image, &rm_image_data_type, image);
         | 
| 15649 16221 | 
             
                    ResetImagePage(image, "0x0+0+0");
         | 
| 15650 16222 | 
             
                }
         | 
| 15651 16223 |  | 
| @@ -15658,6 +16230,9 @@ cropper(int bang, int argc, VALUE *argv, VALUE self) | |
| 15658 16230 | 
             
            }
         | 
| 15659 16231 |  | 
| 15660 16232 |  | 
| 16233 | 
            +
            // aliases for common use of structure types; ChopImage, CropImage, ShaveImage
         | 
| 16234 | 
            +
            typedef GVL_STRUCT_TYPE(ChopImage) GVL_STRUCT_TYPE(xform_image);
         | 
| 16235 | 
            +
             | 
| 15661 16236 | 
             
            /**
         | 
| 15662 16237 | 
             
             * Call one of the image transformation functions.
         | 
| 15663 16238 | 
             
             *
         | 
| @@ -15673,13 +16248,13 @@ cropper(int bang, int argc, VALUE *argv, VALUE self) | |
| 15673 16248 | 
             
             * @return self if bang, otherwise a new image
         | 
| 15674 16249 | 
             
             */
         | 
| 15675 16250 | 
             
            static VALUE
         | 
| 15676 | 
            -
            xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height,  | 
| 16251 | 
            +
            xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, gvl_function_t fp)
         | 
| 15677 16252 | 
             
            {
         | 
| 15678 16253 | 
             
                Image *image, *new_image;
         | 
| 15679 16254 | 
             
                RectangleInfo rect;
         | 
| 15680 16255 | 
             
                ExceptionInfo *exception;
         | 
| 15681 16256 |  | 
| 15682 | 
            -
                 | 
| 16257 | 
            +
                TypedData_Get_Struct(self, Image, &rm_image_data_type, image);
         | 
| 15683 16258 | 
             
                rect.x      = NUM2LONG(x);
         | 
| 15684 16259 | 
             
                rect.y      = NUM2LONG(y);
         | 
| 15685 16260 | 
             
                rect.width  = NUM2ULONG(width);
         | 
| @@ -15687,7 +16262,8 @@ xform_image(int bang, VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, x | |
| 15687 16262 |  | 
| 15688 16263 | 
             
                exception = AcquireExceptionInfo();
         | 
| 15689 16264 |  | 
| 15690 | 
            -
                 | 
| 16265 | 
            +
                GVL_STRUCT_TYPE(xform_image) args = { image, &rect, exception };
         | 
| 16266 | 
            +
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(fp, &args);
         | 
| 15691 16267 |  | 
| 15692 16268 | 
             
                // An exception can occur in either the old or the new images
         | 
| 15693 16269 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| @@ -15795,4 +16371,15 @@ void rm_image_destroy(void *img) | |
| 15795 16371 | 
             
                }
         | 
| 15796 16372 | 
             
            }
         | 
| 15797 16373 |  | 
| 15798 | 
            -
             | 
| 16374 | 
            +
            /**
         | 
| 16375 | 
            +
              * Get Image object size.
         | 
| 16376 | 
            +
              *
         | 
| 16377 | 
            +
              * No Ruby usage (internal function)
         | 
| 16378 | 
            +
              *
         | 
| 16379 | 
            +
              * @param ptr pointer to the Image object
         | 
| 16380 | 
            +
              */
         | 
| 16381 | 
            +
            static size_t
         | 
| 16382 | 
            +
            rm_image_memsize(const void *ptr)
         | 
| 16383 | 
            +
            {
         | 
| 16384 | 
            +
                return sizeof(Image);
         | 
| 16385 | 
            +
            }
         |