rmagick 5.5.0 → 6.0.1
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.
- checksums.yaml +4 -4
- data/.devcontainer/ImageMagick6/devcontainer.json +1 -1
- data/.devcontainer/devcontainer.json +1 -1
- data/.github/workflows/ci.yml +27 -32
- data/.rubocop.yml +39 -9
- data/.rubocop_todo.yml +333 -194
- data/CHANGELOG.md +41 -0
- data/Gemfile +9 -15
- data/README.md +6 -6
- data/Rakefile +27 -12
- data/before_install_linux.sh +1 -11
- data/before_install_osx.sh +9 -7
- data/ext/RMagick/extconf.rb +38 -64
- data/ext/RMagick/rmagick.h +6 -13
- data/ext/RMagick/rmdraw.cpp +0 -10
- data/ext/RMagick/rmimage.cpp +21 -50
- data/ext/RMagick/rmmain.cpp +12 -27
- data/ext/RMagick/rmpixel.cpp +2 -2
- data/ext/RMagick/rmutil.cpp +27 -18
- data/lib/rmagick/version.rb +3 -3
- data/lib/rmagick.rb +1 -1
- data/lib/rmagick_internal.rb +49 -46
- data/lib/rvg/container.rb +3 -3
- data/lib/rvg/embellishable.rb +1 -1
- data/lib/rvg/misc.rb +9 -9
- data/lib/rvg/rvg.rb +4 -6
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/units.rb +1 -0
- data/rmagick.gemspec +5 -2
- data/sig/rmagick/_image_common_methods.rbs +0 -2
- data/sig/rmagick/enum.rbs +6 -0
- data/sig/rmagick/image.rbs +2 -0
- data/sig/rmagick/image_list.rbs +2 -0
- metadata +18 -15
    
        data/ext/RMagick/rmimage.cpp
    CHANGED
    
    | @@ -288,17 +288,11 @@ DEFINE_GVL_STUB2(WriteImage, const ImageInfo *, Image *); | |
| 288 288 | 
             
            DEFINE_GVL_STUB4(GetImageChannelEntropy, const Image *, const ChannelType, double *, ExceptionInfo *);
         | 
| 289 289 | 
             
            #endif
         | 
| 290 290 |  | 
| 291 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 292 291 | 
             
            DEFINE_GVL_STUB3(RotationalBlurImage, const Image *, const double, ExceptionInfo *);
         | 
| 293 | 
            -
            #else
         | 
| 294 | 
            -
            DEFINE_GVL_STUB3(RadialBlurImage, const Image *, const double, ExceptionInfo *);
         | 
| 295 | 
            -
            #endif
         | 
