From a89dd1754cb0d91d27735def18faff913a369be4 Mon Sep 17 00:00:00 2001 From: anthony Date: Tue, 4 Oct 2011 13:29:35 +0000 Subject: [PATCH] rename and handling of iteration flags to be more logical remove initialization of unused "quantize_info" in wand Both "quantize_info" and added "draw_info" wand elements for CLI use only --- MagickWand/ChangeLog | 7 +- MagickWand/magick-image.c | 92 ++++++++++++-------- MagickWand/magick-wand-private.h | 23 ++--- MagickWand/magick-wand.c | 47 ++++++---- MagickWand/operation.c | 142 ++++++++++++++++++------------- MagickWand/pixel-iterator.c | 2 +- 6 files changed, 192 insertions(+), 121 deletions(-) diff --git a/MagickWand/ChangeLog b/MagickWand/ChangeLog index 70bfac3d4..ab53dbdb3 100644 --- a/MagickWand/ChangeLog +++ b/MagickWand/ChangeLog @@ -1,4 +1,9 @@ -2010-11-21 7.0.0-0 Anthony +2011-10-04 7.0.0-0 Anthony + * rename and handling of Wand iteration flags to be more logical + * addition of "draw_info" in Wand for use by CLI interface (for now) + * also make "quantize_info" in Wand, for CLI interface use only (for now) + +2011-09-21 7.0.0-0 Anthony * new module "operator.c" which will holds the standard CLI options 2010-11-21 6.6.6-0 Cristy diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 48892e063..bac02f6ae 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -377,7 +377,11 @@ WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickAddImage() adds the specified images at the current image location. +% MagickAddImage() adds a clone of the images in the second wand and +% inserts them into the first wand, at the current image location. +% +% Use MagickSetFirstIterator(), to insert new images before all the current +% images in the wand, otherwise image is placed after the current image. % % The format of the MagickAddImage method is: % @@ -397,36 +401,55 @@ static inline MagickBooleanType InsertImageInWand(MagickWand *wand, Image *images) { Image - *sentinel; + *current; + + current=wand->images; /* note the current image */ - sentinel=wand->images; - if (sentinel == (Image *) NULL) + /* if no images in wand, just add them and set first image as current */ + if (current == (Image *) NULL) { wand->images=GetFirstImageInList(images); return(MagickTrue); } - if (wand->active == MagickFalse) + + /* user jumped to first image, so prepend new images - remain active */ + if ((wand->set_first != MagickFalse) && + (current->previous == (Image *) NULL) ) { - if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL)) + PrependImageToList(¤t,images); + wand->images=GetFirstImageInList(images); + return(MagickTrue); + } + wand->set_first = MagickFalse; /* flag no longer valid */ + + /* Current image was flaged as 'pending' iterative processing. */ + if (wand->image_pending != MagickFalse) + { + /* current pending image is the last, append new images */ + if (current->next == (Image *) NULL) { - AppendImageToList(&sentinel,images); + AppendImageToList(¤t,images); wand->images=GetLastImageInList(images); return(MagickTrue); } - if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL)) + /* current pending image is the first image, prepend it */ + if (current->previous == (Image *) NULL) { - PrependImageToList(&sentinel,images); + PrependImageToList(¤t,images); wand->images=GetFirstImageInList(images); return(MagickTrue); } } - if (sentinel->next == (Image *) NULL) + + /* if at last image append new images */ + if (current->next == (Image *) NULL) { - InsertImageInList(&sentinel,images); + InsertImageInList(¤t,images); wand->images=GetLastImageInList(images); return(MagickTrue); } - InsertImageInList(&sentinel,images); + /* otherwise just insert image, just after the current image */ + InsertImageInList(¤t,images); wand->images=GetFirstImageInList(images); return(MagickTrue); } @@ -445,6 +468,8 @@ WandExport MagickBooleanType MagickAddImage(MagickWand *wand, assert(add_wand->signature == WandSignature); if (add_wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",add_wand->name); + + /* clone images in second wand, and insert into first */ images=CloneImageList(add_wand->images,wand->exception); if (images == (Image *) NULL) return(MagickFalse); @@ -3566,7 +3591,7 @@ WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand, % % MagickGetImageBlob() implements direct to memory image formats. It returns % the image as a blob (a formatted "file" in memory) and its length, starting -% from the current position in the image sequence. Use MagickSetImageFormat() +% from the current position in the image sequence. Use MagickSetImageFormat() % to set the format to write to the blob (GIF, JPEG, PNG, etc.). % % Utilize MagickResetIterator() to ensure the write is from the beginning of @@ -6740,7 +6765,8 @@ WandExport MagickBooleanType MagickNewImage(MagickWand *wand, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MagickNextImage() associates the next image in the image list with a magick -% wand. +% wand. It returns true if the it succeeds, meaning the current image is the +% next image to be iterated over. % % The format of the MagickNextImage method is: % @@ -6759,16 +6785,16 @@ WandExport MagickBooleanType MagickNextImage(MagickWand *wand) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - if (wand->pend != MagickFalse) + /* If current image is 'pending' just return true. */ + if (wand->image_pending != MagickFalse) { - wand->pend=MagickFalse; + wand->image_pending=MagickFalse; return(MagickTrue); } + /* If there is no next image, (Iterator is finished) */ if (GetNextImageInList(wand->images) == (Image *) NULL) - { - wand->pend=MagickTrue; return(MagickFalse); - } + /* just move to next image - current image is not 'pending' */ wand->images=GetNextImageInList(wand->images); return(MagickTrue); } @@ -7039,7 +7065,7 @@ WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickPingImage() is like MagickReadImage() except the only valid +% MagickPingImage() is the same as MagickReadImage() except the only valid % information returned is the image width, height, size, and format. It % is designed to efficiently obtain this information from a file without % reading the entire image sequence into memory. @@ -7353,16 +7379,12 @@ WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - if (wand->pend != MagickFalse) - { - wand->pend=MagickFalse; - return(MagickTrue); - } + + wand->image_pending=MagickFalse; /* pending status has no meaning */ + /* If there is no prev image, return false (Iterator is finished) */ if (GetPreviousImageInList(wand->images) == (Image *) NULL) - { - wand->pend=MagickTrue; return(MagickFalse); - } + /* just do it - current image is not 'pending' */ wand->images=GetPreviousImageInList(wand->images); return(MagickTrue); } @@ -7689,10 +7711,11 @@ WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MagickReadImage() reads an image or image sequence. The images are inserted -% at the current image pointer position. Use MagickSetFirstIterator(), -% MagickSetLastIterator, or MagickSetImageIndex() to specify the current -% image pointer position at the beginning of the image list, the end, or -% anywhere in-between respectively. +% at the current image pointer position. +% +% Use MagickSetFirstIterator(), to insert new images before all the current +% images in the wand, MagickSetLastIterator() to append add to the end, +% MagickSetImageIndex() to place images just after the given index. % % The format of the MagickReadImage method is: % @@ -7740,6 +7763,7 @@ WandExport MagickBooleanType MagickReadImage(MagickWand *wand, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MagickReadImageBlob() reads an image or image sequence from a blob. +% In all other respects it is like MagickReadImage(). % % The format of the MagickReadImageBlob method is: % @@ -7782,8 +7806,8 @@ WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickReadImageFile() reads an image or image sequence from an open file -% descriptor. +% MagickReadImageFile() reads an image or image sequence from an already +% opened file descriptor. Otherwise it is like MagickReadImage(). % % The format of the MagickReadImageFile method is: % diff --git a/MagickWand/magick-wand-private.h b/MagickWand/magick-wand-private.h index e43cb700c..1e5970753 100644 --- a/MagickWand/magick-wand-private.h +++ b/MagickWand/magick-wand-private.h @@ -35,24 +35,27 @@ struct _MagickWand id; char - name[MaxTextExtent]; + name[MaxTextExtent]; /* Wand name to use for MagickWand Logs */ - ExceptionInfo - *exception; + Image + *images; /* The images in this wand */ ImageInfo - *image_info; + *image_info; /* Global settings used for images in Wand */ QuantizeInfo - *quantize_info; + *quantize_info; /* for CLI API usage, not used by MagickWand API */ - Image - *images; + DrawInfo + *draw_info; /* for CLI API usage, not used by MagickWand API */ MagickBooleanType - active, - pend, - debug; + set_first, /* wand set to first image, prepend new images */ + image_pending, /* this image is pending Next Iteration */ + debug; /* Log calls to MagickWand library */ + + ExceptionInfo + *exception; size_t signature; diff --git a/MagickWand/magick-wand.c b/MagickWand/magick-wand.c index af1056084..21c8a40c3 100644 --- a/MagickWand/magick-wand.c +++ b/MagickWand/magick-wand.c @@ -72,7 +72,8 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% ClearMagickWand() clears resources associated with the wand. +% ClearMagickWand() clears resources associated with the wand, leaving the +% wand blank, and ready to be used for a new set of images. % % The format of the ClearMagickWand method is: % @@ -89,10 +90,11 @@ WandExport void ClearMagickWand(MagickWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - wand->quantize_info=DestroyQuantizeInfo(wand->quantize_info); - wand->image_info=DestroyImageInfo(wand->image_info); wand->images=DestroyImageList(wand->images); - wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL); + if (wand->quantize_info != (QuantizeInfo *) NULL ) + wand->quantize_info=DestroyQuantizeInfo(wand->quantize_info); + if (wand->draw_info != (DrawInfo *) NULL ) + wand->draw_info=DestroyDrawInfo(wand->draw_info); wand->image_info=AcquireImageInfo(); ClearMagickException(wand->exception); wand->debug=IsEventLogging(); @@ -140,7 +142,14 @@ WandExport MagickWand *CloneMagickWand(const MagickWand *wand) clone_wand->exception=AcquireExceptionInfo(); InheritException(clone_wand->exception,wand->exception); clone_wand->image_info=CloneImageInfo(wand->image_info); - clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info); + if ( wand->quantize_info == (QuantizeInfo *) NULL ) + clone_wand->quantize_info=(QuantizeInfo *) NULL; + else + clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info); + if ( wand->draw_info == (DrawInfo *) NULL ) + clone_wand->draw_info=(DrawInfo *) NULL; + else + clone_wand->draw_info=CloneDrawInfo(wand->draw_info); clone_wand->images=CloneImageList(wand->images,clone_wand->exception); clone_wand->debug=IsEventLogging(); if (clone_wand->debug != MagickFalse) @@ -177,7 +186,10 @@ WandExport MagickWand *DestroyMagickWand(MagickWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - wand->quantize_info=DestroyQuantizeInfo(wand->quantize_info); + if (wand->quantize_info != (QuantizeInfo *) NULL ) + wand->quantize_info=DestroyQuantizeInfo(wand->quantize_info); + if (wand->draw_info != (DrawInfo *) NULL ) + wand->draw_info=DestroyDrawInfo(wand->draw_info); wand->image_info=DestroyImageInfo(wand->image_info); wand->images=DestroyImageList(wand->images); wand->exception=DestroyExceptionInfo(wand->exception); @@ -827,9 +839,9 @@ WandExport void MagickResetIterator(MagickWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - wand->active=MagickFalse; - wand->pend=MagickTrue; wand->images=GetFirstImageInList(wand->images); + wand->set_first=MagickFalse; /* we did not jump to the first image */ + wand->image_pending=MagickTrue; /* this image is the 'next' image */ } /* @@ -860,9 +872,9 @@ WandExport void MagickSetFirstIterator(MagickWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - wand->active=MagickTrue; - wand->pend=MagickFalse; wand->images=GetFirstImageInList(wand->images); + wand->set_first=MagickTrue; /* we jumped to the first image */ + wand->image_pending=MagickFalse; /* but this image is not 'next' */ } /* @@ -909,9 +921,9 @@ WandExport MagickBooleanType MagickSetIteratorIndex(MagickWand *wand, InheritException(wand->exception,&wand->images->exception); return(MagickFalse); } - wand->active=MagickTrue; - wand->pend=MagickFalse; wand->images=image; + wand->set_first=MagickFalse; /* we are not at very start of list */ + wand->image_pending=MagickFalse; /* but it is not iteration pending */ return(MagickTrue); } /* @@ -942,9 +954,9 @@ WandExport void MagickSetLastIterator(MagickWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - wand->active=MagickFalse; - wand->pend=MagickTrue; wand->images=GetLastImageInList(wand->images); + wand->set_first=MagickFalse; /* we are not at very start of list */ + wand->image_pending=MagickFalse; /* and is not iteration pending */ } /* @@ -1039,10 +1051,11 @@ WandExport MagickWand *NewMagickWand(void) wand->id=AcquireWandId(); (void) FormatLocaleString(wand->name,MaxTextExtent,"%s-%.20g",MagickWandId, (double) wand->id); - wand->exception=AcquireExceptionInfo(); - wand->image_info=AcquireImageInfo(); - wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL); wand->images=NewImageList(); + wand->image_info=AcquireImageInfo(); + wand->quantize_info=(QuantizeInfo *) NULL; /* not used in MagickWand API */ + wand->draw_info=(DrawInfo *) NULL; /* not used in MagickWand API */ + wand->exception=AcquireExceptionInfo(); wand->debug=IsEventLogging(); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); diff --git a/MagickWand/operation.c b/MagickWand/operation.c index 89cb720ac..6717a67bb 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -143,12 +143,12 @@ static inline Image *GetImageCache(const ImageInfo *image_info,const char *path, } /* -** SparseColorOption() parse the complex -sparse-color argument into an -** an array of floating point values than call SparseColorImage(). -** Argument is a complex mix of floating-point pixel coodinates, and color -** specifications (or direct floating point numbers). The number of floats -** needed to represent a color varies depending on teh current channel -** setting. + SparseColorOption() parse the complex -sparse-color argument into an + an array of floating point values than call SparseColorImage(). + Argument is a complex mix of floating-point pixel coodinates, and color + specifications (or direct floating point numbers). The number of floats + needed to represent a color varies depending on teh current channel + setting. */ static Image *SparseColorOption(const Image *image, const SparseColorMethod method,const char *arguments, @@ -291,7 +291,8 @@ static Image *SparseColorOption(const Image *image, if ( token[0] == '\0' ) break; if ( isalpha((int) token[0]) || token[0] == '#' ) { /* Color string given */ - (void) QueryMagickColorCompliance(token,&color,exception); + (void) QueryMagickColorCompliance(token,AllComplience,&color, + exception); if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) sparse_arguments[x++] = QuantumScale*color.red; if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) @@ -461,13 +462,13 @@ WandExport MagickBooleanType SettingsOptionInfo(ImageInfo *image_info, if (*argv[0] == '+') { (void) DeleteImageOption(image_info,argv[0]+1); - (void) QueryColorCompliance(BackgroundColor, + (void) QueryColorCompliance(BackgroundColor,AllComplience, &image_info->background_color,exception); break; } (void) SetImageOption(image_info,argv[0]+1,argv[1]); - (void) QueryColorCompliance(argv[1],&image_info->background_color, - exception); + (void) QueryColorCompliance(argv[1],AllComplience, + &image_info->background_color,exception); break; } if (LocaleCompare("bias",argv[0]+1) == 0) @@ -505,11 +506,11 @@ WandExport MagickBooleanType SettingsOptionInfo(ImageInfo *image_info, if (*argv[0] == '+') { (void) DeleteImageOption(image_info,argv[0]+1); - (void) QueryColorCompliance(BorderColor,&image_info->border_color, - exception); + (void) QueryColorCompliance(BorderColor,AllComplience, + &image_info->border_color,exception); break; } - (void) QueryColorCompliance(argv[1],&image_info->border_color, + (void) QueryColorCompliance(argv[1],AllCompliece,&image_info->border_color, exception); (void) SetImageOption(image_info,argv[0]+1,argv[1]); break; @@ -1076,12 +1077,12 @@ WandExport MagickBooleanType SettingsOptionInfo(ImageInfo *image_info, if (*argv[0] == '+') { (void) SetImageOption(image_info,argv[0]+1,argv[1]); - (void) QueryColorCompliance(MatteColor,&image_info->matte_color, - exception); + (void) QueryColorCompliance(MatteColor,AllComplience, + &image_info->matte_color,exception); break; } (void) SetImageOption(image_info,argv[0]+1,argv[1]); - (void) QueryColorCompliance(argv[1],&image_info->matte_color, + (void) QueryColorCompliance(argv[1],AllComplience,&image_info->matte_color, exception); break; } @@ -1378,11 +1379,13 @@ WandExport MagickBooleanType SettingsOptionInfo(ImageInfo *image_info, { if (*argv[0] == '+') { - (void) QueryColorCompliance("none",&image_info->transparent_color, exception); + (void) QueryColorCompliance("none",AllComplience, + &image_info->transparent_color,exception); (void) SetImageOption(image_info,argv[0]+1,"none"); break; } - (void) QueryColorCompliance(argv[1],&image_info->transparent_color, + (void) QueryColorCompliance("none",AllComplience, + &image_info->transparent_color,exception); exception); (void) SetImageOption(image_info,argv[0]+1,argv[1]); break; @@ -1574,7 +1577,8 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, assert((*image)->signature == MagickSignature); if ((*image)->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename); - + if (argc < 0) + return(MagickTrue); draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); quantize_info=AcquireQuantizeInfo(image_info); SetGeometryInfo(&geometry_info); @@ -1612,7 +1616,7 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, (void) SyncImageSettings(image_info,*image); (void) ParseRegionGeometry(*image,argv[1],&geometry,exception); new_image=AdaptiveResizeImage(*image,geometry.width, - geometry.height,exception); + geometry.height,interpolate_method,exception); break; } if (LocaleCompare("adaptive-sharpen",argv[0]+1) == 0) @@ -1811,24 +1815,24 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, flags=ParsePageGeometry(*image,argv[1],&geometry,exception); if ((flags & SigmaValue) == 0) geometry.height=geometry.width; - new_image=BorderImage(*image,&geometry,exception); + new_image=BorderImage(*image,&geometry,compose,exception); break; } if (LocaleCompare("bordercolor",argv[0]+1) == 0) { if (*argv[0] == '+') { - (void) QueryColorCompliance(BorderColor,&draw_info->border_color, - exception); + (void) QueryColorCompliance(BorderColor,AllComplience, + &draw_info->border_color,exception); break; } - (void) QueryColorCompliance(argv[1],&draw_info->border_color, + (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->border_color, exception); break; } if (LocaleCompare("box",argv[0]+1) == 0) { - (void) QueryColorCompliance(argv[1],&draw_info->undercolor, + (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->undercolor, exception); break; } @@ -1986,7 +1990,7 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, } mask_view=DestroyCacheView(mask_view); mask_image->matte=MagickTrue; - (void) SetImageClipMask(*image,mask_image); + (void) SetImageClipMask(*image,mask_image,exception); mask_image=DestroyImage(mask_image); InheritException(exception,&(*image)->exception); break; @@ -2055,6 +2059,13 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, InheritException(exception,&(*image)->exception); break; } + if (LocaleCompare("compose",argv[0]+1) == 0) + { + (void) SyncImageSettings(image_info,*image); + compose=(CompositeOperator) ParseCommandOption(MagickComposeOptions, + MagickFalse,argv[1]); + break; + } if (LocaleCompare("contrast",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); @@ -2425,15 +2436,17 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, GetPixelInfo(*image,&fill); if (*argv[0] == '+') { - (void) QueryMagickColorCompliance("none",&fill,exception); - (void) QueryColorCompliance("none",&draw_info->fill,exception); + (void) QueryMagickColorCompliance("none",AllCompliance,&fill, + exception); + (void) QueryColorCompliance("none",AllComplience,&draw_info->fill, + exception); if (draw_info->fill_pattern != (Image *) NULL) draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); break; } sans=AcquireExceptionInfo(); - (void) QueryMagickColorCompliance(argv[1],&fill,sans); - status=QueryColorCompliance(argv[1],&draw_info->fill,sans); + (void) QueryMagickColorCompliance(argv[1],AllCompliance,&fill,sans); + status=QueryColorCompliance(argv[1],AllComplience,&draw_info->fill,sans); sans=DestroyExceptionInfo(sans); if (status == MagickFalse) draw_info->fill_pattern=GetImageCache(image_info,argv[1], @@ -2468,7 +2481,8 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, */ (void) SyncImageSettings(image_info,*image); (void) ParsePageGeometry(*image,argv[1],&geometry,exception); - (void) QueryMagickColorCompliance(argv[2],&target,exception); + (void) QueryMagickColorCompliance(argv[2],AllCompliance,&target, + exception); (void) FloodfillPaintImage(*image,draw_info,&target,geometry.x, geometry.y,*argv[0] == '-' ? MagickFalse : MagickTrue,exception); break; @@ -2509,7 +2523,7 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, 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,exception); + new_image=FrameImage(*image,&frame_info,compose,exception); break; } if (LocaleCompare("function",argv[0]+1) == 0) @@ -2677,7 +2691,8 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, */ (void) SyncImageSettings(image_info,*image); (void) ParseGeometry(argv[1],&geometry_info); - new_image=ImplodeImage(*image,geometry_info.rho,exception); + new_image=ImplodeImage(*image,geometry_info.rho, + interpolate_method,exception); break; } if (LocaleCompare("interline-spacing",argv[0]+1) == 0) @@ -2689,6 +2704,12 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, draw_info->interline_spacing=geometry_info.rho; break; } + if (LocaleCompare("interpolate",argv[0]+1) == 0) + { + interpolate_method=(PixelInterpolateMethod) ParseCommandOption( + MagickInterpolateOptions,MagickFalse,argv[1]); + break; + } if (LocaleCompare("interword-spacing",argv[0]+1) == 0) { if (*argv[0] == '+') @@ -2782,9 +2803,11 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, p=(const char *) argv[1]; GetMagickToken(p,&p,token); /* get black point color */ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0)) - (void) QueryMagickColorCompliance(token,&black_point,exception); + (void) QueryMagickColorCompliance(token,AllCompliance, + &black_point,exception); else - (void) QueryMagickColorCompliance("#000000",&black_point,exception); + (void) QueryMagickColorCompliance("#000000",AllCompliance, + &black_point,exception); if (isalpha((int) token[0]) || (token[0] == '#')) GetMagickToken(p,&p,token); if (*token == '\0') @@ -2794,9 +2817,11 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, if ((isalpha((int) *token) == 0) && ((*token == '#') == 0)) GetMagickToken(p,&p,token); /* Get white point color. */ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0)) - (void) QueryMagickColorCompliance(token,&white_point,exception); + (void) QueryMagickColorCompliance(token,AllCompliance, + &white_point,exception); else - (void) QueryMagickColorCompliance("#ffffff",&white_point,exception); + (void) QueryMagickColorCompliance("#ffffff",AllCompliance, + &white_point,exception); } (void) LevelImageColors(*image,&black_point,&white_point, *argv[0] == '+' ? MagickTrue : MagickFalse,exception); @@ -3064,7 +3089,8 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, target; (void) SyncImageSettings(image_info,*image); - (void) QueryMagickColorCompliance(argv[1],&target,exception); + (void) QueryMagickColorCompliance(argv[1],AllCompliance,&target, + exception); (void) OpaquePaintImage(*image,&target,&fill,*argv[0] == '-' ? MagickFalse : MagickTrue,exception); break; @@ -3091,10 +3117,12 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, { if (*argv[0] == '+') { - (void) QueryColorCompliance("none",&draw_info->fill,exception); + (void) QueryColorCompliance("none",AllComplience,&draw_info->fill, + exception); break; } - (void) QueryColorCompliance(argv[1],&draw_info->fill,exception); + (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->fill, + exception); break; } if (LocaleCompare("pointsize",argv[0]+1) == 0) @@ -3464,9 +3492,6 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, char *value; - /* - Set image argv[0]. - */ if (*argv[0] == '+') { if (LocaleNCompare(argv[1],"registry:",9) == 0) @@ -3489,9 +3514,8 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, (void) SetImageRegistry(StringRegistryType,argv[1]+9,value, exception); else - if (LocaleNCompare(argv[1],"argv[0]:",7) == 0) + if (LocaleNCompare(argv[1],"option:",7) == 0) { - (void) SetImageOption(image_info,argv[1]+7,value); (void) SetImageOption(image_info,argv[1]+7,value); (void) SetImageArtifact(*image,argv[1]+7,value); } @@ -3694,14 +3718,15 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, if (*argv[0] == '+') { - (void) QueryColorCompliance("none",&draw_info->stroke,exception); + (void) QueryColorCompliance("none",AllComplience,&draw_info->stroke, + exception); if (draw_info->stroke_pattern != (Image *) NULL) draw_info->stroke_pattern=DestroyImage( draw_info->stroke_pattern); break; } sans=AcquireExceptionInfo(); - status=QueryColorCompliance(argv[1],&draw_info->stroke,sans); + status=QueryColorCompliance(argv[1],AllComplience,&draw_info->stroke,sans); sans=DestroyExceptionInfo(sans); if (status == MagickFalse) draw_info->stroke_pattern=GetImageCache(image_info,argv[1], @@ -3805,7 +3830,8 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, target; (void) SyncImageSettings(image_info,*image); - (void) QueryMagickColorCompliance(argv[1],&target,exception); + (void) QueryMagickColorCompliance(argv[1],AllCompliance,&target, + exception); (void) TransparentPaintImage(*image,&target,(Quantum) TransparentAlpha,*argv[0] == '-' ? MagickFalse : MagickTrue, &(*image)->exception); @@ -3864,7 +3890,7 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, { if (LocaleCompare("undercolor",argv[0]+1) == 0) { - (void) QueryColorCompliance(argv[1],&draw_info->undercolor, + (void) QueryColorCompliance(argv[1],AllComplience,&draw_info->undercolor, exception); break; } @@ -3960,7 +3986,7 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, if ((flags & SigmaValue) == 0) geometry_info.sigma=1.0; new_image=WaveImage(*image,geometry_info.rho, - geometry_info.sigma,exception); + geometry_info.sigma,interpolate_method,exception); break; } if (LocaleCompare("weight",argv[0]+1) == 0) @@ -4006,9 +4032,9 @@ MagickExport MagickBooleanType SimpleOperationImage(ImageInfo *image_info, */ quantize_info=DestroyQuantizeInfo(quantize_info); draw_info=DestroyDrawInfo(draw_info); - status=(*image)->exception.severity == UndefinedException ? 1 : 0; - - return(status); + status=(MagickStatusType) ((*image)->exception.severity == + UndefinedException ? 1 : 0); + return(status == 0 ? MagickFalse : MagickTrue); } /* @@ -4064,10 +4090,8 @@ WandExport MagickBooleanType SequenceOperationImages(ImageInfo *image_info, if ((*images)->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", (*images)->filename); - - quantize_info=AcquireQuantizeInfo(image_info); - channel=image_info->channel; - + if ((argc <= 0) || (*argv == (char *) NULL)) + return(MagickTrue); status=MagickTrue; switch (*(argv[0]+1)) @@ -4154,7 +4178,7 @@ WandExport MagickBooleanType SequenceOperationImages(ImageInfo *image_info, status=MagickFalse; break; } - (void) ClutImageChannel(image,channel,clut_image); + (void) ClutImage(image,clut_image,interpolate_method,exception); clut_image=DestroyImage(clut_image); *images=DestroyImageList(*images); *images=image; @@ -4948,6 +4972,8 @@ WandExport MagickBooleanType SequenceOperationImages(ImageInfo *image_info, } quantize_info=DestroyQuantizeInfo(quantize_info); + status=(MagickStatusType) ((*image)->exception.severity == + UndefinedException ? 1 : 0); return(status != 0 ? MagickTrue : MagickFalse); } #endif diff --git a/MagickWand/pixel-iterator.c b/MagickWand/pixel-iterator.c index e1883ebb4..3fa676a0a 100644 --- a/MagickWand/pixel-iterator.c +++ b/MagickWand/pixel-iterator.c @@ -82,7 +82,7 @@ struct _PixelIterator region; MagickBooleanType - active; + active; /* user has been given pixel data */ ssize_t y; -- 2.40.0