From: anthony Date: Tue, 26 Oct 2010 06:30:24 +0000 (+0000) Subject: Minor update for Boolean Artifact Handling X-Git-Tag: 7.0.1-0~8612 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=28ad1d779b6ca95852e860514185a7a97e06af77;p=imagemagick Minor update for Boolean Artifact Handling --- diff --git a/magick/morphology.c b/magick/morphology.c index 444274924..7b7c3229f 100644 --- a/magick/morphology.c +++ b/magick/morphology.c @@ -77,6 +77,7 @@ #include "magick/string_.h" #include "magick/string-private.h" #include "magick/token.h" +#include "magick/utility.h" /* @@ -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); diff --git a/magick/resample.c b/magick/resample.c index 1c450e135..48070b33a 100644 --- a/magick/resample.c +++ b/magick/resample.c @@ -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... diff --git a/magick/resize.c b/magick/resize.c index 74364f5a7..af1540cae 100644 --- a/magick/resize.c +++ b/magick/resize.c @@ -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,