From: Cristy Date: Sun, 5 Aug 2018 21:56:56 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.8-9~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=532b338a79a1272659d11e281500d96e1db69fe5;p=imagemagick ... --- diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 727369ee7..7633093e6 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -558,7 +558,7 @@ static struct { "CopyPixels", { {"image", ImageReference}, {"geometry", StringReference}, {"width", IntegerReference}, {"height", IntegerReference}, {"x", IntegerReference}, {"y", IntegerReference}, - {"gravity", MagickGravityOptions}, {"offset", StringReference}, + {"gravity", MagickGravityOptions}, {"offset", StringReference}, {"dx", IntegerReference}, {"dy", IntegerReference} } }, { "Color", { {"color", StringReference} } }, { "WaveletDenoise", { {"geometry", StringReference}, @@ -566,6 +566,10 @@ static struct {"channel", MagickChannelOptions} } }, { "Colorspace", { {"colorspace", MagickColorspaceOptions} } }, { "AutoThreshold", { {"method", MagickAutoThresholdOptions} } }, + { "RangeThreshold", { {"geometry", StringReference}, + {"low-soft", RealReference}, {"high-soft", RealReference}, + {"low-hard", RealReference}, {"high-hard", RealReference}, + {"channel", MagickChannelOptions} } }, }; static SplayTreeInfo @@ -7634,6 +7638,8 @@ Mogrify(ref,...) ColorspaceImage = 292 AutoThreshold = 293 AutoThresholdImage = 294 + RangeThreshold = 295 + RangeThresholdImage= 296 MogrifyRegion = 666 PPCODE: { @@ -11438,6 +11444,36 @@ Mogrify(ref,...) (void) AutoThresholdImage(image,method,exception); break; } + case 148: /* RangeThreshold */ + { + if (attribute_flag[0] != 0) + { + flags=ParseGeometry(argument_list[0].string_reference, + &geometry_info); + if ((flags & SigmaValue) == 0) + geometry_info.sigma=geometry_info.rho; + if ((flags & XiValue) == 0) + geometry_info.xi=geometry_info.sigma; + if ((flags & PsiValue) == 0) + geometry_info.psi=geometry_info.xi; + } + if (attribute_flag[1] != 0) + geometry_info.rho=argument_list[1].real_reference; + if (attribute_flag[2] != 0) + geometry_info.sigma=argument_list[2].real_reference; + if (attribute_flag[3] != 0) + geometry_info.xi=argument_list[3].real_reference; + if (attribute_flag[4] != 0) + geometry_info.psi=argument_list[4].real_reference; + if (attribute_flag[5] != 0) + channel=(ChannelType) argument_list[5].integer_reference; + channel_mask=SetImageChannelMask(image,channel); + image=RangeThresholdImage(image,geometry_info.rho,geometry_info.sigma, + geometry_info.xi,geometry_info.psi,exception); + if (image != (Image *) NULL) + (void) SetImageChannelMask(image,channel_mask); + break; + } } if (next != (Image *) NULL) (void) CatchImageException(next); diff --git a/PerlMagick/quantum/quantum.xs.in b/PerlMagick/quantum/quantum.xs.in index 52d4382a3..3297af940 100644 --- a/PerlMagick/quantum/quantum.xs.in +++ b/PerlMagick/quantum/quantum.xs.in @@ -565,7 +565,11 @@ static struct {"threshold", RealReference}, {"softness", RealReference}, {"channel", MagickChannelOptions} } }, { "Colorspace", { {"colorspace", MagickColorspaceOptions} } }, - { "AutoThreshold", { {"method", MagickAutoThresholdOptions} } } + { "AutoThreshold", { {"method", MagickAutoThresholdOptions} } }, + { "RangeThreshold", { {"geometry", StringReference}, + {"low-soft", RealReference}, {"high-soft", RealReference}, + {"low-hard", RealReference}, {"high-hard", RealReference}, + {"channel", MagickChannelOptions} } }, }; static SplayTreeInfo @@ -7633,6 +7637,8 @@ Mogrify(ref,...) ColorspaceImage = 292 AutoThreshold = 293 AutoThresholdImage = 294 + RangeThreshold = 295 + RangeThresholdImage= 296 MogrifyRegion = 666 PPCODE: { @@ -11440,6 +11446,36 @@ Mogrify(ref,...) (void) AutoThresholdImage(image,method,exception); break; } + case 148: /* RangeThreshold */ + { + if (attribute_flag[0] != 0) + { + flags=ParseGeometry(argument_list[0].string_reference, + &geometry_info); + if ((flags & SigmaValue) == 0) + geometry_info.sigma=geometry_info.rho; + if ((flags & XiValue) == 0) + geometry_info.xi=geometry_info.sigma; + if ((flags & PsiValue) == 0) + geometry_info.psi=geometry_info.xi; + } + if (attribute_flag[1] != 0) + geometry_info.rho=argument_list[1].real_reference; + if (attribute_flag[2] != 0) + geometry_info.sigma=argument_list[2].real_reference; + if (attribute_flag[3] != 0) + geometry_info.xi=argument_list[3].real_reference; + if (attribute_flag[4] != 0) + geometry_info.psi=argument_list[4].real_reference; + if (attribute_flag[5] != 0) + channel=(ChannelType) argument_list[5].integer_reference; + channel_mask=SetImageChannelMask(image,channel); + image=RangeThresholdImage(image,geometry_info.rho,geometry_info.sigma, + geometry_info.xi,geometry_info.psi,exception); + if (image != (Image *) NULL) + (void) SetImageChannelMask(image,channel_mask); + break; + } } if (next != (Image *) NULL) (void) CatchImageException(next);