]> granicus.if.org Git - imagemagick/commitdiff
Minor update for Boolean Artifact Handling
authoranthony <anthony@git.imagemagick.org>
Tue, 26 Oct 2010 06:30:24 +0000 (06:30 +0000)
committeranthony <anthony@git.imagemagick.org>
Tue, 26 Oct 2010 06:30:24 +0000 (06:30 +0000)
magick/morphology.c
magick/resample.c
magick/resize.c

index 444274924e55f9a3bb787d614814b3b04f4ca575..7b7c3229f61a1bdb19306e8830fab8402ddc8534 100644 (file)
@@ -77,6 +77,7 @@
 #include "magick/string_.h"
 #include "magick/string-private.h"
 #include "magick/token.h"
+#include "magick/utility.h"
 \f
 
 /*
@@ -3193,8 +3194,8 @@ MagickExport Image *MorphologyApply(const Image *image, const ChannelType
   if ( iterations < 0 )  /* negative interations = infinite (well alomst) */
      kernel_limit = image->columns > image->rows ? image->columns : image->rows;
 
-  verbose = ( GetImageArtifact(image,"verbose") != (const char *) NULL ) ?
-    MagickTrue : MagickFalse;
+
+  verbose = IsMagickTrue(GetImageArtifact(image,"verbose"));
 
   /* initialise for cleanup */
   curr_image = (Image *) image;
@@ -3596,9 +3597,6 @@ MagickExport Image *MorphologyImageChannel(const Image *image,
   const ChannelType channel,const MorphologyMethod method,
   const ssize_t iterations,const KernelInfo *kernel,ExceptionInfo *exception)
 {
-  const char
-    *artifact;
-
   KernelInfo
     *curr_kernel;
 
@@ -3616,6 +3614,8 @@ MagickExport Image *MorphologyImageChannel(const Image *image,
   curr_kernel = (KernelInfo *) kernel;
   if ( method == ConvolveMorphology ||  method == CorrelateMorphology )
     {
+      const char
+        *artifact;
       artifact = GetImageArtifact(image,"convolve:scale");
       if ( artifact != (const char *)NULL ) {
         if ( curr_kernel == kernel )
@@ -3629,12 +3629,9 @@ MagickExport Image *MorphologyImageChannel(const Image *image,
     }
 
   /* display the (normalized) kernel via stderr */
-  artifact = GetImageArtifact(image,"showkernel");
-  if ( artifact == (const char *) NULL)
-    artifact = GetImageArtifact(image,"convolve:showkernel");
-  if ( artifact == (const char *) NULL)
-    artifact = GetImageArtifact(image,"morphology:showkernel");
-  if ( artifact != (const char *) NULL)
+  if ( IsMagickTrue(GetImageArtifact(image,"showkernel"))
+    || IsMagickTrue(GetImageArtifact(image,"convolve:showkernel"))
+    || IsMagickTrue(GetImageArtifact(image,"morphology:showkernel")) )
     ShowKernelInfo(curr_kernel);
 
   /* Override the default handling of multi-kernel morphology results
@@ -3643,12 +3640,14 @@ MagickExport Image *MorphologyImageChannel(const Image *image,
    * Otherwise merge resulting images using compose method given.
    * Default for 'HitAndMiss' is 'Lighten'.
    */
-  compose = UndefinedCompositeOp;  /* use default for method */
-  artifact = GetImageArtifact(image,"morphology:compose");
-  if ( artifact != (const char *) NULL)
-    compose = (CompositeOperator) ParseMagickOption(
+  { const char
+      *artifact;
+    artifact = GetImageArtifact(image,"morphology:compose");
+    compose = UndefinedCompositeOp;  /* use default for method */
+    if ( artifact != (const char *) NULL)
+      compose = (CompositeOperator) ParseMagickOption(
                              MagickComposeOptions,MagickFalse,artifact);
-
+  }
   /* Apply the Morphology */
   morphology_image = MorphologyApply(image, channel, method, iterations,
                          curr_kernel, compose, image->bias, exception);
index 1c450e135d98508f50313ca014423bdf5ce698d2..48070b33a19a42b526ecf2e6814029317042f587 100644 (file)
@@ -60,6 +60,7 @@
 #include "magick/resize-private.h"
 #include "magick/transform.h"
 #include "magick/signature-private.h"
+#include "magick/utility.h"
 /*
   EWA Resampling Options
 */
@@ -1874,10 +1875,10 @@ MagickExport void SetResampleFilter(ResampleFilter *resample_filter,
        Q;
     double
        r_scale;
+
     /* Scale radius so the filter LUT covers the full support range */
     r_scale = resample_filter->support*sqrt(1.0/(double)WLUT_WIDTH);
-    if (GetImageArtifact(resample_filter->image,"resample:verbose")
-          != (const char *) NULL)
+    if (IsMagickTrue(GetImageArtifact(resample_filter->image,"resample:verbose")) )
       {
         /* Debug output of the filter weighting LUT
           Gnuplot the LUT with hoizontal adjusted to 'r' using...
index 74364f5a7e8f1f2900f0ffa926b41f571c374703..af1540cae4d8cc127113e45a7ac942a99272ecc3 100644 (file)
@@ -574,9 +574,9 @@ static MagickRealType Welsh(const MagickRealType x,
 %  you make good use of "filter:verbose" to make sure that the overall
 %  effect of your selection (before and after) is as expected.
 %
-%    "filter:verbose" Output the exact results of the filter
-%         selections made, as well as plotting data for graphing the
-%         resulting filter over support range (blur adjusted).
+%    "filter:verbose" controls whether to output the exact results of
+%        the filter selections made, as well as plotting data for
+%        graphing the resulting filter over the filters support range.
 %
 %    "filter:filter"    Select the main function associated with
 %        this filter name, as the weighting function of the filter.
@@ -1074,7 +1074,7 @@ MagickExport ResizeFilter *AcquireResizeFilter(const Image *image,
   {
 #endif
     artifact=GetImageArtifact(image,"filter:verbose");
-    if (artifact != (const char *) NULL)
+    if (IsMagickTrue(artifact))
       {
         double
           support,