]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Sun, 5 Aug 2018 21:56:56 +0000 (17:56 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 5 Aug 2018 21:56:56 +0000 (17:56 -0400)
PerlMagick/Magick.xs
PerlMagick/quantum/quantum.xs.in

index 727369ee756faf5adaa6eab9889729a11109db82..7633093e6264f1991bd6d156ad1d2d4dd1659f2a 100644 (file)
@@ -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);
index 52d4382a30d492c7f119ff72713921af407a2a78..3297af940228013c3e51f576fbd64a141161a0ef 100644 (file)
@@ -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);