Move "authenticate" string from image_info to Options splay-tree
diff --git a/MagickCore/image.c b/MagickCore/image.c
index b82e009..8b559d7 100644
--- a/MagickCore/image.c
+++ b/MagickCore/image.c
@@ -972,9 +972,6 @@
clone_info->verbose=image_info->verbose;
if (image_info->view != (char *) NULL)
(void) CloneString(&clone_info->view,image_info->view);
- if (image_info->authenticate != (char *) NULL)
- (void) CloneString(&clone_info->authenticate,image_info->authenticate);
- (void) CloneImageOptions(clone_info,image_info);
clone_info->progress_monitor=image_info->progress_monitor;
clone_info->client_data=image_info->client_data;
clone_info->cache=image_info->cache;
@@ -993,6 +990,8 @@
(void) CopyMagickString(clone_info->filename,image_info->filename,
MaxTextExtent);
clone_info->channel=image_info->channel;
+
+ (void) CloneImageOptions(clone_info,image_info);
clone_info->debug=IsEventLogging();
clone_info->signature=image_info->signature;
return(clone_info);
@@ -1289,15 +1288,12 @@
image_info->density=DestroyString(image_info->density);
if (image_info->view != (char *) NULL)
image_info->view=DestroyString(image_info->view);
- if (image_info->authenticate != (char *) NULL)
- image_info->authenticate=DestroyString(
- image_info->authenticate);
- DestroyImageOptions(image_info);
if (image_info->cache != (void *) NULL)
image_info->cache=DestroyPixelCache(image_info->cache);
if (image_info->profile != (StringInfo *) NULL)
image_info->profile=(void *) DestroyStringInfo((StringInfo *)
image_info->profile);
+ DestroyImageOptions(image_info);
image_info->signature=(~MagickSignature);
image_info=(ImageInfo *) RelinquishMagickMemory(image_info);
return(image_info);
diff --git a/MagickCore/image.h b/MagickCore/image.h
index 6f18b1d..4407484 100644
--- a/MagickCore/image.h
+++ b/MagickCore/image.h
@@ -426,8 +426,8 @@
verbose; /* verbose output enable/disable */
char
- *view,
- *authenticate;
+ *view;
+ /* authenticate -- moved to ImageOptions()
ChannelType
channel;
diff --git a/MagickWand/magick-property.c b/MagickWand/magick-property.c
index ec38a55..e24b5e2 100644
--- a/MagickWand/magick-property.c
+++ b/MagickWand/magick-property.c
@@ -2594,7 +2594,7 @@
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) CloneString(&wand->image_info->authenticate,passphrase);
+ (void) SetImageOption(wand->image_info,"authenticate",passphrase);
return(MagickTrue);
}
diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c
index 13ab613..2a13ce5 100644
--- a/MagickWand/mogrify.c
+++ b/MagickWand/mogrify.c
@@ -6162,19 +6162,17 @@
if (LocaleCompare("attenuate",option+1) == 0)
{
if (*option == '+')
- {
- (void) DeleteImageOption(image_info,option+1);
- break;
- }
- (void) SetImageOption(image_info,option+1,argv[i+1]);
+ (void) DeleteImageOption(image_info,option+1);
+ else
+ (void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("authenticate",option+1) == 0)
{
if (*option == '+')
- (void) CloneString(&image_info->authenticate,(char *) NULL);
+ (void) DeleteImageOption(image_info,option+1);
else
- (void) CloneString(&image_info->authenticate,argv[i+1]);
+ (void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
diff --git a/MagickWand/operation.c b/MagickWand/operation.c
index 6717a67..b09b4e4 100644
--- a/MagickWand/operation.c
+++ b/MagickWand/operation.c
@@ -43,7 +43,7 @@
%
% Anthony Thyssen, Sept 2011
*/
-#if 0
+#if 1
/*
Include declarations.
@@ -291,7 +291,7 @@
if ( token[0] == '\0' ) break;
if ( isalpha((int) token[0]) || token[0] == '#' ) {
/* Color string given */
- (void) QueryMagickColorCompliance(token,AllComplience,&color,
+ (void) QueryMagickColorCompliance(token,AllCompliance,&color,
exception);
if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
sparse_arguments[x++] = QuantumScale*color.red;
@@ -375,23 +375,26 @@
% %
% %
% %
-+ S e t t i n g s O p t i o n I n f o %
++ A p p l y S e t t i n g O p t i o n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% SettingsOptionInfo() saves the given single settings argv[0] into a
-% ImageInfo structure for later use by various image processing operations.
+% ApplySettingOption() saves the given single settings option into a CLI wand
+% holding the image_info, draw_info, quantize_info structures that is later
+% used for reading, processing, and writing images.
%
-% The format of the SettingsOptionInfo method is:
+% No image in the wand is actually modified (setting options only)
%
-% MagickBooleanType SettingsOptionInfo(ImageInfo *image_info,
+% The format of the ApplySettingOption method is:
+%
+% MagickBooleanType ApplySettingOption(MagickWand *wand,
% const int argc, const char **argv,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
-% o image_info: the image info..
+% o wand: structure holding settings to be applied
%
% o argc: Specifies a pointer to an integer describing the number of
% elements in the argument vector.
@@ -408,19 +411,24 @@
GeometryInfo
geometry_info;
- /*
- Initialize method variables.
- */
- assert(image_info != (ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- if (image_info->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
- image_info->filename);
+ ImageInfo
+ *image_info;
+
+ DrawInfo
+ *draw_info
+
+ assert(wand != (MagickWand *) NULL);
+ assert(wand->signature == WandSignature);
+ assert(wand->draw_info != (DrawInfo *) NULL); /* ensure it is a CLI wand */
+ assert(wand->quantize_info == (QuantizeInfo *) NULL);
+ if (wand->debug != MagickFalse)
+ (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (argc < 0)
return(MagickTrue);
- /*
- Set the image settings for one image.
- */
+
+ image_info=wand->image_info;
+ draw_info=wand->_info;
+
switch (*(argv[0]+1))
{
case 'a':
@@ -430,27 +438,37 @@
image_info->adjoin=(*argv[0] == '-') ? MagickTrue : MagickFalse;
break;
}
+ if (LocaleCompare("affine",argv[0]+1) == 0)
+ {
+ if (*argv[0] == '+')
+ GetAffineMatrix(draw_info->affine);
+ else
+ (void) ParseAffineGeometry(argv[1],draw_info->affine,
+ exception);
+ break;
+ }
if (LocaleCompare("antialias",argv[0]+1) == 0)
{
- image_info->antialias=(*argv[0] == '-') ? MagickTrue : MagickFalse;
+ image_info->antialias =
+ draw_info->stroke_antialias =
+ draw_info->text_antialias =
+ (*argv[0] == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("attenuate",argv[0]+1) == 0)
{
if (*argv[0] == '+')
- {
- (void) DeleteImageOption(image_info,argv[0]+1);
- break;
- }
- (void) SetImageOption(image_info,argv[0]+1,argv[1]);
+ (void) DeleteImageOption(image_info,argv[0]+1);
+ else
+ (void) SetImageOption(image_info,argv[0]+1,argv[1]);
break;
}
if (LocaleCompare("authenticate",argv[0]+1) == 0)
{
if (*argv[0] == '+')
- (void) CloneString(&image_info->authenticate,(char *) NULL);
+ (void) DeleteImageOption(image_info,argv[0]+1);
else
- (void) CloneString(&image_info->authenticate,argv[1]);
+ (void) SetImageOption(image_info,argv[0]+1,argv[1]);
break;
}
break;
@@ -462,12 +480,12 @@
if (*argv[0] == '+')
{
(void) DeleteImageOption(image_info,argv[0]+1);
- (void) QueryColorCompliance(BackgroundColor,AllComplience,
+ (void) QueryColorCompliance(BackgroundColor,AllCompliance,
&image_info->background_color,exception);
break;
}
(void) SetImageOption(image_info,argv[0]+1,argv[1]);
- (void) QueryColorCompliance(argv[1],AllComplience,
+ (void) QueryColorCompliance(argv[1],AllCompliance,
&image_info->background_color,exception);
break;
}
@@ -506,7 +524,7 @@
if (*argv[0] == '+')
{
(void) DeleteImageOption(image_info,argv[0]+1);
- (void) QueryColorCompliance(BorderColor,AllComplience,
+ (void) QueryColorCompliance(BorderColor,AllCompliance,
&image_info->border_color,exception);
break;
}
@@ -1077,12 +1095,12 @@
if (*argv[0] == '+')
{
(void) SetImageOption(image_info,argv[0]+1,argv[1]);
- (void) QueryColorCompliance(MatteColor,AllComplience,
+ (void) QueryColorCompliance(MatteColor,AllCompliance,
&image_info->matte_color,exception);
break;
}
(void) SetImageOption(image_info,argv[0]+1,argv[1]);
- (void) QueryColorCompliance(argv[1],AllComplience,&image_info->matte_color,
+ (void) QueryColorCompliance(argv[1],AllCompliance,&image_info->matte_color,
exception);
break;
}
@@ -1379,12 +1397,12 @@
{
if (*argv[0] == '+')
{
- (void) QueryColorCompliance("none",AllComplience,
+ (void) QueryColorCompliance("none",AllCompliance,
&image_info->transparent_color,exception);
(void) SetImageOption(image_info,argv[0]+1,"none");
break;
}
- (void) QueryColorCompliance("none",AllComplience,
+ (void) QueryColorCompliance("none",AllCompliance,
&image_info->transparent_color,exception);
exception);
(void) SetImageOption(image_info,argv[0]+1,argv[1]);
@@ -1595,9 +1613,6 @@
{
if (LocaleCompare("adaptive-blur",argv[0]+1) == 0)
{
- /*
- Adaptive blur image.
- */
(void) SyncImageSettings(image_info,*image);
flags=ParseGeometry(argv[1],&geometry_info);
if ((flags & SigmaValue) == 0)
@@ -1610,8 +1625,8 @@
}
if (LocaleCompare("adaptive-resize",argv[0]+1) == 0)
{
- /*
- Adaptive resize image.
+ /* FUTURE: this is really a "interpolate-resize" operator
+ "adaptive-resize" uses a fixed "Mesh" interpolation
*/
(void) SyncImageSettings(image_info,*image);
(void) ParseRegionGeometry(*image,argv[1],&geometry,exception);
@@ -1634,19 +1649,6 @@
geometry_info.sigma,geometry_info.xi,exception);
break;
}
- if (LocaleCompare("affine",argv[0]+1) == 0)
- {
- /*
- Affine matrix.
- */
- if (*argv[0] == '+')
- {
- GetAffineMatrix(&draw_info->affine);
- break;
- }
- (void) ParseAffineGeometry(argv[1],&draw_info->affine,exception);
- break;
- }
if (LocaleCompare("alpha",argv[0]+1) == 0)
{
AlphaChannelType
@@ -1664,9 +1666,6 @@
*text,
geometry[MaxTextExtent];
- /*
- Annotate image.
- */
(void) SyncImageSettings(image_info,*image);
SetGeometryInfo(&geometry_info);
flags=ParseGeometry(argv[1],&geometry_info);
@@ -1692,14 +1691,6 @@
(void) AnnotateImage(*image,draw_info,exception);
break;
}
- if (LocaleCompare("antialias",argv[0]+1) == 0)
- {
- draw_info->stroke_antialias=(*argv[0] == '-') ? MagickTrue :
- MagickFalse;
- draw_info->text_antialias=(*argv[0] == '-') ? MagickTrue :
- MagickFalse;
- break;
- }
if (LocaleCompare("auto-gamma",argv[0]+1) == 0)
{
/*
@@ -1822,17 +1813,17 @@
{
if (*argv[0] == '+')
{
- (void) QueryColorCompliance(BorderColor,AllComplience,
+ (void) QueryColorCompliance(BorderColor,AllCompliance,
&draw_info->border_color,exception);
break;
}
- (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->border_color,
+ (void) QueryColorCompliance(argv[1],AllCompliance,&draw_info->border_color,
exception);
break;
}
if (LocaleCompare("box",argv[0]+1) == 0)
{
- (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->undercolor,
+ (void) QueryColorCompliance(argv[1],AllCompliance,&draw_info->undercolor,
exception);
break;
}
@@ -2438,7 +2429,7 @@
{
(void) QueryMagickColorCompliance("none",AllCompliance,&fill,
exception);
- (void) QueryColorCompliance("none",AllComplience,&draw_info->fill,
+ (void) QueryColorCompliance("none",AllCompliance,&draw_info->fill,
exception);
if (draw_info->fill_pattern != (Image *) NULL)
draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern);
@@ -2446,7 +2437,7 @@
}
sans=AcquireExceptionInfo();
(void) QueryMagickColorCompliance(argv[1],AllCompliance,&fill,sans);
- status=QueryColorCompliance(argv[1],AllComplience,&draw_info->fill,sans);
+ status=QueryColorCompliance(argv[1],AllCompliance,&draw_info->fill,sans);
sans=DestroyExceptionInfo(sans);
if (status == MagickFalse)
draw_info->fill_pattern=GetImageCache(image_info,argv[1],
@@ -3117,11 +3108,11 @@
{
if (*argv[0] == '+')
{
- (void) QueryColorCompliance("none",AllComplience,&draw_info->fill,
+ (void) QueryColorCompliance("none",AllCompliance,&draw_info->fill,
exception);
break;
}
- (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->fill,
+ (void) QueryColorCompliance(argv[1],AllCompliance,&draw_info->fill,
exception);
break;
}
@@ -3718,7 +3709,7 @@
if (*argv[0] == '+')
{
- (void) QueryColorCompliance("none",AllComplience,&draw_info->stroke,
+ (void) QueryColorCompliance("none",AllCompliance,&draw_info->stroke,
exception);
if (draw_info->stroke_pattern != (Image *) NULL)
draw_info->stroke_pattern=DestroyImage(
@@ -3726,7 +3717,7 @@
break;
}
sans=AcquireExceptionInfo();
- status=QueryColorCompliance(argv[1],AllComplience,&draw_info->stroke,sans);
+ status=QueryColorCompliance(argv[1],AllCompliance,&draw_info->stroke,sans);
sans=DestroyExceptionInfo(sans);
if (status == MagickFalse)
draw_info->stroke_pattern=GetImageCache(image_info,argv[1],
@@ -3890,7 +3881,7 @@
{
if (LocaleCompare("undercolor",argv[0]+1) == 0)
{
- (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->undercolor,
+ (void) QueryColorCompliance(argv[1],AllCompliance,&draw_info->undercolor,
exception);
break;
}
diff --git a/coders/pcl.c b/coders/pcl.c
index 50d64a3..7f9c607 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -157,6 +157,9 @@
options[MaxTextExtent],
input_filename[MaxTextExtent];
+ const char
+ *option;
+
const DelegateInfo
*delegate_info;
@@ -347,9 +350,10 @@
if (read_info->scenes != (char *) NULL)
*read_info->scenes='\0';
}
- if (read_info->authenticate != (char *) NULL)
+ option=GetImageOption(read_info,"authenticate");
+ if (option != (const char *) NULL)
(void) FormatLocaleString(options+strlen(options),MaxTextExtent,
- " -sPCLPassword=%s",read_info->authenticate);
+ " -sPCLPassword=%s",option);
(void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
(void) AcquireUniqueFilename(read_info->filename);
(void) FormatLocaleString(command,MaxTextExtent,
diff --git a/coders/pdf.c b/coders/pdf.c
index 410495d..514181f 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -622,9 +622,10 @@
if (read_info->scenes != (char *) NULL)
*read_info->scenes='\0';
}
- if (read_info->authenticate != (char *) NULL)
+ option=GetImageOption(read_info,"authenticate");
+ if (option != (const char *) NULL)
(void) FormatLocaleString(options+strlen(options),MaxTextExtent,
- " -sPDFPassword=%s",read_info->authenticate);
+ " -sPCLPassword=%s",option);
(void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
(void) AcquireUniqueFilename(filename);
(void) ConcatenateMagickString(filename,"-%08d",MaxTextExtent);
diff --git a/coders/xps.c b/coders/xps.c
index 274b278..0d6d480 100644
--- a/coders/xps.c
+++ b/coders/xps.c
@@ -110,6 +110,9 @@
options[MaxTextExtent],
input_filename[MaxTextExtent];
+ const char
+ option;
+
const DelegateInfo
*delegate_info;
@@ -300,9 +303,10 @@
if (read_info->scenes != (char *) NULL)
*read_info->scenes='\0';
}
- if (read_info->authenticate != (char *) NULL)
+ option=GetImageOption(read_info,"authenticate");
+ if (option != (const char *) NULL)
(void) FormatLocaleString(options+strlen(options),MaxTextExtent,
- " -sXPSPassword=%s",read_info->authenticate);
+ " -sPCLPassword=%s",option);
(void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
(void) AcquireUniqueFilename(read_info->filename);
(void) FormatLocaleString(command,MaxTextExtent,