| 296 292 |  | 
| 297 293 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 298 | 
            -
            #elif defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 299 | 
            -
            DEFINE_GVL_STUB4(RotationalBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
         | 
| 300 294 | 
             
            #else
         | 
| 301 | 
            -
            DEFINE_GVL_STUB4( | 
| 295 | 
            +
            DEFINE_GVL_STUB4(RotationalBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
         | 
| 302 296 | 
             
            #endif
         | 
| 303 297 |  | 
| 304 298 | 
             
            /**
         | 
| @@ -2327,6 +2321,7 @@ Image_capture(int argc, VALUE *argv, VALUE self ATTRIBUTE_UNUSED) | |
| 2327 2321 | 
             
                rm_ensure_result(new_image);
         | 
| 2328 2322 |  | 
| 2329 2323 | 
             
                rm_set_user_artifact(new_image, image_info);
         | 
| 2324 | 
            +
                rm_sync_image_options(new_image, image_info);
         | 
| 2330 2325 |  | 
| 2331 2326 | 
             
                RB_GC_GUARD(info_obj);
         | 
| 2332 2327 |  | 
| @@ -7307,6 +7302,7 @@ Image_from_blob(VALUE klass ATTRIBUTE_UNUSED, VALUE blob_arg) | |
| 7307 7302 |  | 
| 7308 7303 | 
             
                rm_ensure_result(images);
         | 
| 7309 7304 | 
             
                rm_set_user_artifact(images, info);
         | 
| 7305 | 
            +
                rm_sync_image_options(images, info);
         | 
| 7310 7306 |  | 
| 7311 7307 | 
             
                RB_GC_GUARD(info_obj);
         | 
| 7312 7308 |  | 
| @@ -7963,26 +7959,7 @@ Image_gray_q(VALUE self) | |
| 7963 7959 | 
             
            #if defined(HAVE_SETIMAGEGRAY)
         | 
| 7964 7960 | 
             
                return has_attribute(self, (MagickBooleanType (*)(const Image *, ExceptionInfo *))SetImageGray);
         | 
| 7965 7961 | 
             
            #else
         | 
| 7966 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 7967 7962 | 
             
                return has_attribute(self, IsGrayImage);
         | 
| 7968 | 
            -
            #else
         | 
| 7969 | 
            -
                // For ImageMagick 6.7
         | 
| 7970 | 
            -
                Image *image;
         | 
| 7971 | 
            -
                ColorspaceType colorspace;
         | 
| 7972 | 
            -
                VALUE ret;
         | 
| 7973 | 
            -
             | 
| 7974 | 
            -
                image = rm_check_destroyed(self);
         | 
| 7975 | 
            -
                colorspace = image->colorspace;
         | 
| 7976 | 
            -
                if (image->colorspace == sRGBColorspace || image->colorspace == TransparentColorspace) {
         | 
| 7977 | 
            -
                    // Workaround
         | 
| 7978 | 
            -
                    //   If image colorspace has non-RGBColorspace, IsGrayImage() always return false.
         | 
| 7979 | 
            -
                    image->colorspace = RGBColorspace;
         | 
| 7980 | 
            -
                }
         | 
| 7981 | 
            -
             | 
| 7982 | 
            -
                ret = has_attribute(self, IsGrayImage);
         | 
| 7983 | 
            -
                image->colorspace = colorspace;
         | 
| 7984 | 
            -
                return ret;
         | 
| 7985 | 
            -
            #endif
         | 
| 7986 7963 | 
             
            #endif
         | 
| 7987 7964 | 
             
            }
         | 
| 7988 7965 |  | 
| @@ -9931,6 +9908,8 @@ Image_initialize(int argc, VALUE *argv, VALUE self) | |
| 9931 9908 | 
             
                CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageExtent), &args);
         | 
| 9932 9909 | 
             
            #endif
         | 
| 9933 9910 |  | 
| 9911 | 
            +
                rm_sync_image_options(image, info);
         | 
| 9912 | 
            +
             | 
| 9934 9913 | 
             
                // If the caller did not supply a fill argument, call SetImageBackgroundColor
         | 
| 9935 9914 | 
             
                // to fill the image using the background color. The background color can
         | 
| 9936 9915 | 
             
                // be set by specifying it when creating the Info parm block.
         | 
| @@ -10671,11 +10650,11 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10671 10650 | 
             
                    DestroyExceptionInfo(exception);
         | 
| 10672 10651 |  | 
| 10673 10652 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10674 | 
            -
                    old_color.red   = GetPixelRed(image, old_pixel);
         | 
| 10675 | 
            -
                    old_color.green = GetPixelGreen(image, old_pixel);
         | 
| 10676 | 
            -
                    old_color.blue  = GetPixelBlue(image, old_pixel);
         | 
| 10677 | 
            -
                    old_color.alpha = GetPixelAlpha(image, old_pixel);
         | 
| 10678 | 
            -
                    old_color.black = GetPixelBlack(image, old_pixel);
         | 
| 10653 | 
            +
                    old_color.red   = GetPixelRed(image, old_pixel) + 0.5;
         | 
| 10654 | 
            +
                    old_color.green = GetPixelGreen(image, old_pixel) + 0.5;
         | 
| 10655 | 
            +
                    old_color.blue  = GetPixelBlue(image, old_pixel) + 0.5;
         | 
| 10656 | 
            +
                    old_color.alpha = GetPixelAlpha(image, old_pixel) + 0.5;
         | 
| 10657 | 
            +
                    old_color.black = GetPixelBlack(image, old_pixel) + 0.5;
         | 
| 10679 10658 | 
             
                    return Pixel_from_PixelPacket(&old_color);
         | 
| 10680 10659 | 
             
            #else
         | 
| 10681 10660 | 
             
                    old_color = *old_pixel;
         | 
| @@ -10750,11 +10729,11 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self) | |
| 10750 10729 | 
             
                if (pixel)
         | 
| 10751 10730 | 
             
                {
         | 
| 10752 10731 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 10753 | 
            -
                    old_color.red   = GetPixelRed(image, pixel);
         | 
| 10754 | 
            -
                    old_color.green = GetPixelGreen(image, pixel);
         | 
| 10755 | 
            -
                    old_color.blue  = GetPixelBlue(image, pixel);
         | 
| 10756 | 
            -
                    old_color.alpha = GetPixelAlpha(image, pixel);
         | 
| 10757 | 
            -
                    old_color.black = GetPixelBlack(image, pixel);
         | 
| 10732 | 
            +
                    old_color.red   = GetPixelRed(image, pixel) + 0.5;
         | 
| 10733 | 
            +
                    old_color.green = GetPixelGreen(image, pixel) + 0.5;
         | 
| 10734 | 
            +
                    old_color.blue  = GetPixelBlue(image, pixel) + 0.5;
         | 
| 10735 | 
            +
                    old_color.alpha = GetPixelAlpha(image, pixel) + 0.5;
         | 
| 10736 | 
            +
                    old_color.black = GetPixelBlack(image, pixel) + 0.5;
         | 
| 10758 10737 |  | 
| 10759 10738 | 
             
                    SetPixelRed(image,   new_color.red,   pixel);
         | 
| 10760 10739 | 
             
                    SetPixelGreen(image, new_color.green, pixel);
         | 
| @@ -11185,11 +11164,9 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self) | |
| 11185 11164 | 
             
                    case SumQuantumOperator:
         | 
| 11186 11165 | 
             
                        qop = SumEvaluateOperator;
         | 
| 11187 11166 | 
             
                        break;
         | 
| 11188 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 11189 11167 | 
             
                    case RootMeanSquareQuantumOperator:
         | 
| 11190 11168 | 
             
                        qop = RootMeanSquareEvaluateOperator;
         | 
| 11191 11169 | 
             
                        break;
         | 
| 11192 | 
            -
            #endif
         | 
| 11193 11170 | 
             
                }
         | 
| 11194 11171 |  | 
| 11195 11172 | 
             
                exception = AcquireExceptionInfo();
         | 
| @@ -11307,15 +11284,9 @@ Image_radial_blur(VALUE self, VALUE angle_obj) | |
| 11307 11284 | 
             
                image = rm_check_destroyed(self);
         | 
| 11308 11285 | 
             
                exception = AcquireExceptionInfo();
         | 
| 11309 11286 |  | 
| 11310 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 11311 11287 | 
             
                GVL_STRUCT_TYPE(RotationalBlurImage) args = { image, angle, exception };
         | 
| 11312 11288 | 
             
                void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImage), &args);
         | 
| 11313 11289 | 
             
                new_image = reinterpret_cast<decltype(new_image)>(ret);
         | 
| 11314 | 
            -
            #else
         | 
| 11315 | 
            -
                GVL_STRUCT_TYPE(RadialBlurImage) args = { image, angle, exception };
         | 
| 11316 | 
            -
                void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RadialBlurImage), &args);
         | 
| 11317 | 
            -
                new_image = reinterpret_cast<decltype(new_image)>(ret);
         | 
| 11318 | 
            -
            #endif
         | 
| 11319 11290 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11320 11291 | 
             
                DestroyExceptionInfo(exception);
         | 
| 11321 11292 |  | 
| @@ -11366,12 +11337,9 @@ Image_radial_blur_channel(int argc, VALUE *argv, VALUE self) | |
| 11366 11337 | 
             
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImage), &args);
         | 
| 11367 11338 | 
             
                CHANGE_RESULT_CHANNEL_MASK(new_image);
         | 
| 11368 11339 | 
             
                END_CHANNEL_MASK(image);
         | 
| 11369 | 
            -
            # | 
| 11340 | 
            +
            #else
         | 
| 11370 11341 | 
             
                GVL_STRUCT_TYPE(RotationalBlurImageChannel) args = { image, channels, angle, exception };
         | 
| 11371 11342 | 
             
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImageChannel), &args);
         | 
| 11372 | 
            -
            #else
         | 
| 11373 | 
            -
                GVL_STRUCT_TYPE(RadialBlurImageChannel) args = { image, channels, angle, exception };
         | 
| 11374 | 
            -
                new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RadialBlurImageChannel), &args);
         | 
| 11375 11343 | 
             
            #endif
         | 
| 11376 11344 | 
             
                rm_check_exception(exception, new_image, DestroyOnError);
         | 
| 11377 11345 | 
             
                DestroyExceptionInfo(exception);
         | 
| @@ -11630,9 +11598,11 @@ rd_image(VALUE klass ATTRIBUTE_UNUSED, VALUE file, gvl_function_t fp) | |
| 11630 11598 | 
             
            #endif
         | 
| 11631 11599 |  | 
| 11632 11600 | 
             
                rm_check_exception(exception, images, DestroyOnError);
         | 
| 11633 | 
            -
                rm_set_user_artifact(images, info);
         | 
| 11634 11601 | 
             
                DestroyExceptionInfo(exception);
         | 
| 11635 11602 |  | 
| 11603 | 
            +
                rm_set_user_artifact(images, info);
         | 
| 11604 | 
            +
                rm_sync_image_options(images, info);
         | 
| 11605 | 
            +
             | 
| 11636 11606 | 
             
                RB_GC_GUARD(info_obj);
         | 
| 11637 11607 |  | 
| 11638 11608 | 
             
                return array_from_images(images);
         | 
| @@ -11774,9 +11744,10 @@ Image_read_inline(VALUE self ATTRIBUTE_UNUSED, VALUE content) | |
| 11774 11744 | 
             
                magick_free((void *)blob);
         | 
| 11775 11745 |  | 
| 11776 11746 | 
             
                rm_check_exception(exception, images, DestroyOnError);
         | 
| 11777 | 
            -
             | 
| 11778 11747 | 
             
                DestroyExceptionInfo(exception);
         | 
| 11748 | 
            +
             | 
| 11779 11749 | 
             
                rm_set_user_artifact(images, info);
         | 
| 11750 | 
            +
                rm_sync_image_options(images, info);
         | 
| 11780 11751 |  | 
| 11781 11752 | 
             
                RB_GC_GUARD(info_obj);
         | 
| 11782 11753 |  | 
    
        data/ext/RMagick/rmmain.cpp
    CHANGED
    
    | @@ -14,7 +14,7 @@ | |
| 14 14 | 
             
            #define MAIN                        // Define external variables
         | 
| 15 15 | 
             
            #include "rmagick.h"
         | 
| 16 16 |  | 
| 17 | 
            -
            #if defined(HAVE_SETMAGICKALIGNEDMEMORYMETHODS) | 
| 17 | 
            +
            #if defined(HAVE_SETMAGICKALIGNEDMEMORYMETHODS)
         | 
| 18 18 | 
             
                #if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE__ALIGNED_MSIZE)
         | 
| 19 19 | 
             
                    #define USE_RM_ALIGNED_MALLOC 1
         | 
| 20 20 |  | 
| @@ -1019,10 +1019,8 @@ Init_RMagick2(void) | |
| 1019 1019 | 
             
                    ENUMERATOR(ShapeAlphaChannel)
         | 
| 1020 1020 | 
             
                    ENUMERATOR(TransparentAlphaChannel)
         | 
| 1021 1021 | 
             
                    ENUMERATOR(BackgroundAlphaChannel)
         | 
| 1022 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1023 1022 | 
             
                    ENUMERATOR(AssociateAlphaChannel)
         | 
| 1024 1023 | 
             
                    ENUMERATOR(DisassociateAlphaChannel)
         | 
| 1025 | 
            -
            #endif
         | 
| 1026 1024 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1027 1025 | 
             
                    ENUMERATOR(OnAlphaChannel)
         | 
| 1028 1026 | 
             
                    ENUMERATOR(OffAlphaChannel)
         | 
| @@ -1052,7 +1050,12 @@ Init_RMagick2(void) | |
| 1052 1050 | 
             
                    ENUMERATOR(BlackChannel)
         | 
| 1053 1051 | 
             
                    ENUMERATOR(IndexChannel)
         | 
| 1054 1052 | 
             
                    ENUMERATOR(GrayChannel)
         | 
| 1053 | 
            +
                    ENUMERATOR(CompositeChannels)
         | 
| 1055 1054 | 
             
                    ENUMERATOR(AllChannels)
         | 
| 1055 | 
            +
                    ENUMERATOR(TrueAlphaChannel)
         | 
| 1056 | 
            +
                    ENUMERATOR(RGBChannels)
         | 
| 1057 | 
            +
                    ENUMERATOR(GrayChannels)
         | 
| 1058 | 
            +
                    ENUMERATOR(SyncChannels)
         | 
| 1056 1059 | 
             
                    ENUMERATORV(AlphaChannel, OpacityChannel)
         | 
| 1057 1060 | 
             
                    ENUMERATORV(DefaultChannels, 0xff & ~OpacityChannel)
         | 
| 1058 1061 | 
             
                    ENUMERATORV(HueChannel, RedChannel)
         | 
| @@ -1090,7 +1093,6 @@ Init_RMagick2(void) | |
| 1090 1093 | 
             
                    ENUMERATOR(Rec709YCbCrColorspace)
         | 
| 1091 1094 | 
             
                    ENUMERATOR(LogColorspace)
         | 
| 1092 1095 | 
             
                    ENUMERATOR(CMYColorspace)
         | 
| 1093 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1094 1096 | 
             
                    ENUMERATOR(LuvColorspace)
         | 
| 1095 1097 | 
             
                    ENUMERATOR(HCLColorspace)
         | 
| 1096 1098 | 
             
                    ENUMERATOR(LCHColorspace)
         | 
| @@ -1103,7 +1105,6 @@ Init_RMagick2(void) | |
| 1103 1105 | 
             
                    ENUMERATOR(HCLpColorspace)
         | 
| 1104 1106 | 
             
                    ENUMERATOR(YDbDrColorspace)
         | 
| 1105 1107 | 
             
                    ENUMERATORV(XyYColorspace, xyYColorspace)
         | 
| 1106 | 
            -
            #endif
         | 
| 1107 1108 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1108 1109 | 
             
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_7_0_8)
         | 
| 1109 1110 | 
             
                    ENUMERATOR(LinearGRAYColorspace)
         | 
| @@ -1196,9 +1197,7 @@ Init_RMagick2(void) | |
| 1196 1197 | 
             
                    ENUMERATOR(UndefinedCompositeOp)
         | 
| 1197 1198 | 
             
                    ENUMERATOR(VividLightCompositeOp)
         | 
| 1198 1199 | 
             
                    ENUMERATOR(XorCompositeOp)
         | 
| 1199 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1200 1200 | 
             
                    ENUMERATOR(HardMixCompositeOp)
         | 
| 1201 | 
            -
            #endif
         | 
| 1202 1201 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1203 1202 | 
             
                    ENUMERATOR(CopyAlphaCompositeOp)
         | 
| 1204 1203 | 
             
            #else
         | 
| @@ -1242,6 +1241,7 @@ Init_RMagick2(void) | |
| 1242 1241 |  | 
| 1243 1242 | 
             
                // DisposeType constants
         | 
| 1244 1243 | 
             
                DEF_ENUM(DisposeType)
         | 
| 1244 | 
            +
                    ENUMERATOR(UnrecognizedDispose)
         | 
| 1245 1245 | 
             
                    ENUMERATOR(UndefinedDispose)
         | 
| 1246 1246 | 
             
                    ENUMERATOR(BackgroundDispose)
         | 
| 1247 1247 | 
             
                    ENUMERATOR(NoneDispose)
         | 
| @@ -1318,9 +1318,7 @@ Init_RMagick2(void) | |
| 1318 1318 | 
             
                    ENUMERATOR(RobidouxSharpFilter)
         | 
| 1319 1319 | 
             
                    ENUMERATOR(CosineFilter)
         | 
| 1320 1320 | 
             
                    ENUMERATOR(SplineFilter)
         | 
| 1321 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1322 1321 | 
             
                    ENUMERATOR(LanczosRadiusFilter)
         | 
| 1323 | 
            -
            #endif
         | 
| 1324 1322 | 
             
                    ENUMERATORV(WelchFilter, WelshFilter)
         | 
| 1325 1323 | 
             
                    ENUMERATORV(HannFilter, HanningFilter)
         | 
| 1326 1324 | 
             
                END_ENUM
         | 
| @@ -1412,9 +1410,7 @@ Init_RMagick2(void) | |
| 1412 1410 | 
             
                    ENUMERATOR(RootMeanSquaredErrorMetric)
         | 
| 1413 1411 | 
             
                    ENUMERATOR(NormalizedCrossCorrelationErrorMetric)
         | 
| 1414 1412 | 
             
                    ENUMERATOR(FuzzErrorMetric)
         | 
| 1415 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1416 1413 | 
             
                    ENUMERATOR(PerceptualHashErrorMetric)
         | 
| 1417 | 
            -
            #endif
         | 
| 1418 1414 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1419 1415 | 
             
                    ENUMERATOR(UndefinedErrorMetric)
         | 
| 1420 1416 | 
             
                    ENUMERATOR(MeanErrorPerPixelErrorMetric)
         | 
| @@ -1546,9 +1542,7 @@ Init_RMagick2(void) | |
| 1546 1542 | 
             
                    ENUMERATOR(ExponentialQuantumOperator)
         | 
| 1547 1543 | 
             
                    ENUMERATOR(MedianQuantumOperator)
         | 
| 1548 1544 | 
             
                    ENUMERATOR(SumQuantumOperator)
         | 
| 1549 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1550 1545 | 
             
                    ENUMERATOR(RootMeanSquareQuantumOperator)
         | 
| 1551 | 
            -
            #endif
         | 
| 1552 1546 | 
             
                END_ENUM
         | 
| 1553 1547 |  | 
| 1554 1548 | 
             
                // RenderingIntent
         | 
| @@ -1673,9 +1667,7 @@ Init_RMagick2(void) | |
| 1673 1667 | 
             
                    ENUMERATOR(CorrelateNormalizeValue)
         | 
| 1674 1668 | 
             
                    ENUMERATOR(AreaValue)
         | 
| 1675 1669 | 
             
                    ENUMERATOR(DecimalValue)
         | 
| 1676 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1677 1670 | 
             
                    ENUMERATOR(SeparatorValue)
         | 
| 1678 | 
            -
            #endif
         | 
| 1679 1671 | 
             
                    ENUMERATOR(AllValues)
         | 
| 1680 1672 | 
             
                END_ENUM
         | 
| 1681 1673 |  | 
| @@ -1744,9 +1736,7 @@ Init_RMagick2(void) | |
| 1744 1736 | 
             
                  ENUMERATOR(OctagonalKernel)
         | 
| 1745 1737 | 
             
                  ENUMERATOR(EuclideanKernel)
         | 
| 1746 1738 | 
             
                  ENUMERATOR(UserDefinedKernel)
         | 
| 1747 | 
            -
            #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
         | 
| 1748 1739 | 
             
                  ENUMERATOR(BinomialKernel)
         | 
| 1749 | 
            -
            #endif
         | 
| 1750 1740 | 
             
                END_ENUM
         | 
| 1751 1741 |  | 
| 1752 1742 | 
             
                /*-----------------------------------------------------------------------*/
         | 
| @@ -1822,25 +1812,20 @@ Init_RMagick2(void) | |
| 1822 1812 | 
             
             * were compiled with.
         | 
| 1823 1813 | 
             
             *
         | 
| 1824 1814 | 
             
             * No Ruby usage (internal function)
         | 
| 1825 | 
            -
             *
         | 
| 1826 | 
            -
             * Notes:
         | 
| 1827 | 
            -
             *   - Bypass the test by defining the constant RMAGICK_BYPASS_VERSION_TEST to
         | 
| 1828 | 
            -
             *     'true' at the top level, before requiring 'rmagick'
         | 
| 1829 1815 | 
             
             */
         | 
| 1830 1816 | 
             
            static void
         | 
| 1831 1817 | 
             
            test_Magick_version(void)
         | 
| 1832 1818 | 
             
            {
         | 
| 1833 1819 | 
             
                size_t version_number;
         | 
| 1834 1820 | 
             
                const char *version_str;
         | 
| 1835 | 
            -
                ID bypass = rb_intern("RMAGICK_BYPASS_VERSION_TEST");
         | 
| 1836 1821 |  | 
| 1837 | 
            -
                 | 
| 1838 | 
            -
                 | 
| 1839 | 
            -
             | 
| 1840 | 
            -
                 | 
| 1822 | 
            +
                /* ImageMagick versions are defined as major, minor and patch, each of which are defined as a value in 1 byte. */
         | 
| 1823 | 
            +
                /* ImageMagick 6.9.12 has `#define MagickLibVersion  0x69C` */
         | 
| 1824 | 
            +
                /* It use only major and minor versions. */
         | 
| 1825 | 
            +
                size_t mask_major_minor_version = 0xFFFFFFF0;
         | 
| 1841 1826 |  | 
| 1842 1827 | 
             
                version_str = GetMagickVersion(&version_number);
         | 
| 1843 | 
            -
                if (version_number != MagickLibVersion)
         | 
| 1828 | 
            +
                if ((version_number & mask_major_minor_version) != (MagickLibVersion & mask_major_minor_version))
         | 
| 1844 1829 | 
             
                {
         | 
| 1845 1830 | 
             
                    int n, x;
         | 
| 1846 1831 |  | 
    
        data/ext/RMagick/rmpixel.cpp
    CHANGED
    
    | @@ -1191,7 +1191,7 @@ rm_set_magick_pixel_packet(Pixel *pixel, MagickPixel *pp) | |
| 1191 1191 | 
             
            /**
         | 
| 1192 1192 | 
             
             * Return the color name corresponding to the pixel values.
         | 
| 1193 1193 | 
             
             *
         | 
| 1194 | 
            -
             * @overload to_color(compliance = Magick::AllCompliance, alpha = false, depth = Magick::MAGICKCORE_QUANTUM_DEPTH, hex =  | 
| 1194 | 
            +
             * @overload to_color(compliance = Magick::AllCompliance, alpha = false, depth = Magick::MAGICKCORE_QUANTUM_DEPTH, hex = true)
         | 
| 1195 1195 | 
             
             *   @param compliance [Magick::ComplianceType] A ComplianceType constant
         | 
| 1196 1196 | 
             
             *   @param alpha [Boolean] If false, the pixel's alpha attribute is ignored
         | 
| 1197 1197 | 
             
             *   @param depth [Numeric] An image depth
         | 
| @@ -1205,7 +1205,7 @@ Pixel_to_color(int argc, VALUE *argv, VALUE self) | |
| 1205 1205 | 
             
                Image *image;
         | 
| 1206 1206 | 
             
                Pixel *pixel;
         | 
| 1207 1207 | 
             
                MagickPixel mpp;
         | 
| 1208 | 
            -
                MagickBooleanType hex =  | 
| 1208 | 
            +
                MagickBooleanType hex = MagickTrue;
         | 
| 1209 1209 | 
             
                char name[MaxTextExtent];
         | 
| 1210 1210 | 
             
                ExceptionInfo *exception;
         | 
| 1211 1211 | 
             
                ComplianceType compliance = AllCompliance;
         | 
    
        data/ext/RMagick/rmutil.cpp
    CHANGED
    
    | @@ -21,6 +21,11 @@ | |
| 21 21 | 
             
            static VALUE rescue_not_str(VALUE, VALUE ATTRIBUTE_UNUSED) ATTRIBUTE_NORETURN;
         | 
| 22 22 | 
             
            static void handle_exception(ExceptionInfo *, Image *, ErrorRetention);
         | 
| 23 23 |  | 
| 24 | 
            +
            #if defined(IMAGEMAGICK_7)
         | 
| 25 | 
            +
            DEFINE_GVL_STUB3(TransformImageColorspace, Image *, const ColorspaceType, ExceptionInfo *);
         | 
| 26 | 
            +
            #else
         | 
| 27 | 
            +
            DEFINE_GVL_STUB2(TransformImageColorspace, Image *, const ColorspaceType);
         | 
| 28 | 
            +
            #endif
         | 
| 24 29 |  | 
| 25 30 | 
             
            DEFINE_GVL_STUB5(CloneImage, const Image *, const size_t, const size_t, const MagickBooleanType, ExceptionInfo *);
         | 
| 26 31 |  | 
| @@ -367,7 +372,6 @@ double | |
| 367 372 | 
             
            rm_percentage2(VALUE arg, double max, bool only_positive)
         | 
| 368 373 | 
             
            {
         | 
| 369 374 | 
             
                double pct;
         | 
| 370 | 
            -
                char *end;
         | 
| 371 375 |  | 
| 372 376 | 
             
                if (!rm_check_num2dbl(arg))
         | 
| 373 377 | 
             
                {
         | 
| @@ -590,23 +594,27 @@ rm_cur_image(VALUE img) | |
| 590 594 | 
             
            VALUE
         | 
| 591 595 | 
             
            rm_pixelcolor_to_color_name(Image *image, PixelColor *color)
         | 
| 592 596 | 
             
            {
         | 
| 593 | 
            -
                 | 
| 594 | 
            -
                char  | 
| 595 | 
            -
                ExceptionInfo *exception;
         | 
| 597 | 
            +
                MagickPixel mpp;
         | 
| 598 | 
            +
                char tuple[MaxTextExtent];
         | 
| 596 599 |  | 
| 597 | 
            -
                exception = AcquireExceptionInfo();
         | 
| 598 | 
            -
             | 
| 599 | 
            -
                pp = *color;
         | 
| 600 600 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 601 | 
            -
                 | 
| 602 | 
            -
                 | 
| 601 | 
            +
                mpp = *color;
         | 
| 602 | 
            +
                mpp.alpha_trait = BlendPixelTrait;
         | 
| 603 | 
            +
                mpp.colorspace = image->colorspace;
         | 
| 604 | 
            +
            #else
         | 
| 605 | 
            +
                rm_init_magickpixel(image, &mpp);
         | 
| 606 | 
            +
                mpp.red = GetPixelRed(color);
         | 
| 607 | 
            +
                mpp.green = GetPixelGreen(color);
         | 
| 608 | 
            +
                mpp.blue = GetPixelBlue(color);
         | 
| 609 | 
            +
                mpp.opacity = GetPixelOpacity(color);
         | 
| 610 | 
            +
                mpp.index   = (MagickRealType) 0.0;
         | 
| 611 | 
            +
                mpp.matte = MagickTrue;
         | 
| 603 612 | 
             
            #endif
         | 
| 613 | 
            +
                mpp.depth = image->depth;
         | 
| 604 614 |  | 
| 605 | 
            -
                 | 
| 606 | 
            -
                CHECK_EXCEPTION();
         | 
| 607 | 
            -
                DestroyExceptionInfo(exception);
         | 
| 615 | 
            +
                GetColorTuple(&mpp, MagickTrue, tuple);
         | 
| 608 616 |  | 
| 609 | 
            -
                return rb_str_new2( | 
| 617 | 
            +
                return rb_str_new2(tuple);
         | 
| 610 618 | 
             
            }
         | 
| 611 619 |  | 
| 612 620 |  | 
| @@ -1057,13 +1065,14 @@ void rm_sync_image_options(Image *image, Info *info) | |
| 1057 1065 | 
             
                {
         | 
| 1058 1066 | 
             
            #if defined(IMAGEMAGICK_7)
         | 
| 1059 1067 | 
             
                    exception = AcquireExceptionInfo();
         | 
| 1060 | 
            -
                     | 
| 1061 | 
            -
                     | 
| 1062 | 
            -
                     | 
| 1063 | 
            -
                    // why the exception is being ignored here.
         | 
| 1068 | 
            +
                    GVL_STRUCT_TYPE(TransformImageColorspace) args = { image, info->colorspace, exception };
         | 
| 1069 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransformImageColorspace), &args);
         | 
| 1070 | 
            +
                    CHECK_EXCEPTION();
         | 
| 1064 1071 | 
             
                    DestroyExceptionInfo(exception);
         | 
| 1065 1072 | 
             
            #else
         | 
| 1066 | 
            -
                     | 
| 1073 | 
            +
                    GVL_STRUCT_TYPE(TransformImageColorspace) args = { image, info->colorspace };
         | 
| 1074 | 
            +
                    CALL_FUNC_WITHOUT_GVL(GVL_FUNC(TransformImageColorspace), &args);
         | 
| 1075 | 
            +
                    rm_check_image_exception(image, RetainOnError);
         | 
| 1067 1076 | 
             
            #endif
         | 
| 1068 1077 | 
             
                }
         | 
| 1069 1078 |  | 
    
        data/lib/rmagick/version.rb
    CHANGED
    
    
    
        data/lib/rmagick.rb
    CHANGED