x++; /* floating point argument */
}
/* control points and color values */
- error = IsMagickTrue( x % (2+number_colors) );
+ if ((x % (2+number_colors)) != 0)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "InvalidArgument","'%s': %s", "sparse-color",
+ "Invalid number of Arguments");
+ return( (Image *) NULL);
+ }
+ error=MagickFalse;
number_arguments=x;
- if ( IfMagickTrue(error) ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError, "InvalidArgument", "'%s': %s", "sparse-color",
- "Invalid number of Arguments");
- return( (Image *) NULL);
- }
/* Allocate and fill in the floating point arguments */
sparse_arguments=(double *) AcquireQuantumMemory(number_arguments,
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError, "InvalidArgument", "'%s': %s", "sparse-color",
"Color found, instead of X-coord");
- error = MagickTrue;
+ error=MagickTrue;
break;
}
sparse_arguments[x++]=StringToDouble(token,(char **) NULL);
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError, "InvalidArgument", "'%s': %s", "sparse-color",
"Color found, instead of Y-coord");
- error = MagickTrue;
+ error=MagickTrue;
break;
}
sparse_arguments[x++]=StringToDouble(token,(char **) NULL);
}
}
}
- if ( number_arguments != x && !error ) {
- (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
- "InvalidArgument","'%s': %s","sparse-color","Argument Parsing Error");
- sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments);
- return( (Image *) NULL);
- }
- if ( error )
- return( (Image *) NULL);
-
+ if (error != MagickFalse)
+ {
+ sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments);
+ return((Image *) NULL);
+ }
+ if (number_arguments != x)
+ {
+ sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "InvalidArgument","'%s': %s","sparse-color","Argument Parsing Error");
+ return((Image *) NULL);
+ }
/* Call the Sparse Color Interpolation function with the parsed arguments */
sparse_image=SparseColorImage(image,method,number_arguments,sparse_arguments,
exception);
#define _draw_info (cli_wand->draw_info)
#define _quantize_info (cli_wand->quantize_info)
#define IfSetOption (*option=='-')
-#define ArgBoolean IsMagickTrue(IfSetOption)
-#define ArgBooleanNot IsMagickFalse(IfSetOption)
+#define ArgBoolean IfSetOption ? MagickTrue : MagickFalse
+#define ArgBooleanNot IfSetOption ? MagickFalse : MagickTrue
#define ArgBooleanString (IfSetOption?"true":"false")
#define ArgOption(def) (IfSetOption?arg1:(const char *)(def))
/* DefineImageOption() equals SetImageOption() but with '=' */
if (IfSetOption)
(void) DefineImageOption(_image_info,arg1);
- else if (IsMagickFalse(DeleteImageOption(_image_info,arg1)))
+ else if (DeleteImageOption(_image_info,arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"NoSuchOption",option,arg1);
break;
}
{
if (LocaleCompare("weight",option+1) == 0)
{
- /* Just what does using a font 'weight' do ???
- There is no "-list weight" output (reference manual says there is)
- */
- arg1=ArgOption("all");
- _draw_info->weight=StringToUnsignedLong(arg1);
- if (LocaleCompare(arg1,"all") == 0)
- _draw_info->weight=0;
- if (LocaleCompare(arg1,"bold") == 0)
- _draw_info->weight=700;
- if (LocaleCompare(arg1,"bolder") == 0)
- if (_draw_info->weight <= 800)
- _draw_info->weight+=100;
- if (LocaleCompare(arg1,"lighter") == 0)
- if (_draw_info->weight >= 100)
- _draw_info->weight-=100;
- if (LocaleCompare(arg1,"normal") == 0)
- _draw_info->weight=400;
+ ssize_t
+ weight;
+
+ weight=ParseCommandOption(MagickWeightOptions,MagickFalse,arg1);
+ if (weight == -1)
+ weight=StringToUnsignedLong(arg1);
+ _draw_info->weight=(size_t) weight;
break;
}
if (LocaleCompare("white-point",option+1) == 0)
#define _option_type ((CommandOptionFlags) cli_wand->command->flags)
#define IfNormalOp (*option=='-')
#define IfPlusOp (*option!='-')
-#define IsNormalOp IsMagickTrue(IfNormalOp)
-#define IsPlusOp IsMagickFalse(IfNormalOp)
+#define IsNormalOp IfNormalOp ? MagickTrue : MagickFalse
+#define IsPlusOp IfNormalOp ? MagickFalse : MagickTrue
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == MagickWandSignature);
if (IfNormalOp)
(void) ClipImage(_image,_exception);
else /* "+mask" remove the write mask */
- (void) SetImageMask(_image,(Image *) NULL,_exception);
+ (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL,_exception);
break;
}
if (LocaleCompare("clip-mask",option+1) == 0)
if (IfPlusOp) {
/* use "+clip-mask" Remove the write mask for -clip-path */
- (void) SetImageMask(_image,(Image *) NULL,_exception);
+ (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL,_exception);
break;
}
mask_image=GetImageCache(_image_info,arg1,_exception);
mask_view=DestroyCacheView(mask_view);
mask_image->alpha_trait=BlendPixelTrait;
(void) SetImageColorspace(_image,GRAYColorspace,_exception);
- (void) SetImageMask(_image,mask_image,_exception);
+ (void) SetImageMask(_image,ReadPixelMask,mask_image,_exception);
mask_image=DestroyImage(mask_image);
break;
}
}
if (LocaleCompare("mask",option+1) == 0)
{
- /* Note: arguments do not have percent escapes expanded */
- Image
- *mask;
-
- if (IfPlusOp)
- { /* Remove a mask. */
- (void) SetImageMask(_image,(Image *) NULL,_exception);
- break;
- }
- /* Set the image mask. */
- mask=GetImageCache(_image_info,arg1,_exception);
- if (mask == (Image *) NULL)
- break;
- (void) SetImageMask(_image,mask,_exception);
- mask=DestroyImage(mask);
+ CLIWandWarnReplaced("-read-mask");
+ (void) CLISimpleOperatorImage(cli_wand,"-read-mask",NULL,NULL,
+ exception);
break;
}
if (LocaleCompare("matte",option+1) == 0)
(void) RandomThresholdImage(_image,arg1,_exception);
break;
}
+ if (LocaleCompare("read-mask",option+1) == 0)
+ {
+ /* Note: arguments do not have percent escapes expanded */
+ Image
+ *mask;
+
+ if (IfPlusOp)
+ { /* Remove a mask. */
+ (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL,
+ _exception);
+ break;
+ }
+ /* Set the image mask. */
+ mask=GetImageCache(_image_info,arg1,_exception);
+ if (mask == (Image *) NULL)
+ break;
+ (void) SetImageMask(_image,ReadPixelMask,mask,_exception);
+ mask=DestroyImage(mask);
+ break;
+ }
if (LocaleCompare("recolor",option+1) == 0)
{
CLIWandWarnReplaced("-color-matrix");
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & RhoValue) == 0)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg2);
- new_image=SpreadImage(_image,geometry_info.rho,_image->interpolate,
- _exception);
+ new_image=SpreadImage(_image,_image->interpolate,geometry_info.rho,
+ _exception);
break;
}
if (LocaleCompare("statistic",option+1) == 0)
(void) WhiteThresholdImage(_image,arg1,_exception);
break;
}
+ if (LocaleCompare("write-mask",option+1) == 0)
+ {
+ /* Note: arguments do not have percent escapes expanded */
+ Image
+ *mask;
+
+ if (IfPlusOp)
+ { /* Remove a mask. */
+ (void) SetImageMask(_image,WritePixelMask,(Image *) NULL,
+ _exception);
+ break;
+ }
+ /* Set the image mask. */
+ mask=GetImageCache(_image_info,arg1,_exception);
+ if (mask == (Image *) NULL)
+ break;
+ (void) SetImageMask(_image,WritePixelMask,mask,_exception);
+ mask=DestroyImage(mask);
+ break;
+ }
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
default:
#define _option_type ((CommandOptionFlags) cli_wand->command->flags)
#define IfNormalOp (*option=='-')
#define IfPlusOp (*option!='-')
-#define IsNormalOp IsMagickTrue(IfNormalOp)
+#define IsNormalOp IfNormalOp ? MagickTrue : MagickFalse
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == MagickWandSignature);
value=GetImageOption(_image_info,"compose:outside-overlay");
if (value != (const char *) NULL) { /* or this false */
/* FUTURE: depreciate warning for "compose:outside-overlay"*/
- clip_to_self= IsMagickFalse(IsStringNotFalse(value));
+ clip_to_self=IsStringFalse(value);
}
new_images=RemoveFirstImageFromList(&_images);