From fd706f930f397221c6ba26f112e96e262fb0ba2e Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 19 Jan 2012 04:22:02 +0000 Subject: [PATCH] More changed for IMv7 CLI interface (half of SimpleOperators) --- MagickCore/colormap.c | 3 + MagickCore/draw.h | 32 +- MagickCore/effect.c | 1 + MagickCore/fx.c | 11 +- MagickCore/image.c | 8 +- MagickCore/image.h | 43 +-- MagickCore/matrix.c | 30 +- MagickCore/option.c | 30 +- MagickCore/option.h | 30 +- MagickCore/resize.c | 246 ++++++++----- MagickCore/resize.h | 3 +- MagickCore/widget.c | 2 +- MagickWand/convert.c | 13 +- MagickWand/magick-image.c | 59 ++- MagickWand/magick-image.h | 5 +- MagickWand/magick-wand.c | 2 +- MagickWand/mogrify.c | 95 +++-- MagickWand/operation.c | 741 ++++++++++++++++---------------------- MagickWand/operation.h | 14 +- 19 files changed, 667 insertions(+), 701 deletions(-) diff --git a/MagickCore/colormap.c b/MagickCore/colormap.c index d5ff3e804..7c937cb1e 100644 --- a/MagickCore/colormap.c +++ b/MagickCore/colormap.c @@ -163,6 +163,9 @@ MagickExport MagickBooleanType AcquireImageColormap(Image *image, % positions. If you cycle the colormap a number of times you can produce % a psychodelic effect. % +% WARNING: this assumes an images colormap is in a well know and defined +% order. Currently Imagemagick has no way of setting that order. +% % The format of the CycleColormapImage method is: % % MagickBooleanType CycleColormapImage(Image *image,const ssize_t displace, diff --git a/MagickCore/draw.h b/MagickCore/draw.h index 636917e2a..b286df5d7 100644 --- a/MagickCore/draw.h +++ b/MagickCore/draw.h @@ -207,12 +207,15 @@ typedef struct _DrawInfo AffineMatrix affine; - GravityType - gravity; - PixelInfo fill, - stroke; + stroke, + undercolor, + border_color; + + Image + *fill_pattern, + *stroke_pattern; double stroke_width; @@ -220,10 +223,6 @@ typedef struct _DrawInfo GradientInfo gradient; - Image - *fill_pattern, - *stroke_pattern; - MagickBooleanType stroke_antialias, text_antialias; @@ -250,16 +249,14 @@ typedef struct _DrawInfo compose; char - *text; - - size_t - face; - - char + *text, *font, *metrics, *family; + size_t + face; + StyleType style; @@ -281,9 +278,8 @@ typedef struct _DrawInfo AlignType align; - PixelInfo - undercolor, - border_color; + GravityType + gravity; char *server_name; @@ -318,13 +314,13 @@ typedef struct _DrawInfo direction; MagickBooleanType - debug; size_t signature; } DrawInfo; + typedef struct _PrimitiveInfo { PointInfo diff --git a/MagickCore/effect.c b/MagickCore/effect.c index 546e52562..c7781c033 100644 --- a/MagickCore/effect.c +++ b/MagickCore/effect.c @@ -1296,6 +1296,7 @@ MagickExport Image *ConvolveImage(const Image *image, return(convolve_image); /* Convolve image. + FUTURE: Use Morphology Convolve instead. */ center=(ssize_t) GetPixelChannels(image)*(image->columns+kernel_info->width)* (kernel_info->height/2L)+GetPixelChannels(image)*(kernel_info->width/2L); diff --git a/MagickCore/fx.c b/MagickCore/fx.c index b55dd6f86..2ca0240a1 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -690,7 +690,7 @@ MagickExport Image *ColorizeImage(const Image *image,const char *blend, if (blend == (const char *) NULL) return(colorize_image); /* - Determine RGB values of the pen color. + Determine RGB values of the fill color for pixel */ GetPixelInfo(image,&pixel); flags=ParseGeometry(blend,&geometry_info); @@ -869,6 +869,11 @@ MagickExport Image *ColorizeImage(const Image *image,const char *blend, % o exception: return any errors or warnings in this structure. % */ +/* FUTURE: modify to make use of a MagickMatrix Mutliply function + That should be provided in "matrix.c" + (ASIDE: actually distorts should do this too but currently doesn't) +*/ + MagickExport Image *ColorMatrixImage(const Image *image, const KernelInfo *color_matrix,ExceptionInfo *exception) { @@ -907,7 +912,7 @@ MagickExport Image *ColorMatrixImage(const Image *image, y; /* - Create color matrix. + Map given color_matrix, into a 6x6 matrix RGBKA and a constant */ assert(image != (Image *) NULL); assert(image->signature == MagickSignature); @@ -959,7 +964,7 @@ MagickExport Image *ColorMatrixImage(const Image *image, message=DestroyString(message); } /* - ColorMatrix image. + Apply the ColorMatrix to image. */ status=MagickTrue; progress=0; diff --git a/MagickCore/image.c b/MagickCore/image.c index 72498c752..bd2dbc6ee 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -269,7 +269,6 @@ MagickExport Image *AcquireImage(const ImageInfo *image_info, image->client_data=image_info->client_data; if (image_info->cache != (void *) NULL) ClonePixelCacheMethods(image->cache,image_info->cache); - (void) SetImageVirtualPixelMethod(image,image_info->virtual_pixel_method); (void) SyncImageSettings(image_info,image,exception); option=GetImageOption(image_info,"delay"); if (option != (const char *) NULL) @@ -966,7 +965,6 @@ MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info) SetImageInfoFile(clone_info,image_info->file); SetImageInfoBlob(clone_info,image_info->blob,image_info->length); clone_info->stream=image_info->stream; - clone_info->virtual_pixel_method=image_info->virtual_pixel_method; (void) CopyMagickString(clone_info->magick,image_info->magick,MaxTextExtent); (void) CopyMagickString(clone_info->unique,image_info->unique,MaxTextExtent); (void) CopyMagickString(clone_info->zero,image_info->zero,MaxTextExtent); @@ -2747,7 +2745,7 @@ MagickExport MagickBooleanType SetImageStorageClass(Image *image, % % o image: the image. % -% o clip_mask: the image clip path. +% o clip_mask: the image clip mask, NULL undefines. % % o exception: return any errors or warnings in this structure. % @@ -4278,6 +4276,10 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, } image->units=units; } + option=GetImageOption(image_info,"virtual-pixel"); + if (option != (const char *) NULL) + (void) SetImageVirtualPixelMethod(image, (VirtualPixelMethod) + ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,option)); option=GetImageOption(image_info,"white-point"); if (option != (const char *) NULL) { diff --git a/MagickCore/image.h b/MagickCore/image.h index f8e04ba4a..b6f0c39eb 100644 --- a/MagickCore/image.h +++ b/MagickCore/image.h @@ -150,33 +150,34 @@ struct _Image storage_class; ColorspaceType - colorspace; /* colorspace of image data */ + colorspace; /* colorspace of image data */ CompressionType - compression; /* compression of image when read/write */ + compression; /* compression of image when read/write */ size_t - quality; /* compression quality setting, meaning varies */ + quality; /* compression quality setting, meaning varies */ OrientationType - orientation; /* photo orientation of image */ + orientation; /* photo orientation of image */ MagickBooleanType - taint, /* has image been modified since reading */ - matte; /* is transparency channel defined and active */ + taint, /* has image been modified since reading */ + matte; /* is transparency channel defined and active */ size_t - columns, /* physical size of image */ + columns, /* physical size of image */ rows, - depth, /* depth of image on read/write */ - colors; /* Size of color table, or actual color count if known */ - /* Only valid if image is not DirectClass */ + depth, /* depth of image on read/write */ + colors; /* Size of color table, or actual color count */ + /* Only valid if image is not DirectClass */ PixelInfo *colormap, - background_color, /* current background color attribute */ - border_color, /* current bordercolor attribute */ - matte_color; /* current mattecolor attribute */ + background_color, /* current background color attribute */ + border_color, /* current bordercolor attribute */ + matte_color, /* current mattecolor attribute */ + transparent_color; /* color for 'transparent' color index in GIF */ double gamma; @@ -254,9 +255,6 @@ struct _Image MagickBooleanType black_point_compensation; - PixelInfo - transparent_color; /* color for 'transparent' color index in GIF */ - struct _Image *mask; @@ -344,10 +342,10 @@ struct _Image struct _ImageInfo { CompressionType - compression; + compression; /* compression method when reading/saving image */ OrientationType - orientation; + orientation; /* orientation setting */ MagickBooleanType temporary, @@ -364,7 +362,7 @@ struct _ImageInfo size_t scene, /* starting value for image save numbering */ number_scenes, /* total number of images in list - for escapes */ - depth; + depth; /* current read/save depth of images */ InterlaceType interlace; /* interlace for image write */ @@ -398,8 +396,8 @@ struct _ImageInfo /* the same for undercolor (for font drawing) */ MagickBooleanType - dither, /* dither enable-disable */ - monochrome; /* read/write pcl,pdf,ps,xps as monocrome image */ + dither, /* dither enable-disable */ + monochrome; /* read/write pcl,pdf,ps,xps as monocrome image */ ColorspaceType colorspace; @@ -429,9 +427,6 @@ struct _ImageInfo void *options; /* splay tree of use options */ - VirtualPixelMethod - virtual_pixel_method; - void *profile; diff --git a/MagickCore/matrix.c b/MagickCore/matrix.c index d9d3d4423..1cf2e407d 100644 --- a/MagickCore/matrix.c +++ b/MagickCore/matrix.c @@ -58,9 +58,11 @@ % AcquireMagickMatrix() allocates and returns a matrix in the form of an % array of pointers to an array of doubles, with all values pre-set to zero. % -% This used to generate the two dimensional matrix, and vectors required -% for the GaussJordanElimination() method below, solving some system of -% simultanious equations. +% This used to generate the two dimensional matrix, that can be referenced +% using the simple C-code of the form "matrix[y][x]". +% +% This matrix is typically used for perform for the GaussJordanElimination() +% method below, solving some system of simultanious equations. % % The format of the AcquireMagickMatrix method is: % @@ -134,7 +136,7 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows, % o vectors: the additional matrix argumenting the matrix for row reduction. % Producing an 'array of column vectors'. % -% o rank: The size of the matrix (both rows and columns). +% o rank: The size of the square matrix (both rows and columns). % Also represents the number terms that need to be solved. % % o number_vectors: Number of vectors columns, argumenting the above matrix. @@ -147,9 +149,14 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows, % % However 'vectors' is a 'array of column pointers' which can have any number % of columns, with each column array the same 'rank' size as 'matrix'. +% It is assigned vector[column][row] where 'column' is the specific +% 'result' and 'row' is the 'values' for that answer. After processing +% the same vector array contains the 'weights' (answers) for each of the +% 'separatable' results. % % This allows for simpler handling of the results, especially is only one -% column 'vector' is all that is required to produce the desired solution. +% column 'vector' is all that is required to produce the desired solution +% for that specific set of equations. % % For example, the 'vectors' can consist of a pointer to a simple array of % doubles. when only one set of simultanious equations is to be solved from @@ -169,11 +176,14 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows, % % Another example is generation of a color gradient from a set of colors % at specific coordients, such as a list x,y -> r,g,b,a -% (Reference to be added - Anthony) +% +% See LeastSquaresAddTerms() below for such an example. % % You can also use the 'vectors' to generate an inverse of the given 'matrix' % though as a 'column first array' rather than a 'row first array' (matrix -% is transposed). For details see +% is transposed). +% +% For details of this process see... % http://en.wikipedia.org/wiki/Gauss-Jordan_elimination % */ @@ -343,10 +353,10 @@ MagickPrivate MagickBooleanType GaussJordanElimination(double **matrix, % ... % if ( GaussJordanElimination(matrix,vectors,3UL,2UL) ) { % c0 = vectors[0][0]; -% c2 = vectors[0][1]; +% c2 = vectors[0][1]; %* weights to calculate u from any given x,y *% % c4 = vectors[0][2]; % c1 = vectors[1][0]; -% c3 = vectors[1][1]; +% c3 = vectors[1][1]; %* weights for calculate v from any given x,y *% % c5 = vectors[1][2]; % } % else @@ -354,6 +364,8 @@ MagickPrivate MagickBooleanType GaussJordanElimination(double **matrix, % RelinquishMagickMatrix(matrix,3UL); % RelinquishMagickMatrix(vectors,2UL); % +% More examples can be found in "distort.c" +% */ MagickPrivate void LeastSquaresAddTerms(double **matrix,double **vectors, const double *terms,const double *results,const size_t rank, diff --git a/MagickCore/option.c b/MagickCore/option.c index 10e494168..17bdf6878 100644 --- a/MagickCore/option.c +++ b/MagickCore/option.c @@ -164,8 +164,8 @@ static const OptionInfo { "-adaptive-resize", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+adaptive-sharpen", 1L, DeprecateOptionFlag, MagickTrue }, { "-adaptive-sharpen", 1L, SimpleOperatorOptionFlag, MagickFalse }, - { "+affine", 0L, DrawInfoOptionFlag, MagickFalse }, - { "-affine", 1L, DrawInfoOptionFlag, MagickFalse }, + { "+affine", 0L, DrawInfoOptionFlag | DeprecateOptionFlag, MagickTrue }, + { "-affine", 1L, DrawInfoOptionFlag | DeprecateOptionFlag, MagickTrue }, { "+affinity", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, { "-affinity", 1L, DeprecateOptionFlag | FireOptionFlag, MagickTrue }, { "+alpha", 1L, DeprecateOptionFlag, MagickTrue }, @@ -204,9 +204,9 @@ static const OptionInfo { "-blend", 1L, NonConvertOptionFlag, MagickFalse }, { "+blue-primary", 0L, ImageInfoOptionFlag, MagickFalse }, { "-blue-primary", 1L, ImageInfoOptionFlag, MagickFalse }, - { "+blue-shift", 1L, DeprecateOptionFlag, MagickTrue }, + { "+blue-shift", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "-blue-shift", 1L, SimpleOperatorOptionFlag, MagickFalse }, - { "+blur", 1L, DeprecateOptionFlag, MagickTrue }, + { "+blur", 0L, DeprecateOptionFlag, MagickTrue }, { "-blur", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+border", 1L, DeprecateOptionFlag, MagickTrue }, { "-border", 1L, SimpleOperatorOptionFlag, MagickFalse }, @@ -236,7 +236,7 @@ static const OptionInfo { "-clip", 0L, SimpleOperatorOptionFlag, MagickFalse }, { "+clip-mask", 0L, SimpleOperatorOptionFlag, MagickFalse }, { "-clip-mask", 1L, SimpleOperatorOptionFlag, MagickFalse }, - { "+clip-path", 0L, SimpleOperatorOptionFlag, MagickFalse }, + { "+clip-path", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "-clip-path", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+clone", 0L, SpecialOperatorOptionFlag, MagickFalse }, { "-clone", 1L, SpecialOperatorOptionFlag, MagickFalse }, @@ -284,14 +284,14 @@ static const OptionInfo { "-deconstruct", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, { "+define", 1L, ImageInfoOptionFlag, MagickFalse }, { "-define", 1L, ImageInfoOptionFlag, MagickFalse }, - { "+delay", 0L, ImageInfoOptionFlag | SimpleOperatorOptionFlag, MagickFalse }, - { "-delay", 1L, ImageInfoOptionFlag | SimpleOperatorOptionFlag, MagickFalse }, + { "+delay", 0L, ImageInfoOptionFlag, MagickFalse }, + { "-delay", 1L, ImageInfoOptionFlag, MagickFalse }, { "+delete", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, { "-delete", 1L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, { "+density", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "-density", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, - { "+depth", 0L, ImageInfoOptionFlag | SimpleOperatorOptionFlag, MagickFalse }, - { "-depth", 1L, ImageInfoOptionFlag | SimpleOperatorOptionFlag, MagickFalse }, + { "+depth", 0L, ImageInfoOptionFlag, MagickFalse }, + { "-depth", 1L, ImageInfoOptionFlag, MagickFalse }, { "+descend", 0L, NonConvertOptionFlag, MagickFalse }, { "-descend", 1L, NonConvertOptionFlag, MagickFalse }, { "+deskew", 0L, SimpleOperatorOptionFlag, MagickFalse }, @@ -312,7 +312,7 @@ static const OptionInfo { "-distort", 2L, SimpleOperatorOptionFlag, MagickFalse }, { "+dither", 0L, ImageInfoOptionFlag | QuantizeInfoOptionFlag, MagickFalse }, { "-dither", 1L, ImageInfoOptionFlag | QuantizeInfoOptionFlag, MagickFalse }, - { "+draw", 0L, SimpleOperatorOptionFlag, MagickFalse }, + { "+draw", 0L, DeprecateOptionFlag, MagickTrue }, { "-draw", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+duplicate", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, { "-duplicate", 1L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, @@ -366,6 +366,8 @@ static const OptionInfo { "-format", 1L, ImageInfoOptionFlag, MagickFalse }, { "+frame", 1L, DeprecateOptionFlag, MagickTrue }, { "-frame", 1L, SimpleOperatorOptionFlag, MagickFalse }, + { "+function", 2L, DeprecateOptionFlag, MagickTrue }, + { "-function", 2L,SimpleOperatorOptionFlag, MagickFalse }, { "+fuzz", 0L, ImageInfoOptionFlag, MagickFalse }, { "-fuzz", 1L, ImageInfoOptionFlag, MagickFalse }, { "+fx", 1L, DeprecateOptionFlag | FireOptionFlag, MagickTrue }, @@ -412,6 +414,8 @@ static const OptionInfo { "-interpolate", 1L, ImageInfoOptionFlag, MagickFalse }, { "+interword-spacing", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "-interword-spacing", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, + { "+interpolative-resize", 1L, DeprecateOptionFlag, MagickTrue }, + { "-interpolative-resize", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+kerning", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "-kerning", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "+label", 0L, ImageInfoOptionFlag, MagickFalse }, @@ -428,8 +432,6 @@ static const OptionInfo { "-limit", 2L, GlobalOptionFlag | ListOperatorOptionFlag | FireOptionFlag, MagickFalse }, { "+linear-stretch", 1L, DeprecateOptionFlag, MagickTrue }, { "-linear-stretch", 1L, SimpleOperatorOptionFlag, MagickFalse }, - { "+linewidth", 0L, DrawInfoOptionFlag | DeprecateOptionFlag, MagickTrue }, - { "-linewidth", 1L, DrawInfoOptionFlag | DeprecateOptionFlag, MagickTrue }, { "+liquid-rescale", 1L, DeprecateOptionFlag, MagickTrue }, { "-liquid-rescale", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+list", 0L, DeprecateOptionFlag, MagickTrue }, @@ -502,8 +504,6 @@ static const OptionInfo { "-pause", 1L, NonConvertOptionFlag, MagickFalse }, { "+passphrase", 0L, DeprecateOptionFlag, MagickTrue }, { "-passphrase", 1L, DeprecateOptionFlag, MagickTrue }, - { "+pen", 0L, DeprecateOptionFlag, MagickTrue }, - { "-pen", 1L, DeprecateOptionFlag, MagickTrue }, { "+ping", 0L, ImageInfoOptionFlag, MagickFalse }, { "-ping", 0L, ImageInfoOptionFlag, MagickFalse }, { "+pointsize", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, @@ -667,7 +667,7 @@ static const OptionInfo { "+title", 0L, NonConvertOptionFlag, MagickFalse }, { "-title", 1L, NonConvertOptionFlag, MagickFalse }, { "+transform", 0L, DeprecateOptionFlag, MagickTrue }, - { "-transform", 0L, SimpleOperatorOptionFlag, MagickFalse }, + { "-transform", 0L, SimpleOperatorOptionFlag | DeprecateOptionFlag, MagickTrue }, { "+transparent", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "-transparent", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+transparent-color", 1L, ImageInfoOptionFlag, MagickFalse }, diff --git a/MagickCore/option.h b/MagickCore/option.h index 83ed5f8e5..ec1ab6099 100644 --- a/MagickCore/option.h +++ b/MagickCore/option.h @@ -127,25 +127,31 @@ typedef struct _OptionInfo /* Flags to describe classes of image processing options. + These are used to determine how a option should be processed, and + allow use to avoid attempting to process each option in every way posible. */ typedef enum { - UndefinedOptionFlag = 0x0000, - FireOptionFlag = 0x0001, /* Option sequence firing point */ - ImageInfoOptionFlag = 0x0002, /* Sets ImageInfo, no image needed */ - DrawInfoOptionFlag = 0x0004, /* Sets DrawInfo, no image needed */ - QuantizeInfoOptionFlag = 0x0008, /* Sets QuantizeInfo, no image needed */ - GlobalOptionFlag = 0x0010, /* Sets Global Option, no image needed */ - SimpleOperatorOptionFlag = 0x0100, /* Simple Image processing operator */ - ListOperatorOptionFlag = 0x0200, /* Multi-Image processing operator */ - SpecialOperatorOptionFlag = 0x0400, /* Specially handled Operator Option */ - GenesisOptionFlag = 0x0400, /* Genesis Command Wrapper Option */ - NonConvertOptionFlag = 0x4000, /* Option not used by Convert */ + UndefinedOptionFlag = 0x0000, /* option flag is not in use */ + + ImageInfoOptionFlag = 0x0001, /* Setting for ImageInfo */ + DrawInfoOptionFlag = 0x0002, /* Setting for DrawInfo */ + QuantizeInfoOptionFlag = 0x0004, /* Setting for QuantizeInfo */ + GlobalOptionFlag = 0x0008, /* Setting for Global Option */ + SettingOptionFlags = 0x000F /* mask for all setting options */ + + SimpleOperatorOptionFlag = 0x0010, /* Simple Image processing operator */ + ListOperatorOptionFlag = 0x0020, /* Multi-Image processing operator */ + SpecialOperatorOptionFlag = 0x0040, /* Specially handled Operator Option */ + GenesisOptionFlag = 0x0080, /* Genesis Command Wrapper Option */ + + NonConvertOptionFlag = 0x1000, /* Option not used by Convert */ + FireOptionFlag = 0x4000, /* Convert operation seq firing point */ DeprecateOptionFlag = 0x8000, /* Deprecate option, give warning */ - SettingInfoOption = 0x001F /* mask for all setting options */ } CommandOptionFlags; + extern MagickExport char **GetCommandOptions(const CommandOption), *GetNextImageOption(const ImageInfo *), diff --git a/MagickCore/resize.c b/MagickCore/resize.c index 779c01460..3ab7c5532 100644 --- a/MagickCore/resize.c +++ b/MagickCore/resize.c @@ -1135,11 +1135,15 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, % % AdaptiveResizeImage() adaptively resize image with pixel resampling. % +% This is shortcut function for a fast interpolative resize using mesh +% interpolation. It works well for small resizes of less than +/- 50% +% of the original image size. For larger resizing on images a full +% filtered and slower resize function should be used instead. +% % The format of the AdaptiveResizeImage method is: % % Image *AdaptiveResizeImage(const Image *image,const size_t columns, -% const size_t rows,const PixelInterpolateMethod method, -% ExceptionInfo *exception) +% const size_t rows, ExceptionInfo *exception) % % A description of each parameter follows: % @@ -1149,107 +1153,14 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, % % o rows: the number of rows in the resized image. % -% o method: the pixel interpolation method. -% % o exception: return any errors or warnings in this structure. % */ MagickExport Image *AdaptiveResizeImage(const Image *image, - const size_t columns,const size_t rows,const PixelInterpolateMethod method, - ExceptionInfo *exception) + const size_t columns,const size_t rows, ExceptionInfo *exception) { -#define AdaptiveResizeImageTag "Resize/Image" - - CacheView - *image_view, - *resize_view; - - Image - *resize_image; - - MagickBooleanType - status; - - MagickOffsetType - progress; - - ssize_t - y; - - /* - Adaptively resize image. - */ - assert(image != (const Image *) NULL); - assert(image->signature == MagickSignature); - if (image->debug != MagickFalse) - (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - assert(exception != (ExceptionInfo *) NULL); - assert(exception->signature == MagickSignature); - if ((columns == 0) || (rows == 0)) - return((Image *) NULL); - if ((columns == image->columns) && (rows == image->rows)) - return(CloneImage(image,0,0,MagickTrue,exception)); - resize_image=CloneImage(image,columns,rows,MagickTrue,exception); - if (resize_image == (Image *) NULL) - return((Image *) NULL); - if (SetImageStorageClass(resize_image,DirectClass,exception) == MagickFalse) - { - resize_image=DestroyImage(resize_image); - return((Image *) NULL); - } - status=MagickTrue; - progress=0; - image_view=AcquireCacheView(image); - resize_view=AcquireCacheView(resize_image); -#if defined(MAGICKCORE_OPENMP_SUPPORT) - #pragma omp parallel for schedule(static,1) shared(progress,status) -#endif - for (y=0; y < (ssize_t) resize_image->rows; y++) - { - PointInfo - offset; - - register Quantum - *restrict q; - - register ssize_t - x; - - if (status == MagickFalse) - continue; - q=QueueCacheViewAuthenticPixels(resize_view,0,y,resize_image->columns,1, - exception); - if (q == (Quantum *) NULL) - continue; - offset.y=((MagickRealType) (y+0.5)*image->rows/resize_image->rows); - for (x=0; x < (ssize_t) resize_image->columns; x++) - { - offset.x=((MagickRealType) (x+0.5)*image->columns/resize_image->columns); - status=InterpolatePixelChannels(image,image_view,resize_image, - method,offset.x-0.5,offset.y-0.5,q,exception); - q+=GetPixelChannels(resize_image); - } - if (SyncCacheViewAuthenticPixels(resize_view,exception) == MagickFalse) - continue; - if (image->progress_monitor != (MagickProgressMonitor) NULL) - { - MagickBooleanType - proceed; - -#if defined(MAGICKCORE_OPENMP_SUPPORT) - #pragma omp critical (MagickCore_AdaptiveResizeImage) -#endif - proceed=SetImageProgress(image,AdaptiveResizeImageTag,progress++, - image->rows); - if (proceed == MagickFalse) - status=MagickFalse; - } - } - resize_view=DestroyCacheView(resize_view); - image_view=DestroyCacheView(image_view); - if (status == MagickFalse) - resize_image=DestroyImage(resize_image); - return(resize_image); + return(InterpolativeResizeImage(image,columns,rows,MeshInterpolatePixel, + exception)); } /* @@ -1577,6 +1488,143 @@ MagickPrivate MagickRealType GetResizeFilterWeight( weight=scale*resize_filter->filter(x_blur,resize_filter); return(weight); } + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% I n t e r p o l a t i v e R e s i z e I m a g e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% InterpolativeResizeImage() resizes an image using the specified +% interpolation method. +% +% The format of the InterpolativeResizeImage method is: +% +% Image *InterpolativeResizeImage(const Image *image,const size_t columns, +% const size_t rows,const PixelInterpolateMethod method, +% ExceptionInfo *exception) +% +% A description of each parameter follows: +% +% o image: the image. +% +% o columns: the number of columns in the resized image. +% +% o rows: the number of rows in the resized image. +% +% o method: the pixel interpolation method. +% +% o exception: return any errors or warnings in this structure. +% +*/ +MagickExport Image *InterpolativeResizeImage(const Image *image, + const size_t columns,const size_t rows,const PixelInterpolateMethod method, + ExceptionInfo *exception) +{ +#define InterpolativeResizeImageTag "Resize/Image" + + CacheView + *image_view, + *resize_view; + + Image + *resize_image; + + MagickBooleanType + status; + + MagickOffsetType + progress; + + PointInfo + scale; + + ssize_t + y; + + /* + Interpolatively resize image. + */ + assert(image != (const Image *) NULL); + assert(image->signature == MagickSignature); + if (image->debug != MagickFalse) + (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); + assert(exception != (ExceptionInfo *) NULL); + assert(exception->signature == MagickSignature); + if ((columns == 0) || (rows == 0)) + return((Image *) NULL); + if ((columns == image->columns) && (rows == image->rows)) + return(CloneImage(image,0,0,MagickTrue,exception)); + resize_image=CloneImage(image,columns,rows,MagickTrue,exception); + if (resize_image == (Image *) NULL) + return((Image *) NULL); + if (SetImageStorageClass(resize_image,DirectClass,exception) == MagickFalse) + { + resize_image=DestroyImage(resize_image); + return((Image *) NULL); + } + status=MagickTrue; + progress=0; + image_view=AcquireCacheView(image); + resize_view=AcquireCacheView(resize_image); + scale.x=(MagickRealType)image->columns/resize_image->columns; + scale.y=(MagickRealType)image->rows/resize_image->rows; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp parallel for schedule(static,1) shared(progress,status) +#endif + for (y=0; y < (ssize_t) resize_image->rows; y++) + { + PointInfo + offset; + + register Quantum + *restrict q; + + register ssize_t + x; + + if (status == MagickFalse) + continue; + q=QueueCacheViewAuthenticPixels(resize_view,0,y,resize_image->columns,1, + exception); + if (q == (Quantum *) NULL) + continue; + offset.y=((MagickRealType) y+0.5)*scale.y-0.5; + for (x=0; x < (ssize_t) resize_image->columns; x++) + { + offset.x=((MagickRealType) x+0.5)*scale.x-0.5; + status=InterpolatePixelChannels(image,image_view,resize_image,method, + offset.x,offset.y,q,exception); + q+=GetPixelChannels(resize_image); + } + if (SyncCacheViewAuthenticPixels(resize_view,exception) == MagickFalse) + continue; + if (image->progress_monitor != (MagickProgressMonitor) NULL) + { + MagickBooleanType + proceed; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp critical (MagickCore_InterpolativeResizeImage) +#endif + proceed=SetImageProgress(image,InterpolativeResizeImageTag,progress++, + image->rows); + if (proceed == MagickFalse) + status=MagickFalse; + } + } + resize_view=DestroyCacheView(resize_view); + image_view=DestroyCacheView(image_view); + if (status == MagickFalse) + resize_image=DestroyImage(resize_image); + return(resize_image); +} #if defined(MAGICKCORE_LQR_DELEGATE) /* @@ -3318,7 +3366,7 @@ MagickExport Image *ThumbnailImage(const Image *image,const size_t columns, exception); (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double) image->magick_rows); - (void) SetImageProperty(thumbnail_image,"Thumb::Image::height",value, + (void) SetImageProperty(thumbnail_image,"Thumb::Image::Height",value, exception); (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double) GetImageListLength(image)); diff --git a/MagickCore/resize.h b/MagickCore/resize.h index 9b9b43732..f7e509064 100644 --- a/MagickCore/resize.h +++ b/MagickCore/resize.h @@ -23,7 +23,8 @@ extern "C" { #endif extern MagickExport Image - *AdaptiveResizeImage(const Image *,const size_t,const size_t, + *AdaptiveResizeImage(const Image *,const size_t,const size_t,ExceptionInfo *), + *InterpolativeResizeImage(const Image *,const size_t,const size_t, const PixelInterpolateMethod,ExceptionInfo *), *LiquidRescaleImage(const Image *,const size_t,const size_t,const double, const double,ExceptionInfo *), diff --git a/MagickCore/widget.c b/MagickCore/widget.c index ceb126287..d89d78f6e 100644 --- a/MagickCore/widget.c +++ b/MagickCore/widget.c @@ -2359,7 +2359,7 @@ MagickPrivate void XColorBrowserWidget(Display *display,XWindows *windows, if (MatteIsActive(grab_info,event.xbutton)) { /* - Select a pen color from the X server. + Select a fill color from the X server. */ (void) XGetWindowColor(display,windows,reply_info.text, exception); diff --git a/MagickWand/convert.c b/MagickWand/convert.c index 519a552ab..b4f9d17ad 100644 --- a/MagickWand/convert.c +++ b/MagickWand/convert.c @@ -213,6 +213,8 @@ static MagickBooleanType ConvertUsage(void) "-identify identify the format and characteristics of the image", "-ift implements the inverse discrete Fourier transform (DFT)", "-implode amount implode image pixels about the center", + "-interpolative-resize geometry", + " resize image using interpolation", "-lat geometry local adaptive thresholding", "-layers method optimize, merge, or compare image layers", "-level value adjust the level of image contrast", @@ -1809,17 +1811,6 @@ WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info, ThrowConvertException(OptionError,"MissingArgument",option); break; } - if (LocaleCompare("linewidth",option+1) == 0) - { - if (*option == '+') - break; - i++; - if (i == (ssize_t) (argc-1)) - ThrowConvertException(OptionError,"MissingArgument",option); - if (IsGeometry(argv[i]) == MagickFalse) - ThrowConvertInvalidArgumentException(option,argv[i]); - break; - } if (LocaleCompare("liquid-rescale",option+1) == 0) { i++; diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 9bd5993ad..20806bace 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -225,8 +225,7 @@ WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand, % triangulation. % % MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand, -% const size_t columns,const size_t rows, -% const PixelInterpolateMethod method) +% const size_t columns,const size_t rows) % % A description of each parameter follows: % @@ -236,11 +235,9 @@ WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand, % % o rows: the number of rows in the scaled image. % -% o interpolate: the pixel interpolation method. -% */ WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand, - const size_t columns,const size_t rows,const PixelInterpolateMethod method) + const size_t columns,const size_t rows) { Image *resize_image; @@ -251,8 +248,7 @@ WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - resize_image=AdaptiveResizeImage(wand->images,columns,rows,method, - wand->exception); + resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception); if (resize_image == (Image *) NULL) return(MagickFalse); ReplaceImageInList(&wand->images,resize_image); @@ -5921,6 +5917,55 @@ WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand, % % % % % % +% M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickInterpolativeResizeImage() resize image using a interpolative +% method. +% +% MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand, +% const size_t columns,const size_t rows, +% const PixelInterpolateMethod method) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o columns: the number of columns in the scaled image. +% +% o rows: the number of rows in the scaled image. +% +% o interpolate: the pixel interpolation method. +% +*/ +WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand, + const size_t columns,const size_t rows,const PixelInterpolateMethod method) +{ + Image + *resize_image; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + ThrowWandException(WandError,"ContainsNoImages",wand->name); + resize_image=InterpolativeResizeImage(wand->images,columns,rows,method, + wand->exception); + if (resize_image == (Image *) NULL) + return(MagickFalse); + ReplaceImageInList(&wand->images,resize_image); + return(MagickTrue); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k I n v e r s e F o u r i e r T r a n s f o r m I m a g e % % % % % diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h index 8a1272859..4d4f806cc 100644 --- a/MagickWand/magick-image.h +++ b/MagickWand/magick-image.h @@ -72,8 +72,7 @@ extern WandExport PixelInterpolateMethod extern WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *,const double,const double,const double), - MagickAdaptiveResizeImage(MagickWand *,const size_t,const size_t, - const PixelInterpolateMethod), + MagickAdaptiveResizeImage(MagickWand *,const size_t,const size_t), MagickAdaptiveSharpenImage(MagickWand *,const double,const double, const double), MagickAdaptiveThresholdImage(MagickWand *,const size_t,const size_t, @@ -169,6 +168,8 @@ extern WandExport MagickBooleanType MagickImplodeImage(MagickWand *,const double,const PixelInterpolateMethod), MagickImportImagePixels(MagickWand *,const ssize_t,const ssize_t,const size_t, const size_t,const char *,const StorageType,const void *), + MagickInterpolativeResizeImage(MagickWand *,const size_t,const size_t, + const PixelInterpolateMethod), MagickInverseFourierTransformImage(MagickWand *,MagickWand *, const MagickBooleanType), MagickLabelImage(MagickWand *,const char *), diff --git a/MagickWand/magick-wand.c b/MagickWand/magick-wand.c index 8033a01f0..eed19b914 100644 --- a/MagickWand/magick-wand.c +++ b/MagickWand/magick-wand.c @@ -328,7 +328,7 @@ WandExport char *MagickGetException(const MagickWand *wand, % % % % % % -% M a g i c k G e t E x c e p t i o n T y p e % +% M a g i c k G e t E x c e p t i o n T y p e % % % % % % % diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 5ce1e1675..0456562ad 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -765,7 +765,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, (void) SyncImageSettings(mogrify_info,*image,exception); (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); mogrify_image=AdaptiveResizeImage(*image,geometry.width, - geometry.height,interpolate_method,exception); + geometry.height,exception); break; } if (LocaleCompare("adaptive-sharpen",option+1) == 0) @@ -1177,6 +1177,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, kernel=AcquireKernelInfo(argv[i+1]); if (kernel == (KernelInfo *) NULL) break; + /* FUTURE: check on size of the matrix */ mogrify_image=ColorMatrixImage(*image,kernel,exception); kernel=DestroyKernelInfo(kernel); break; @@ -1591,26 +1592,27 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, ExceptionInfo *sans; + PixelInfo + color; + GetPixelInfo(*image,&fill); if (*option == '+') { (void) QueryColorCompliance("none",AllCompliance,&fill, exception); - (void) QueryColorCompliance("none",AllCompliance, - &draw_info->fill,exception); + draw_info->fill=fill; if (draw_info->fill_pattern != (Image *) NULL) draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); break; } sans=AcquireExceptionInfo(); - (void) QueryColorCompliance(argv[i+1],AllCompliance,&fill, - sans); - status=QueryColorCompliance(argv[i+1],AllCompliance, - &draw_info->fill,sans); + status=QueryColorCompliance(argv[i+1],AllCompliance,&color,sans); sans=DestroyExceptionInfo(sans); if (status == MagickFalse) draw_info->fill_pattern=GetImageCache(mogrify_info,argv[i+1], exception); + else + draw_info->fill=fill=color; break; } if (LocaleCompare("flip",option+1) == 0) @@ -1879,6 +1881,17 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, draw_info->interword_spacing=geometry_info.rho; break; } + if (LocaleCompare("interpolative-resize",option+1) == 0) + { + /* + Interpolative resize image. + */ + (void) SyncImageSettings(mogrify_info,*image,exception); + (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception); + mogrify_image=InterpolativeResizeImage(*image,geometry.width, + geometry.height,interpolate_method,exception); + break; + } break; } case 'k': @@ -2012,11 +2025,6 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, (void) LinearStretchImage(*image,black_point,white_point,exception); break; } - if (LocaleCompare("linewidth",option+1) == 0) - { - draw_info->stroke_width=StringToDouble(argv[i+1],(char **) NULL); - break; - } if (LocaleCompare("liquid-rescale",option+1) == 0) { /* @@ -2897,6 +2905,9 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, ExceptionInfo *sans; + PixelInfo + color; + if (*option == '+') { (void) QueryColorCompliance("none",AllCompliance, @@ -2907,12 +2918,13 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, break; } sans=AcquireExceptionInfo(); - status=QueryColorCompliance(argv[i+1],AllCompliance, - &draw_info->stroke,sans); + status=QueryColorCompliance(argv[i+1],AllCompliance,&color,sans); sans=DestroyExceptionInfo(sans); if (status == MagickFalse) draw_info->stroke_pattern=GetImageCache(mogrify_info,argv[i+1], exception); + else + draw_info->stroke=color; break; } if (LocaleCompare("strokewidth",option+1) == 0) @@ -3347,6 +3359,8 @@ static MagickBooleanType MogrifyUsage(void) "-identify identify the format and characteristics of the image", "-ift implements the inverse discrete Fourier transform (DFT)", "-implode amount implode image pixels about the center", + "-interpolative-resize geometry", + " resize image using interpolation", "-lat geometry local adaptive thresholding", "-layers method optimize, merge, or compare image layers", "-level value adjust the level of image contrast", @@ -3475,7 +3489,7 @@ static MagickBooleanType MogrifyUsage(void) "-comment string annotate image with comment", "-compose operator set image composite operator", "-compress type type of pixel compression when writing the image", - "-define format:option", + "-define format:option=value", " define one or more image format options", "-delay value display the next image after pausing", "-density geometry horizontal and vertical density of the image", @@ -3490,7 +3504,7 @@ static MagickBooleanType MogrifyUsage(void) "-fill color color to use when filling a graphic primitive", "-filter type use this filter when resizing an image", "-font name render text with this font", - "-format \"string\" output formatted image characteristics", + "-format \"string\" output formatted image characteristics", "-fuzz distance colors within this distance are considered equal", "-gravity type horizontal and vertical text placement", "-green-primary point chromaticity green primary point", @@ -3582,7 +3596,7 @@ static MagickBooleanType MogrifyUsage(void) for (p=miscellaneous; *p != (char *) NULL; p++) (void) printf(" %s\n",*p); (void) printf( - "\nBy default, the image format of `file' is determined by its magic\n"); + "\nBy default, the image format of 'file' is determined by its magic\n"); (void) printf( "number. To specify a particular image format, precede the filename\n"); (void) printf( @@ -4924,17 +4938,6 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info, ThrowMogrifyException(OptionError,"MissingArgument",option); break; } - if (LocaleCompare("linewidth",option+1) == 0) - { - if (*option == '+') - break; - i++; - if (i == (ssize_t) argc) - ThrowMogrifyException(OptionError,"MissingArgument",option); - if (IsGeometry(argv[i]) == MagickFalse) - ThrowMogrifyInvalidArgumentException(option,argv[i]); - break; - } if (LocaleCompare("limit",option+1) == 0) { char @@ -7095,11 +7098,9 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, if (LocaleCompare("tile-offset",option+1) == 0) { if (*option == '+') - { - (void) SetImageOption(image_info,option+1,"0"); - break; - } - (void) SetImageOption(image_info,option+1,argv[i+1]); + (void) SetImageOption(image_info,option+1,"0"); + else + (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare("transparent-color",option+1) == 0) @@ -7136,11 +7137,9 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, if (LocaleCompare("undercolor",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("units",option+1) == 0) @@ -7185,15 +7184,9 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, if (LocaleCompare("virtual-pixel",option+1) == 0) { if (*option == '+') - { - image_info->virtual_pixel_method=UndefinedVirtualPixelMethod; - (void) SetImageOption(image_info,option+1,"undefined"); - break; - } - image_info->virtual_pixel_method=(VirtualPixelMethod) - ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, - argv[i+1]); - (void) SetImageOption(image_info,option+1,argv[i+1]); + (void) SetImageOption(image_info,option+1,"undefined"); + else + (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; @@ -7203,11 +7196,9 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, if (LocaleCompare("white-point",option+1) == 0) { if (*option == '+') - { - (void) SetImageOption(image_info,option+1,"0.0"); - break; - } - (void) SetImageOption(image_info,option+1,argv[i+1]); + (void) SetImageOption(image_info,option+1,"0.0"); + else + (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; diff --git a/MagickWand/operation.c b/MagickWand/operation.c index dd2ed43bb..83542396c 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -50,6 +50,7 @@ #include "MagickWand/studio.h" #include "MagickWand/MagickWand.h" #include "MagickWand/magick-wand-private.h" +#include "MagickWand/operation.h" #include "MagickCore/monitor-private.h" #include "MagickCore/thread-private.h" #include "MagickCore/string-private.h" @@ -374,25 +375,25 @@ static Image *SparseColorOption(const Image *image, % % % % % % -+ A p p l y S e t t i n g I n f o O p t i o n % ++ W a n d S e t t i n g O p t i o n % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% ApplySettingInfoOption() applies a single settings option into a CLI wand +% WandSettingOption() applies a single settings option into a CLI wand % holding the image_info, draw_info, quantize_info structures that will be -% later used when processing images. +% used when processing the images also found within the wand. % % These options do no require images to be present in the wand for them to be % able to be set, in which case they will be applied to % % Options handled by this function are listed in CommandOptions[] of -% "option.c" that is one of "ApplySettingInfoOption" option flags. +% "option.c" that is one of "SettingOptionFlags" option flags. % -% The format of the ApplySettingOption method is: +% The format of the WandSettingOption method is: % -% MagickBooleanType ApplySettingInfoOption(MagickWand *wand, +% MagickBooleanType WandSettingInfoOption(MagickWand *wand, % const char *option, const char *arg, ExceptionInfo *exception) % % A description of each parameter follows: @@ -410,9 +411,9 @@ static Image *SparseColorOption(const Image *image, % % Example usage... % -% ApplySettingInfoOption(wand, "background", MagickTrue, "Red", exception); -% ApplySettingInfoOption(wand, "adjoin", "true", exception); -% ApplySettingInfoOption(wand, "adjoin", NULL, exception); +% WandSettingOptionWand(wand, "background", MagickTrue, "Red"); +% WandSettingOptionWand(wand, "adjoin", "true"); +% WandSettingOptionWand(wand, "adjoin", NULL); % % Or for handling command line arguments EG: +/-option ["arg"] % @@ -421,15 +422,17 @@ static Image *SparseColorOption(const Image *image, % % count=ParseCommandOption(MagickCommandOptions,MagickFalse,argv[i]); % flags=GetCommandOptionFlags(MagickCommandOptions,MagickFalse,argv[i]); -% if ( (flags & SettingInfoOption) != 0 ) -% ApplySettingsOption(wand, argv[i]+1, -% (((*argv[i])!='-') ? (char *)NULL : (count>0) ? argv[i+1] : "true"), +% if ( (flags & SettingOptionFlags) != 0 ) +% WandSettingsOptionWand(wand, argv[i]+1, +% (((*argv[i])!='-') ? (char *)NULL +% : (count>0) ? argv[i+1] : "true") ); % exception); +% ... % i += count+1; % */ -WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, - const char *option, const char *arg, ExceptionInfo *exception) +WandExport MagickBooleanType ApplySettingOptionWand(MagickWand *wand, + const char *option, const char *arg) { assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); @@ -440,6 +443,7 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, #define image_info (wand->image_info) #define draw_info (wand->draw_info) #define quantize_info (wand->quantize_info) +#define exception (wand->exception) #define IfSetOption (arg!=(char *)NULL) #define ArgOption(def) (IfSetOption?arg:(const char *)(def)) #define ArgBoolean (IfSetOption?MagickTrue:MagickFalse) @@ -455,7 +459,7 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, } if (LocaleCompare("affine",option) == 0) { - /* draw_info setting only */ + /* DEPRECIATED: draw_info setting only */ if (IfSetOption) (void) ParseAffineGeometry(arg,&draw_info->affine,exception); else @@ -546,8 +550,9 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, } if (LocaleCompare("box",option) == 0) { - /* Depreciated - now "undercolor" */ - return(ApplySettingInfoOption(wand,"undercolor",arg,exception)); + /* DEPRECIATED - now "undercolor" */ + WandSettingOption(wand,"undercolor",arg,exception); + break; } break; } @@ -754,10 +759,10 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, } if (LocaleCompare("fill",option) == 0) { - /* set "fill" OR "fill-pattern" - color is only used by draw_info - warning draw_info is only initialsed using the color - and not any pattern that was provided! + /* Set "fill" OR "fill-pattern" in draw_info + The original fill color is preserved if a fill-pattern is given. + That way it does not effect other operations that directly using + the fill color and, can be retored using "+tile". */ const char *value; @@ -768,6 +773,9 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, ExceptionInfo *sans; + PixelInfo + color; + value = ArgOption("none"); (void) SetImageOption(image_info,option,value); if (draw_info->fill_pattern != (Image *) NULL) @@ -775,11 +783,13 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, /* is it a color or a image? -- ignore exceptions */ sans=AcquireExceptionInfo(); - status=QueryColorCompliance(value,AllCompliance,&draw_info->fill, - sans); + status=QueryColorCompliance(value,AllCompliance,&color,sans); sans=DestroyExceptionInfo(sans); + if (status == MagickFalse) draw_info->fill_pattern=GetImageCache(image_info,value,exception); + else + draw_info->fill=color; break; } if (LocaleCompare("filter",option) == 0) @@ -880,9 +890,7 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, } if (LocaleCompare("interpolate",option) == 0) { - /* Not used by coders, only in image processing, - SyncImageSettings() used to set per-image attribute. - */ + /* SyncImageSettings() used to set per-image attribute. */ (void) SetImageOption(image_info,option,ArgOption("undefined")); break; } @@ -912,13 +920,6 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, (void) SetImageOption(image_info,option,ArgOption(NULL)); break; } - if (LocaleCompare("linewidth",option) == 0) - { - /* depreciated */ - (void) SetImageOption(image_info,"strokewidth",ArgOption(NULL)); - draw_info->stroke_width=StringToDouble(ArgOption("1.0"),(char **)NULL); - break; - } if (LocaleCompare("list",option) == 0) { ssize_t @@ -1231,8 +1232,8 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, if (LocaleCompare("stroke",option) == 0) { /* set stroke color OR stroke-pattern - color is only used by draw_info - but draw_info is only initialised using the color not the pattern + UPDATE: ensure stroke color is not destroyed is a pattern + is given. Just in case the color is also used for other purposes. */ const char *value; @@ -1243,20 +1244,23 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, ExceptionInfo *sans; + PixelInfo + color; + value = ArgOption("none"); (void) SetImageOption(image_info,option,value); - if (draw_info->stroke_pattern != (Image *) NULL) draw_info->stroke_pattern=DestroyImage(draw_info->stroke_pattern); /* is it a color or a image? -- ignore exceptions */ sans=AcquireExceptionInfo(); - status=QueryColorCompliance(value,AllCompliance,&draw_info->stroke, - sans); + status=QueryColorCompliance(value,AllCompliance,&color,sans); sans=DestroyExceptionInfo(sans); + if (status == MagickFalse) - draw_info->stroke_pattern=GetImageCache(image_info,value, - exception); + draw_info->stroke_pattern=GetImageCache(image_info,value,exception); + else + draw_info->stroke=color; break; } if (LocaleCompare("strokewidth",option) == 0) @@ -1374,11 +1378,10 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, } if (LocaleCompare("virtual-pixel",option) == 0) { - /* Also used as a 'image' option very deep in image structure */ + /* SyncImageSettings() used to set per-image attribute. + This is VERY deep in the image caching structure. + */ (void) SetImageOption(image_info,option,ArgOption(NULL)); - image_info->virtual_pixel_method=(VirtualPixelMethod) - ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, - ArgOption("undefined")); break; } break; @@ -1420,6 +1423,14 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, default: break; } +#undef image_info +#undef draw_info +#undef quantize_info +#undef exception +#undef IfSetOption +#undef ArgOption +#undef ArgBoolean + return(MagickTrue); } @@ -1429,15 +1440,15 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, % % % % % % -+ A p p l y S i m p l e I m a g e O p e r a t o r % ++ W a n d S i m p l e O p e r a t o r I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% ApplySimpleImageOperator() apply one simple image operation to the current -% image pointed to by the CLI wand, with the settings that are saved in the -% CLI wand. +% WandSimpleOperatorImage() apples one simple image operation given as +% strings to the current image pointed to by the CLI wand, with the settings +% that are saved in the CLI wand. % % The image in the list may be modified in three different ways... % @@ -1454,42 +1465,49 @@ WandExport MagickBooleanType ApplySettingInfoOption(MagickWand *wand, % It is assumed that any per-image settings are up-to-date with respect to % extra settings that have been saved in the wand. % -% The format of the ApplySimpleImageOperator method is: +% The format of the WandSimpleImageOperator method is: % -% MagickBooleanType ApplySimpleImageOperator(MagickWand *wand, -% const char *option, const MagickBooleanType set_option, const char -% **args, ExceptionInfo *exception) +% MagickBooleanType WandSimpleImageOperator(MagickWand *wand, +% const MagickBooleanType plus_alt_op, const char *option, +% const char *arg1, const char *arg2) % % A description of each parameter follows: % % o wand: structure holding settings to be applied % -% o option: The option string to be set +% o plus_alt_op: request the 'plus' or alturnative form of the operation % -% o set_option: is the option being set, or reset to some default +% o option: The option string for the operation % -% o args: array of options (typicaly only 1 or 2 options) +% o arg1, arg2: optional argument strings to the operation % % o exception: return any errors or warnings in this structure. % % -% Example usage (FUTURE) +% Example usage +% +% WandSimpleOperatorImage(wand,MagickFalse,"append",NULL,NULL); +% WandSimpleOperatorImage(wand,MagickFalse,"crop","100x100+20+30",NULL); +% WandSimpleOperatorImage(wand,MagickTrue,"distort","SRT","45"); +% +% Or for handling command line arguments EG: +/-option ["arg"] % % argc,argv % i=index in argv % % count=ParseCommandOption(MagickCommandOptions,MagickFalse,argv[i]); % flags=GetCommandOptionFlags(MagickCommandOptions,MagickFalse,argv[i]); -% if ( flags == MagickCommandOptions ) -% ApplySettingsOption(wand, argv[i]+1, -% (*argv[i])=='-' ? MagickTrue : MagickFalse, -% argv+i+1, exception); +% if ( flags == SimpleOperatorOptionFlag ) +% WandSimpleOperatorImage(wand, +% (MagickBooleanType)(*argv[i])=='+'), argv[i]+1, +% count>=1 ? argv[i+1] : (char *)NULL, +% count>=2 ? argv[i+2] : (char *)NULL ); % i += count+1; % */ -WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, - const char *option, const MagickBooleanType set_option, const char **args, - ExceptionInfo *exception) +WandExport MagickBooleanType WandSimpleOperatorImage(MagickWand *wand, + const MagickBooleanType plus_alt_op, const char *option, + const char *arg1, const char *arg2) { Image * new_image; @@ -1506,11 +1524,17 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, MagickStatusType flags; +#define image_info (wand->image_info) +#define draw_info (wand->draw_info) +#define quantize_info (wand->quantize_info) +#define image (&wand->image) +#define exception (&wand->exception) + assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); - assert(wand->draw_info != (DrawInfo *) NULL); /* ensure it is a CLI wand */ - assert(image != (Image **) NULL); /* there is an image */ - assert((*image)->signature == MagickSignature); + assert(wand->draw_info != (DrawInfo *) NULL); /* ensure it is a CLI wand */ + assert((*image) != (Image *) NULL); /* there is an image */ + assert((*image)->signature == MagickSignature); /* and is a valid image */ if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); @@ -1519,7 +1543,9 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, new_image = (Image *)NULL; /* the replacement image, if not null at end */ - /* We need somthing more optimized than this! */ + /* FUTURE: We may need somthing a little more optimized than this! + Perhaps, do the 'sync' if 'settings tainted' before next operator. + */ (void) SyncImageSettings(image_info,*image,exception); switch (*option) @@ -1528,7 +1554,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("adaptive-blur",option) == 0) { - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -1539,12 +1565,9 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("adaptive-resize",option) == 0) { - /* FUTURE: this is really a "interpolate-resize" operator - "adaptive-resize" uses a fixed "Mesh" interpolation - */ - (void) ParseRegionGeometry(*image,args[0],&geometry,exception); - new_image=AdaptiveResizeImage(*image,geometry.width, - geometry.height,interpolate_method,exception); + (void) ParseRegionGeometry(*image,arg1,&geometry,exception); + new_image=AdaptiveResizeImage(*image,geometry.width,geometry.height, + exception); break; } if (LocaleCompare("adaptive-sharpen",option) == 0) @@ -1552,8 +1575,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Adaptive sharpen image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -1567,9 +1589,8 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, AlphaChannelType alpha_type; - (void) SyncImageSettings(image_info,*image,exception); alpha_type=(AlphaChannelType) ParseCommandOption(MagickAlphaOptions, - MagickFalse,args[0]); + MagickFalse,arg1); (void) SetImageAlphaChannel(*image,alpha_type,exception); break; } @@ -1579,12 +1600,11 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, *text, geometry[MaxTextExtent]; - (void) SyncImageSettings(image_info,*image,exception); SetGeometryInfo(&geometry_info); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; - text=InterpretImageProperties(image_info,*image,argv[2], + text=InterpretImageProperties(image_info,*image,arg2, exception); if (text == (char *) NULL) break; @@ -1602,6 +1622,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, draw_info->affine.sy=cos(DegreesToRadians( fmod(geometry_info.sigma,360.0))); (void) AnnotateImage(*image,draw_info,exception); + GetAffineMatrix(&draw_info->affine); break; } if (LocaleCompare("auto-gamma",option) == 0) @@ -1609,22 +1630,19 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Auto Adjust Gamma of image based on its mean */ - (void) SyncImageSettings(image_info,*image,exception); (void) AutoGammaImage(*image,exception); break; } if (LocaleCompare("auto-level",option) == 0) { /* - Perfectly Normalize (max/min stretch) the image + A Perfect Normalize (max/min stretch) the image */ - (void) SyncImageSettings(image_info,*image,exception); (void) AutoLevelImage(*image,exception); break; } if (LocaleCompare("auto-orient",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); switch ((*image)->orientation) { case TopRightOrientation: @@ -1675,24 +1693,21 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("black-threshold",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) BlackThresholdImage(*image,args[0],exception); + (void) BlackThresholdImage(*image,arg1,exception); break; } if (LocaleCompare("blue-shift",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); geometry_info.rho=1.5; - if (*argv[0] == '-') - flags=ParseGeometry(args[0],&geometry_info); + if (plus_alt_op == MagickFalse) + flags=ParseGeometry(arg1,&geometry_info); new_image=BlueShiftImage(*image,geometry_info.rho,exception); break; } if (LocaleCompare("blur",option) == 0) { /* FUTURE: use of "bias" in a blur is non-sensible */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -1706,7 +1721,6 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, ComposeOperator compose; - const char* const char* value; @@ -1717,8 +1731,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, else compose=OverCompositeOp; /* use Over not image->compose */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParsePageGeometry(*image,args[0],&geometry,exception); + flags=ParsePageGeometry(*image,arg1,&geometry,exception); if ((flags & SigmaValue) == 0) geometry.height=geometry.width; new_image=BorderImage(*image,&geometry,compose,exception); @@ -1736,8 +1749,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, MagickStatusType flags; - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); brightness=geometry_info.rho; contrast=0.0; if ((flags & SigmaValue) != 0) @@ -1758,8 +1770,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Color correct with a color decision list. */ - (void) SyncImageSettings(image_info,*image,exception); - color_correction_collection=FileToString(args[0],~0,exception); + color_correction_collection=FileToString(arg1,~0,exception); if (color_correction_collection == (char *) NULL) break; (void) ColorDecisionListImage(*image,color_correction_collection, @@ -1768,14 +1779,16 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("channel",option) == 0) { - /* The "channel" setting has already been set */ + /* The "channel" setting has already been set + FUTURE: This probably should be part of WandSettingOption() + or SyncImageSettings(). + */ SetPixelChannelMapMask(*image,image_info->channel); break; } if (LocaleCompare("charcoal",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -1786,26 +1799,21 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("chop",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseGravityGeometry(*image,args[0],&geometry,exception); + (void) ParseGravityGeometry(*image,arg1,&geometry,exception); new_image=ChopImage(*image,&geometry,exception); break; } if (LocaleCompare("clamp",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); (void) ClampImage(*image,exception); break; } if (LocaleCompare("clip",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - if (*argv[0] == '+') - { - (void) SetImageClipMask(*image,(Image *) NULL,exception); - break; - } - (void) ClipImage(*image,exception); + if (plus_alt_op == MagickFalse) + (void) ClipImage(*image,exception); + else /* "+clip" remove the write mask */ + (void) SetImageClipMask(*image,(Image *) NULL,exception); break; } if (LocaleCompare("clip-mask",option) == 0) @@ -1825,20 +1833,19 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, ssize_t y; - (void) SyncImageSettings(image_info,*image,exception); - if (*argv[0] == '+') - { - /* Remove the write mask */ + if (plus_alt_op != MagickFalse) + { /* "+clip-mask" Remove the write mask */ (void) SetImageMask(*image,(Image *) NULL,exception); break; } - mask_image=GetImageCache(image_info,args[0],exception); + mask_image=GetImageCache(image_info,arg1,exception); if (mask_image == (Image *) NULL) break; - if (SetImageStorageClass(mask_image,DirectClass,exception) == MagickFalse) + if (SetImageStorageClass(mask_image,DirectClass,exception) + == MagickFalse) return(MagickFalse); /* create a write mask from clip-mask image */ - /* FUTURE: use Alpha operations instead */ + /* FUTURE: use Alpha operations instead and create a Grey Image */ mask_view=AcquireCacheView(mask_image); for (y=0; y < (ssize_t) mask_image->rows; y++) { @@ -1858,7 +1865,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, if (SyncCacheViewAuthenticPixels(mask_view,exception) == MagickFalse) break; } - /* set the write mask */ + /* clean up and set the write mask */ mask_view=DestroyCacheView(mask_view); mask_image->matte=MagickTrue; (void) SetImageClipMask(*image,mask_image,exception); @@ -1867,16 +1874,13 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("clip-path",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ClipImagePath(*image,args[0],*argv[0] == '-' ? MagickTrue : - MagickFalse,exception); + (void) ClipImagePath(*image,arg1, + (MagickBooleanType)(!(int)plus_alt_op),exception); break; } if (LocaleCompare("colorize",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - new_image=ColorizeImage(*image,args[0],draw_info->fill, - exception); + new_image=ColorizeImage(*image,arg1,draw_info->fill,exception); break; } if (LocaleCompare("color-matrix",option) == 0) @@ -1884,8 +1888,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, KernelInfo *kernel; - (void) SyncImageSettings(image_info,*image,exception); - kernel=AcquireKernelInfo(args[0]); + kernel=AcquireKernelInfo(arg1); if (kernel == (KernelInfo *) NULL) break; new_image=ColorMatrixImage(*image,kernel,exception); @@ -1894,9 +1897,10 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("colors",option) == 0) { - /* Reduce the number of colors in the image. */ - (void) SyncImageSettings(image_info,*image,exception); - quantize_info->number_colors=StringToUnsignedLong(args[0]); + /* Reduce the number of colors in the image. + FUTURE: also provide 'plus version with image 'color counts' + */ + quantize_info->number_colors=StringToUnsignedLong(arg1); if (quantize_info->number_colors == 0) break; if (((*image)->storage_class == DirectClass) || @@ -1914,7 +1918,6 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, Note that +colorspace sets "undefined" or no effect on new images, but forces images already in memory back to RGB! */ - (void) SyncImageSettings(image_info,*image,exception); (void) TransformImageColorspace(*image, IfSetOption ? image_info->colorspace : RGBColorspace, exception); @@ -1922,9 +1925,8 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("contrast",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ContrastImage(*image,(*argv[0] == '-') ? MagickTrue : - MagickFalse,exception); + (void) ContrastImage(*image, + (MagickBooleanType)(!(int)plus_alt_op),exception); break; } if (LocaleCompare("contrast-stretch",option) == 0) @@ -1939,8 +1941,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Contrast stretch image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); black_point=geometry_info.rho; white_point=(flags & SigmaValue) != 0 ? geometry_info.sigma : black_point; @@ -1960,8 +1961,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, KernelInfo *kernel_info; - (void) SyncImageSettings(image_info,*image,exception); - kernel_info=AcquireKernelInfo(args[0]); + kernel_info=AcquireKernelInfo(arg1); if (kernel_info == (KernelInfo *) NULL) break; kernel_info->bias=(*image)->bias; @@ -1971,20 +1971,12 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("crop",option) == 0) { - /* - Crop a image to a smaller size - */ - (void) SyncImageSettings(image_info,*image,exception); - new_image=CropImageToTiles(*image,args[0],exception); + new_image=CropImageToTiles(*image,arg1,exception); break; } if (LocaleCompare("cycle",option) == 0) { - /* - Cycle an image colormap. - */ - (void) SyncImageSettings(image_info,*image,exception); - (void) CycleColormapImage(*image,(ssize_t) StringToLong(args[0]), + (void) CycleColormapImage(*image,(ssize_t) StringToLong(arg1), exception); break; } @@ -1997,11 +1989,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, StringInfo *passkey; - /* - Decipher pixels. - */ - (void) SyncImageSettings(image_info,*image,exception); - passkey=FileToStringInfo(args[0],~0,exception); + passkey=FileToStringInfo(arg1,~0,exception); if (passkey != (StringInfo *) NULL) { (void) PasskeyDecipherImage(*image,passkey,exception); @@ -2009,39 +1997,33 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } break; } +#if 0 if (LocaleCompare("depth",option) == 0) { /* The image_info->depth setting has already been set We just need to apply it to all images in current sequence WARNING: Depth from 8 to 16 causes 'quantum rounding to images! That is it really is an operation, not a setting! Arrgghhh + FUTURE: this should not be an operator!!! */ - (void) SyncImageSettings(image_info,*image,exception); (void) SetImageDepth(*image,image_info->depth); break; } +#endif if (LocaleCompare("deskew",option) == 0) { double threshold; - /* - Straighten the image. - */ - (void) SyncImageSettings(image_info,*image,exception); - if (*argv[0] == '+') + if (plus_alt_op != MagickFalse) threshold=40.0*QuantumRange/100.0; else - threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0); + threshold=StringToDoubleInterval(arg1,(double) QuantumRange+1.0); new_image=DeskewImage(*image,threshold,exception); break; } if (LocaleCompare("despeckle",option) == 0) { - /* - Reduce the speckles within an image. - */ - (void) SyncImageSettings(image_info,*image,exception); new_image=DespeckleImage(*image,exception); break; } @@ -2069,17 +2051,17 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Distort image. */ - (void) SyncImageSettings(image_info,*image,exception); method=(DistortImageMethod) ParseCommandOption(MagickDistortOptions, - MagickFalse,args[0]); + MagickFalse,arg1); if (method == ResizeDistortion) { double resize_args[2]; /* Special Case - Argument is actually a resize geometry! ** Convert that to an appropriate distortion argument array. + ** FUTURE: make a separate special resize operator */ - (void) ParseRegionGeometry(*image,argv[2],&geometry, + (void) ParseRegionGeometry(*image,arg2,&geometry, exception); resize_args[0]=(double) geometry.width; resize_args[1]=(double) geometry.height; @@ -2087,10 +2069,16 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, resize_args,MagickTrue,exception); break; } - args=InterpretImageProperties(image_info,*image,argv[2], + /* handle percent arguments */ + args=InterpretImageProperties(image_info,*image,arg2, exception); if (args == (char *) NULL) break; + /* convert arguments into an array of doubles + FUTURE: make this a separate function. + Also make use of new 'sentinal' feature to avoid need for + tokenization. + */ p=(char *) args; for (x=0; *p != '\0'; x++) { @@ -2116,15 +2104,15 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } args=DestroyString(args); new_image=DistortImage(*image,method,number_arguments,arguments, - (*argv[0] == '+') ? MagickTrue : MagickFalse,exception); + plus_alt_op,exception); arguments=(double *) RelinquishMagickMemory(arguments); break; } if (LocaleCompare("draw",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) CloneString(&draw_info->primitive,args[0]); + (void) CloneString(&draw_info->primitive,arg1); (void) DrawImage(*image,draw_info,exception); + (void) CloneString(&draw_info->primitive,(char *)NULL); break; } break; @@ -2133,8 +2121,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("edge",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; new_image=EdgeImage(*image,geometry_info.rho, @@ -2143,8 +2130,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("emboss",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; new_image=EmbossImage(*image,geometry_info.rho, @@ -2156,8 +2142,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, StringInfo *passkey; - (void) SyncImageSettings(image_info,*image,exception); - passkey=FileToStringInfo(args[0],~0,exception); + passkey=FileToStringInfo(arg1,~0,exception); if (passkey != (StringInfo *) NULL) { (void) PasskeyEncipherImage(*image,passkey,exception); @@ -2167,13 +2152,11 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("enhance",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); new_image=EnhanceImage(*image,exception); break; } if (LocaleCompare("equalize",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); (void) EqualizeImage(*image,exception); break; } @@ -2185,17 +2168,15 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, MagickEvaluateOperator op; - (void) SyncImageSettings(image_info,*image,exception); op=(MagickEvaluateOperator) ParseCommandOption( - MagickEvaluateOptions,MagickFalse,args[0]); - constant=StringToDoubleInterval(argv[2],(double) QuantumRange+1.0); + MagickEvaluateOptions,MagickFalse,arg1); + constant=StringToDoubleInterval(arg2,(double) QuantumRange+1.0); (void) EvaluateImage(*image,op,constant,exception); break; } if (LocaleCompare("extent",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGravityGeometry(*image,args[0],&geometry,exception); + flags=ParseGravityGeometry(*image,arg1,&geometry,exception); if (geometry.width == 0) geometry.width=(*image)->columns; if (geometry.height == 0) @@ -2209,26 +2190,18 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("features",option) == 0) { - /* FUTURE: Assign Artifact to all images -- per image setting */ + /* FUTURE: make this a Setting */ (void) SetImageArtifact(*image,"identify:features", - IfSetOption ? args[0] : (const char *) NULL); + (plus_alt_op != MagickFalse) ? arg1 : (char *) NULL); break; } if (LocaleCompare("flip",option) == 0) { - /* - Flip image scanlines. - */ - (void) SyncImageSettings(image_info,*image,exception); new_image=FlipImage(*image,exception); break; } if (LocaleCompare("flop",option) == 0) { - /* - Flop image scanlines. - */ - (void) SyncImageSettings(image_info,*image,exception); new_image=FlopImage(*image,exception); break; } @@ -2237,34 +2210,31 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, PixelInfo target; - /* - Floodfill image. - */ - (void) SyncImageSettings(image_info,*image,exception); - (void) ParsePageGeometry(*image,args[0],&geometry,exception); - (void) QueryColorCompliance(argv[2],AllCompliance,&target, - exception); + (void) ParsePageGeometry(*image,arg1,&geometry,exception); + (void) QueryColorCompliance(arg2,AllCompliance,&target,exception); (void) FloodfillPaintImage(*image,draw_info,&target,geometry.x, - geometry.y,*argv[0] == '-' ? MagickFalse : MagickTrue,exception); - break; - } - /* FUTURE: should be from ImageOption "format" - if (LocaleCompare("format",option) == 0) - { - format=args[0]; + geometry.y,plus_alt_op,exception); break; } - */ if (LocaleCompare("frame",option) == 0) { FrameInfo frame_info; - /* - Surround image with an ornamental border. - */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParsePageGeometry(*image,args[0],&geometry,exception); + ComposeOperator + compose; + + const char* + value; + + value=GetImageOption(image_info,"compose"); + if (value != (const char *) NULL) + compose=(CompositeOperator) ParseCommandOption( + MagickComposeOptions,MagickFalse,value); + else + compose=OverCompositeOp; /* use Over not image->compose */ + + flags=ParsePageGeometry(*image,arg1,&geometry,exception); frame_info.width=geometry.width; frame_info.height=geometry.height; if ((flags & HeightValue) == 0) @@ -2275,7 +2245,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, frame_info.y=(ssize_t) frame_info.height; frame_info.width=(*image)->columns+2*frame_info.width; frame_info.height=(*image)->rows+2*frame_info.height; - new_image=FrameImage(*image,&frame_info,COMPOSE,exception); + new_image=FrameImage(*image,&frame_info,compose,exception); break; } if (LocaleCompare("function",option) == 0) @@ -2301,11 +2271,11 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Function Modify Image Values + FUTURE: code should be almost a duplicate of that is "distort" */ - (void) SyncImageSettings(image_info,*image,exception); function=(MagickFunction) ParseCommandOption(MagickFunctionOptions, - MagickFalse,args[0]); - arguments=InterpretImageProperties(image_info,*image,argv[2], + MagickFalse,arg1); + arguments=InterpretImageProperties(image_info,*image,arg2, exception); if (arguments == (char *) NULL) break; @@ -2344,19 +2314,17 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("gamma",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - if (*argv[0] == '+') - (*image)->gamma=StringToDouble(args[0],(char **) NULL); + if (plus_alt_op) + (*image)->gamma=StringToDouble(arg1,(char **) NULL); else - (void) GammaImage(*image,StringToDouble(args[0], - (char **) NULL),exception); + (void) GammaImage(*image,StringToDouble(arg1,(char **) NULL), + exception); break; } if ((LocaleCompare("gaussian-blur",option) == 0) || (LocaleCompare("gaussian",option) == 0)) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -2365,22 +2333,23 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } +/* ------------- */ if (LocaleCompare("geometry",option) == 0) { - /* - Record Image offset for composition, - Resize last image. -- FUTURE depreciate this aspect - */ - (void) SyncImageSettings(image_info,*image,exception); - if (*argv[0] == '+') - { + /* + Record Image offset for composition. This should be a setting! + Resize last image. -- FUTURE depreciate this aspect + Also why is it being recorded in the IMAGE - that makes no sense! + */ + if (plus_alt_op) + { /* remove the previous composition geometry offset! */ if ((*image)->geometry != (char *) NULL) (*image)->geometry=DestroyString((*image)->geometry); break; } - flags=ParseRegionGeometry(*image,args[0],&geometry,exception); + flags=ParseRegionGeometry(*image,arg1,&geometry,exception); if (((flags & XValue) != 0) || ((flags & YValue) != 0)) - (void) CloneString(&(*image)->geometry,args[0]); + (void) CloneString(&(*image)->geometry,arg1); else new_image=ResizeImage(*image,geometry.width,geometry.height, (*image)->filter,(*image)->blur,exception); @@ -2392,7 +2361,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("highlight-color",option) == 0) { - (void) SetImageArtifact(*image,option,args[0]); + (void) SetImageArtifact(*image,option,arg1); break; } break; @@ -2404,7 +2373,6 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, char *text; - (void) SyncImageSettings(image_info,*image,exception); if (format == (char *) NULL) { (void) IdentifyImage(*image,stdout,image_info->verbose, @@ -2425,47 +2393,16 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Implode image. */ - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseGeometry(args[0],&geometry_info); + (void) ParseGeometry(arg1,&geometry_info); new_image=ImplodeImage(*image,geometry_info.rho, - interpolate_method,exception); + (*image)->interpolate,exception); break; } - if (LocaleCompare("interline-spacing",option) == 0) + if (LocaleCompare("interpolative-resize",option) == 0) { - if (*argv[0] == '+') - (void) ParseGeometry("0",&geometry_info); - else - (void) ParseGeometry(args[0],&geometry_info); - draw_info->interline_spacing=geometry_info.rho; - break; - } - if (LocaleCompare("interpolate",option) == 0) - { - interpolate_method=(PixelInterpolateMethod) ParseCommandOption( - MagickInterpolateOptions,MagickFalse,args[0]); - break; - } - if (LocaleCompare("interword-spacing",option) == 0) - { - if (*argv[0] == '+') - (void) ParseGeometry("0",&geometry_info); - else - (void) ParseGeometry(args[0],&geometry_info); - draw_info->interword_spacing=geometry_info.rho; - break; - } - break; - } - case 'k': - { - if (LocaleCompare("kerning",option) == 0) - { - if (*argv[0] == '+') - (void) ParseGeometry("0",&geometry_info); - else - (void) ParseGeometry(args[0],&geometry_info); - draw_info->kerning=geometry_info.rho; + (void) ParseRegionGeometry(*image,arg1,&geometry,exception); + new_image=InterpolativeResizeImage(*image,geometry.width, + geometry.height,(*image)->interpolate,exception); break; } break; @@ -2477,8 +2414,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Local adaptive threshold image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & PercentValue) != 0) geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0; new_image=AdaptiveThresholdImage(*image,(size_t) @@ -2499,8 +2435,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Parse levels. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); black_point=geometry_info.rho; white_point=(MagickRealType) QuantumRange; if ((flags & SigmaValue) != 0) @@ -2535,7 +2470,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, black_point, white_point; - p=(const char *) args[0]; + p=(const char *) arg1; GetMagickToken(p,&p,token); /* get black point color */ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0)) (void) QueryColorCompliance(token,AllCompliance, @@ -2571,8 +2506,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, MagickStatusType flags; - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); black_point=geometry_info.rho; white_point=(MagickRealType) (*image)->columns*(*image)->rows; if ((flags & SigmaValue) != 0) @@ -2593,8 +2527,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Liquid rescale image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseRegionGeometry(*image,args[0],&geometry,exception); + flags=ParseRegionGeometry(*image,arg1,&geometry,exception); if ((flags & XValue) == 0) geometry.x=1; if ((flags & YValue) == 0) @@ -2605,7 +2538,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("lowlight-color",option) == 0) { - (void) SetImageArtifact(*image,option,args[0]); + (void) SetImageArtifact(*image,option,arg1); break; } break; @@ -2620,10 +2553,9 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Transform image colors to match this set of colors. */ - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') break; - remap_image=GetImageCache(image_info,args[0],exception); + remap_image=GetImageCache(image_info,arg1,exception); if (remap_image == (Image *) NULL) break; (void) RemapImage(quantize_info,*image,remap_image,exception); @@ -2635,7 +2567,6 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, Image *mask; - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') { /* @@ -2647,7 +2578,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Set the image mask. */ - mask=GetImageCache(image_info,args[0],exception); + mask=GetImageCache(image_info,arg1,exception); if (mask == (Image *) NULL) break; (void) SetImageMask(*image,mask,exception); @@ -2666,8 +2597,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Median filter image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; new_image=StatisticImage(*image,MedianStatistic,(size_t) @@ -2679,8 +2609,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Mode image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; new_image=StatisticImage(*image,ModeStatistic,(size_t) @@ -2689,8 +2618,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("modulate",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ModulateImage(*image,args[0],exception); + (void) ModulateImage(*image,arg1,exception); break; } if (LocaleCompare("monitor",option) == 0) @@ -2707,7 +2635,6 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("monochrome",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); (void) SetImageType(*image,BilevelType,exception); break; } @@ -2728,8 +2655,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, ssize_t iterations; - (void) SyncImageSettings(image_info,*image,exception); - p=args[0]; + p=arg1; GetMagickToken(p,&p,token); method=(MorphologyMethod) ParseCommandOption( MagickMorphologyOptions,MagickFalse,token); @@ -2739,7 +2665,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, GetMagickToken(p,&p,token); if ((*p != '\0')) iterations=(ssize_t) StringToLong(p); - kernel=AcquireKernelInfo(argv[2]); + kernel=AcquireKernelInfo(arg2); if (kernel == (KernelInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), @@ -2757,8 +2683,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Motion blur image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; new_image=MotionBlurImage(*image,geometry_info.rho, @@ -2772,17 +2697,15 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("negate",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); (void) NegateImage(*image,*argv[0] == '+' ? MagickTrue : MagickFalse,exception); break; } if (LocaleCompare("noise",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '-') { - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; new_image=StatisticImage(*image,NonpeakStatistic,(size_t) @@ -2794,14 +2717,13 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, noise; noise=(NoiseType) ParseCommandOption(MagickNoiseOptions, - MagickFalse,args[0]); + MagickFalse,arg1); new_image=AddNoiseImage(*image,noise,exception); } break; } if (LocaleCompare("normalize",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); (void) NormalizeImage(*image,exception); break; } @@ -2814,8 +2736,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, PixelInfo target; - (void) SyncImageSettings(image_info,*image,exception); - (void) QueryColorCompliance(args[0],AllCompliance,&target, + (void) QueryColorCompliance(arg1,AllCompliance,&target, exception); (void) OpaquePaintImage(*image,&target,&fill,*argv[0] == '-' ? MagickFalse : MagickTrue,exception); @@ -2823,8 +2744,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("ordered-dither",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) OrderedPosterizeImage(*image,args[0],exception); + (void) OrderedPosterizeImage(*image,arg1,exception); break; } break; @@ -2833,8 +2753,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("paint",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseGeometry(args[0],&geometry_info); + (void) ParseGeometry(arg1,&geometry_info); new_image=OilPaintImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; @@ -2853,19 +2772,18 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Simulate a Polaroid picture. */ - (void) SyncImageSettings(image_info,*image,exception); random_info=AcquireRandomInfo(); angle=22.5*(GetPseudoRandomValue(random_info)-0.5); random_info=DestroyRandomInfo(random_info); if (*argv[0] == '-') { SetGeometryInfo(&geometry_info); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); angle=geometry_info.rho; } caption=GetImageProperty(*image,"caption",exception); new_image=PolaroidImage(*image,draw_info,caption,angle, - interpolate_method,exception); + (*image)->interpolate,exception); break; } if (LocaleCompare("posterize",option) == 0) @@ -2873,8 +2791,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Posterize image. */ - (void) SyncImageSettings(image_info,*image,exception); - (void) PosterizeImage(*image,StringToUnsignedLong(args[0]), + (void) PosterizeImage(*image,StringToUnsignedLong(arg1), quantize_info->dither,exception); break; } @@ -2886,12 +2803,11 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Preview image. */ - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') preview_type=UndefinedPreview; else preview_type=(PreviewType) ParseCommandOption( - MagickPreviewOptions,MagickFalse,args[0]); + MagickPreviewOptions,MagickFalse,arg1); new_image=PreviewImage(*image,preview_type,exception); break; } @@ -2909,13 +2825,12 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, ImageInfo *profile_info; - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') { /* Remove a profile from the image. */ - (void) ProfileImage(*image,args[0],(const unsigned char *) + (void) ProfileImage(*image,arg1,(const unsigned char *) NULL,0,exception); break; } @@ -2926,7 +2841,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, profile=GetImageProfile(*image,"iptc"); if (profile != (StringInfo *) NULL) profile_info->profile=(void *) CloneStringInfo(profile); - profile_image=GetImageCache(profile_info,args[0],exception); + profile_image=GetImageCache(profile_info,arg1,exception); profile_info=DestroyImageInfo(profile_info); if (profile_image == (Image *) NULL) { @@ -2934,7 +2849,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, *profile; profile_info=CloneImageInfo(image_info); - (void) CopyMagickString(profile_info->filename,args[0], + (void) CopyMagickString(profile_info->filename,arg1, MaxTextExtent); profile=FileToStringInfo(profile_info->filename,~0UL,exception); if (profile != (StringInfo *) NULL) @@ -2972,7 +2887,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, break; } quantize_info->colorspace=(ColorspaceType) ParseCommandOption( - MagickColorspaceOptions,MagickFalse,args[0]); + MagickColorspaceOptions,MagickFalse,arg1); break; } break; @@ -2981,15 +2896,14 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("radial-blur",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); new_image=RadialBlurImage(*image,geometry_info.rho, geometry_info.sigma,exception); break; } if (LocaleCompare("raise",option) == 0) { - flags=ParsePageGeometry(*image,args[0],&geometry,exception); + flags=ParsePageGeometry(*image,arg1,&geometry,exception); if ((flags & SigmaValue) == 0) geometry.height=geometry.width; (void) RaiseImage(*image,&geometry,*argv[0] == '-' ? MagickTrue : @@ -2998,17 +2912,16 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("random-threshold",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) RandomThresholdImage(*image,args[0],exception); + (void) RandomThresholdImage(*image,arg1,exception); break; } if (LocaleCompare("recolor",option) == 0) { + /* DEPRECIATED - now "color-matrix" */ KernelInfo *kernel; - (void) SyncImageSettings(image_info,*image,exception); - kernel=AcquireKernelInfo(args[0]); + kernel=AcquireKernelInfo(arg1); if (kernel == (KernelInfo *) NULL) break; new_image=ColorMatrixImage(*image,kernel,exception); @@ -3020,10 +2933,9 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, Image *remap_image; - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') break; - remap_image=GetImageCache(image_info,args[0],exception); + remap_image=GetImageCache(image_info,arg1,exception); if (remap_image == (Image *) NULL) break; (void) RemapImage(quantize_info,*image,remap_image,exception); @@ -3037,14 +2949,13 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, (void) ParseAbsoluteGeometry("0x0+0+0",&(*image)->page); break; } - (void) ResetImagePage(*image,args[0]); + (void) ResetImagePage(*image,arg1); break; } if (LocaleCompare("resample",option) == 0) { /* FUTURE: remove blur - no longer used */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; new_image=ResampleImage(*image,geometry_info.rho, @@ -3054,31 +2965,28 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, if (LocaleCompare("resize",option) == 0) { /* FUTURE: remove blur argument - no longer used */ - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseRegionGeometry(*image,args[0],&geometry,exception); + (void) ParseRegionGeometry(*image,arg1,&geometry,exception); new_image=ResizeImage(*image,geometry.width,geometry.height, (*image)->filter,(*image)->blur,exception); break; } if (LocaleCompare("roll",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParsePageGeometry(*image,args[0],&geometry,exception); + (void) ParsePageGeometry(*image,arg1,&geometry,exception); new_image=RollImage(*image,geometry.x,geometry.y,exception); break; } if (LocaleCompare("rotate",option) == 0) { /* special case rotation flags */ - (void) SyncImageSettings(image_info,*image,exception); - if (strchr(args[0],'>') != (char *) NULL) + if (strchr(arg1,'>') != (char *) NULL) if ((*image)->columns <= (*image)->rows) break; - if (strchr(args[0],'<') != (char *) NULL) + if (strchr(arg1,'<') != (char *) NULL) if ((*image)->columns >= (*image)->rows) break; - (void) ParseGeometry(args[0],&geometry_info); + (void) ParseGeometry(arg1,&geometry_info); new_image=RotateImage(*image,geometry_info.rho,exception); break; } @@ -3088,24 +2996,21 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { if (LocaleCompare("sample",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseRegionGeometry(*image,args[0],&geometry,exception); + (void) ParseRegionGeometry(*image,arg1,&geometry,exception); new_image=SampleImage(*image,geometry.width,geometry.height, exception); break; } if (LocaleCompare("scale",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseRegionGeometry(*image,args[0],&geometry,exception); + (void) ParseRegionGeometry(*image,arg1,&geometry,exception); new_image=ScaleImage(*image,geometry.width,geometry.height, exception); break; } if (LocaleCompare("selective-blur",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & PercentValue) != 0) geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0; new_image=SelectiveBlurImage(*image,geometry_info.rho, @@ -3118,7 +3023,6 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, Break channels into separate images. WARNING: This can generate multiple images! */ - (void) SyncImageSettings(image_info,*image,exception); new_image=SeparateImages(*image,exception); break; } @@ -3127,15 +3031,13 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, double threshold; - (void) SyncImageSettings(image_info,*image,exception); - threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0); + threshold=StringToDoubleInterval(arg1,(double) QuantumRange+1.0); new_image=SepiaToneImage(*image,threshold,exception); break; } if (LocaleCompare("segment",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; (void) SegmentImage(*image,(*image)->colorspace, @@ -3150,40 +3052,39 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, if (*argv[0] == '+') { - if (LocaleNCompare(args[0],"registry:",9) == 0) - (void) DeleteImageRegistry(args[0]+9); + if (LocaleNCompare(arg1,"registry:",9) == 0) + (void) DeleteImageRegistry(arg1+9); else - if (LocaleNCompare(args[0],"argv[0]:",7) == 0) + if (LocaleNCompare(arg1,"argv[0]:",7) == 0) { - (void) DeleteImageOption(image_info,args[0]+7); - (void) DeleteImageArtifact(*image,args[0]+7); + (void) DeleteImageOption(image_info,arg1+7); + (void) DeleteImageArtifact(*image,arg1+7); } else - (void) DeleteImageProperty(*image,args[0]); + (void) DeleteImageProperty(*image,arg1); break; } - value=InterpretImageProperties(image_info,*image,argv[2], + value=InterpretImageProperties(image_info,*image,arg2, exception); if (value == (char *) NULL) break; - if (LocaleNCompare(args[0],"registry:",9) == 0) - (void) SetImageRegistry(StringRegistryType,args[0]+9,value, + if (LocaleNCompare(arg1,"registry:",9) == 0) + (void) SetImageRegistry(StringRegistryType,arg1+9,value, exception); else - if (LocaleNCompare(args[0],"option:",7) == 0) + if (LocaleNCompare(arg1,"option:",7) == 0) { - (void) SetImageOption(image_info,args[0]+7,value); - (void) SetImageArtifact(*image,args[0]+7,value); + (void) SetImageOption(image_info,arg1+7,value); + (void) SetImageArtifact(*image,arg1+7,value); } else - (void) SetImageProperty(*image,args[0],value,exception); + (void) SetImageProperty(*image,arg1,value,exception); value=DestroyString(value); break; } if (LocaleCompare("shade",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; new_image=ShadeImage(*image,(*argv[0] == '-') ? MagickTrue : @@ -3192,8 +3093,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("shadow",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -3208,8 +3108,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("sharpen",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -3220,15 +3119,13 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("shave",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParsePageGeometry(*image,args[0],&geometry,exception); + flags=ParsePageGeometry(*image,arg1,&geometry,exception); new_image=ShaveImage(*image,&geometry,exception); break; } if (LocaleCompare("shear",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; new_image=ShearImage(*image,geometry_info.rho, @@ -3237,8 +3134,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("sigmoidal-contrast",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=(double) QuantumRange/2.0; if ((flags & PercentValue) != 0) @@ -3251,8 +3147,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("sketch",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; new_image=SketchImage(*image,geometry_info.rho, @@ -3264,8 +3159,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, double threshold; - (void) SyncImageSettings(image_info,*image,exception); - threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0); + threshold=StringToDoubleInterval(arg1,(double) QuantumRange+1.0); (void) SolarizeImage(*image,threshold,exception); break; } @@ -3277,10 +3171,9 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, char *arguments; - (void) SyncImageSettings(image_info,*image,exception); method=(SparseColorMethod) ParseCommandOption( - MagickSparseColorOptions,MagickFalse,args[0]); - arguments=InterpretImageProperties(image_info,*image,argv[2], + MagickSparseColorOptions,MagickFalse,arg1); + arguments=InterpretImageProperties(image_info,*image,arg2, exception); if (arguments == (char *) NULL) break; @@ -3291,17 +3184,15 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("splice",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseGravityGeometry(*image,args[0],&geometry,exception); + (void) ParseGravityGeometry(*image,arg1,&geometry,exception); new_image=SpliceImage(*image,&geometry,exception); break; } if (LocaleCompare("spread",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseGeometry(args[0],&geometry_info); + (void) ParseGeometry(arg1,&geometry_info); new_image=SpreadImage(*image,geometry_info.rho, - interpolate_method,exception); + (*image)->interpolate,exception); break; } if (LocaleCompare("statistic",option) == 0) @@ -3309,26 +3200,23 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, StatisticType type; - (void) SyncImageSettings(image_info,*image,exception); type=(StatisticType) ParseCommandOption(MagickStatisticOptions, - MagickFalse,args[0]); - (void) ParseGeometry(argv[2],&geometry_info); + MagickFalse,arg1); + (void) ParseGeometry(arg2,&geometry_info); new_image=StatisticImage(*image,type,(size_t) geometry_info.rho, (size_t) geometry_info.sigma,exception); break; } if (LocaleCompare("strip",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); (void) StripImage(*image,exception); break; } if (LocaleCompare("swirl",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseGeometry(args[0],&geometry_info); + (void) ParseGeometry(arg1,&geometry_info); new_image=SwirlImage(*image,geometry_info.rho, - interpolate_method,exception); + (*image)->interpolate,exception); break; } break; @@ -3340,11 +3228,10 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, double threshold; - (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') threshold=(double) QuantumRange/2; else - threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0); + threshold=StringToDoubleInterval(arg1,(double) QuantumRange+1.0); (void) BilevelImage(*image,threshold,exception); break; } @@ -3353,21 +3240,19 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Thumbnail image. */ - (void) SyncImageSettings(image_info,*image,exception); - (void) ParseRegionGeometry(*image,args[0],&geometry,exception); + (void) ParseRegionGeometry(*image,arg1,&geometry,exception); new_image=ThumbnailImage(*image,geometry.width,geometry.height, exception); break; } if (LocaleCompare("tint",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - new_image=TintImage(*image,args[0],&fill,exception); + new_image=TintImage(*image,arg1,&fill,exception); break; } if (LocaleCompare("transform",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); + /* DEPRECIATED */ new_image=AffineTransformImage(*image,&draw_info->affine, exception); break; @@ -3377,8 +3262,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, PixelInfo target; - (void) SyncImageSettings(image_info,*image,exception); - (void) QueryColorCompliance(args[0],AllCompliance,&target, + (void) QueryColorCompliance(arg1,AllCompliance,&target, exception); (void) TransparentPaintImage(*image,&target,(Quantum) TransparentAlpha,*argv[0] == '-' ? MagickFalse : MagickTrue, @@ -3387,31 +3271,27 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("transpose",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); new_image=TransposeImage(*image,exception); break; } if (LocaleCompare("transverse",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); new_image=TransverseImage(*image,exception); break; } if (LocaleCompare("treedepth",option) == 0) { - quantize_info->tree_depth=StringToUnsignedLong(args[0]); + quantize_info->tree_depth=StringToUnsignedLong(arg1); break; } if (LocaleCompare("trim",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); new_image=TrimImage(*image,exception); break; } if (LocaleCompare("type",option) == 0) { /* Note that "type" setting should have already been defined */ - (void) SyncImageSettings(image_info,*image,exception); (void) SetImageType(*image,type,exception); break; } @@ -3432,14 +3312,12 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("unique-colors",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); new_image=UniqueImageColors(*image,exception); break; } if (LocaleCompare("unsharp",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -3465,8 +3343,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, /* Vignette image. */ - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; if ((flags & XiValue) == 0) @@ -3479,30 +3356,22 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, exception); break; } - if (LocaleCompare("virtual-pixel",option) == 0) - { - /* setting already defined in image_info structure */ - SetImageVirtualPixelMethod(*image, image_info->virtual_pixel_method); - break; - } break; } case 'w': { if (LocaleCompare("wave",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - flags=ParseGeometry(args[0],&geometry_info); + flags=ParseGeometry(arg1,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; - new_image=WaveImage(*image,geometry_info.rho, - geometry_info.sigma,interpolate_method,exception); + new_image=WaveImage(*image,geometry_info.rho,geometry_info.sigma, + (*image)->interpolate,exception); break; } if (LocaleCompare("white-threshold",option) == 0) { - (void) SyncImageSettings(image_info,*image,exception); - (void) WhiteThresholdImage(*image,args[0],exception); + (void) WhiteThresholdImage(*image,arg1,exception); break; } break; @@ -3522,6 +3391,12 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, quantize_info=DestroyQuantizeInfo(quantize_info); draw_info=DestroyDrawInfo(draw_info); status=(MagickStatusType) (exception->severity == UndefinedException ? 1 : 0); + +#undef image_info +#undef draw_info +#undef quantize_info +#undef exception + return(status == 0 ? MagickFalse : MagickTrue); } @@ -3666,7 +3541,7 @@ WandExport MagickBooleanType SequenceOperationImages(ImageInfo *image_info, status=MagickFalse; break; } - (void) ClutImage(image,clut_image,interpolate_method,exception); + (void) ClutImage(image,clut_image,(*image)->interpolate,exception); clut_image=DestroyImage(clut_image); *images=DestroyImageList(*images); *images=image; @@ -4012,12 +3887,6 @@ WandExport MagickBooleanType SequenceOperationImages(ImageInfo *image_info, *images=GetFirstImageInList(q); break; } - if (LocaleCompare("interpolate",argv[0]+1) == 0) - { - interpolate_method=(PixelInterpolateMethod) ParseCommandOption( - MagickInterpolateOptions,MagickFalse,argv[1]); - break; - } break; } case 'l': diff --git a/MagickWand/operation.h b/MagickWand/operation.h index dd825c8ab..6331bff07 100644 --- a/MagickWand/operation.h +++ b/MagickWand/operation.h @@ -24,13 +24,13 @@ extern "C" { extern WandExport MagickBooleanType - ApplySettingInfoOption(ImageInfo *,const int,const char *,ExceptionInfo *), - ApplySimpleOperationImage(ImageInfo *,const int,const char *,const char *, - Image **,ExceptionInfo *), -/*ApplySimpleOperationImages(ImageInfo *,const int,const char **,Image - **,ExceptionInfo *), */ - ApplySequenceOperationImages(ImageInfo *,const int,const char **,Image **, - ExceptionInfo *); + WandSettingOptionWand(MagickWand *,const char *,const char *), + WandSimpleOperationImage(MagickWand *,const int,const char *,const char *, + const char *); + WandSimpleOperationImages(MagickWand *,const int,const char *,const char *, + const char *); + WandListOperationImages(MagickWand *,const int,const char *,const char *, + const char *); #if defined(__cplusplus) || defined(c_plusplus) } -- 2.40.0