From: cristy Date: Thu, 20 Oct 2011 18:41:46 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6774 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=947cb4c68bebf79b15b6f3e824bc973491a77709;p=imagemagick --- diff --git a/MagickCore/display.c b/MagickCore/display.c index 96bbcd806..1cff73077 100644 --- a/MagickCore/display.c +++ b/MagickCore/display.c @@ -15102,8 +15102,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info, resource_info->image_info->filename,MaxTextExtent, "%s:%s",display_image->magick, display_image->filename); - nexus=ReadImage(resource_info->image_info, - &display_image->exception); + nexus=ReadImage(resource_info->image_info,exception); if (nexus != (Image *) NULL) { nexus=DestroyImage(nexus); @@ -15493,9 +15492,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info, (void) CopyMagickString(resource_info->image_info->filename, ((char *) data)+5,MaxTextExtent); } - nexus=ReadImage(resource_info->image_info, - &display_image->exception); - CatchException(&display_image->exception); + nexus=ReadImage(resource_info->image_info,exception); + CatchException(exception); if (nexus != (Image *) NULL) *state|=NextImageState | ExitState; (void) XFree((void *) data); @@ -15964,8 +15962,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info, (void) CopyMagickString(resource_info->image_info->filename, (char *) data,MaxTextExtent); (void) XFree((void *) data); - nexus=ReadImage(resource_info->image_info,&display_image->exception); - CatchException(&display_image->exception); + nexus=ReadImage(resource_info->image_info,exception); + CatchException(exception); if (nexus != (Image *) NULL) *state|=NextImageState | ExitState; break; @@ -16144,8 +16142,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info, status=chdir(resource_info->home_directory); if (status == -1) - (void) ThrowMagickException(&display_image->exception,GetMagickModule(), - FileOpenError,"UnableToOpenFile","%s",resource_info->home_directory); + (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError, + "UnableToOpenFile","%s",resource_info->home_directory); } *image=display_image; return(nexus); diff --git a/MagickCore/draw.c b/MagickCore/draw.c index ac45e1229..3f12950f0 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -153,7 +153,8 @@ typedef struct _PathInfo Forward declarations. */ static MagickBooleanType - DrawStrokePolygon(Image *,const DrawInfo *,const PrimitiveInfo *); + DrawStrokePolygon(Image *,const DrawInfo *,const PrimitiveInfo *, + ExceptionInfo *); static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *,const PrimitiveInfo *); @@ -237,14 +238,16 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, DrawInfo *clone_info; + ExceptionInfo + *exception; + clone_info=(DrawInfo *) AcquireMagickMemory(sizeof(*clone_info)); if (clone_info == (DrawInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); - GetDrawInfo(image_info,clone_info); if (draw_info == (DrawInfo *) NULL) return(clone_info); - + exception=AcquireExceptionInfo(); if (clone_info->primitive != (char *) NULL) (void) CloneString(&clone_info->primitive,draw_info->primitive); if (draw_info->geometry != (char *) NULL) @@ -257,10 +260,10 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, clone_info->stroke_width=draw_info->stroke_width; if (draw_info->fill_pattern != (Image *) NULL) clone_info->fill_pattern=CloneImage(draw_info->fill_pattern,0,0,MagickTrue, - &draw_info->fill_pattern->exception); + exception); if (draw_info->stroke_pattern != (Image *) NULL) clone_info->stroke_pattern=CloneImage(draw_info->stroke_pattern,0,0, - MagickTrue,&draw_info->stroke_pattern->exception); + MagickTrue,exception); clone_info->stroke_antialias=draw_info->stroke_antialias; clone_info->text_antialias=draw_info->text_antialias; clone_info->fill_rule=draw_info->fill_rule; @@ -333,6 +336,7 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, clone_info->alpha=draw_info->alpha; clone_info->element_reference=draw_info->element_reference; clone_info->debug=IsEventLogging(); + exception=DestroyExceptionInfo(exception); return(clone_info); } @@ -938,7 +942,7 @@ static PolygonInfo *DestroyPolygonInfo(PolygonInfo *polygon_info) % The format of the DrawAffineImage method is: % % MagickBooleanType DrawAffineImage(Image *image,const Image *source, -% const AffineMatrix *affine) +% const AffineMatrix *affine,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -948,6 +952,8 @@ static PolygonInfo *DestroyPolygonInfo(PolygonInfo *polygon_info) % % o affine: the affine transform. % +% o exception: return any errors or warnings in this structure. +% */ static SegmentInfo AffineEdge(const Image *image,const AffineMatrix *affine, const double y,const SegmentInfo *edge) @@ -1077,7 +1083,7 @@ static inline double MagickMin(const double x,const double y) } MagickExport MagickBooleanType DrawAffineImage(Image *image, - const Image *source,const AffineMatrix *affine) + const Image *source,const AffineMatrix *affine,ExceptionInfo *exception) { AffineMatrix inverse_affine; @@ -1086,9 +1092,6 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image, *image_view, *source_view; - ExceptionInfo - *exception; - MagickBooleanType status; @@ -1150,7 +1153,6 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image, /* Affine transform image. */ - exception=(&image->exception); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); status=MagickTrue; @@ -1237,7 +1239,7 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image, % The format of the DrawBoundingRectangles method is: % % void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info, -% PolygonInfo *polygon_info) +% PolygonInfo *polygon_info,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -1247,9 +1249,11 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image, % % o polygon_info: Specifies a pointer to a PolygonInfo structure. % +% o exception: return any errors or warnings in this structure. +% */ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info, - const PolygonInfo *polygon_info) + const PolygonInfo *polygon_info,ExceptionInfo *exception) { DrawInfo *clone_info; @@ -1276,7 +1280,7 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info, clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); (void) QueryColorCompliance("#0000",AllCompliance,&clone_info->fill, - &image->exception); + exception); resolution.x=DefaultResolution; resolution.y=DefaultResolution; if (clone_info->density != (char *) NULL) @@ -1329,10 +1333,10 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info, { if (polygon_info->edges[i].direction != 0) (void) QueryColorCompliance("red",AllCompliance,&clone_info->stroke, - &image->exception); + exception); else (void) QueryColorCompliance("green",AllCompliance,&clone_info->stroke, - &image->exception); + exception); start.x=(double) (polygon_info->edges[i].bounds.x1-mid); start.y=(double) (polygon_info->edges[i].bounds.y1-mid); end.x=(double) (polygon_info->edges[i].bounds.x2+mid); @@ -1342,11 +1346,11 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info, primitive_info[0].method=ReplaceMethod; coordinates=(ssize_t) primitive_info[0].coordinates; primitive_info[coordinates].primitive=UndefinedPrimitive; - (void) DrawPrimitive(image,clone_info,primitive_info); + (void) DrawPrimitive(image,clone_info,primitive_info,exception); } } (void) QueryColorCompliance("blue",AllCompliance,&clone_info->stroke, - &image->exception); + exception); start.x=(double) (bounds.x1-mid); start.y=(double) (bounds.y1-mid); end.x=(double) (bounds.x2+mid); @@ -1356,7 +1360,7 @@ static void DrawBoundingRectangles(Image *image,const DrawInfo *draw_info, primitive_info[0].method=ReplaceMethod; coordinates=(ssize_t) primitive_info[0].coordinates; primitive_info[coordinates].primitive=UndefinedPrimitive; - (void) DrawPrimitive(image,clone_info,primitive_info); + (void) DrawPrimitive(image,clone_info,primitive_info,exception); clone_info=DestroyDrawInfo(clone_info); } @@ -1462,7 +1466,8 @@ MagickExport MagickBooleanType DrawClipPath(Image *image, % The format of the DrawDashPolygon method is: % % MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info, -% const PrimitiveInfo *primitive_info,Image *image) +% const PrimitiveInfo *primitive_info,Image *image, +% ExceptionInfo *exception) % % A description of each parameter follows: % @@ -1472,10 +1477,11 @@ MagickExport MagickBooleanType DrawClipPath(Image *image, % % o image: the image. % +% o exception: return any errors or warnings in this structure. % */ static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info, - const PrimitiveInfo *primitive_info,Image *image) + const PrimitiveInfo *primitive_info,Image *image,ExceptionInfo *exception) { DrawInfo *clone_info; @@ -1584,7 +1590,7 @@ static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info, j++; dash_polygon[0].coordinates=(size_t) j; dash_polygon[j].primitive=UndefinedPrimitive; - status|=DrawStrokePolygon(image,clone_info,dash_polygon); + status|=DrawStrokePolygon(image,clone_info,dash_polygon,exception); } n++; if (draw_info->dash_pattern[n] == 0.0) @@ -1607,7 +1613,7 @@ static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info, j++; dash_polygon[0].coordinates=(size_t) j; dash_polygon[j].primitive=UndefinedPrimitive; - status|=DrawStrokePolygon(image,clone_info,dash_polygon); + status|=DrawStrokePolygon(image,clone_info,dash_polygon,exception); } dash_polygon=(PrimitiveInfo *) RelinquishMagickMemory(dash_polygon); clone_info=DestroyDrawInfo(clone_info); @@ -1750,7 +1756,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (*draw_info->primitive != '@') primitive=AcquireString(draw_info->primitive); else - primitive=FileToString(draw_info->primitive+1,~0,&image->exception); + primitive=FileToString(draw_info->primitive+1,~0,exception); if (primitive == (char *) NULL) return(MagickFalse); primitive_extent=(MagickRealType) strlen(primitive); @@ -1788,8 +1794,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, } token=AcquireString(primitive); (void) QueryColorCompliance("#000000",AllCompliance,&start_color, - &image->exception); - if (SetImageStorageClass(image,DirectClass,&image->exception) == MagickFalse) + exception); + if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); status=MagickTrue; for (q=primitive; *q != '\0'; ) @@ -1866,7 +1872,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, { GetMagickToken(q,&q,token); (void) QueryColorCompliance(token,AllCompliance, - &graphic_context[n]->border_color,&image->exception); + &graphic_context[n]->border_color,exception); break; } status=MagickFalse; @@ -1988,7 +1994,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, else { status=QueryColorCompliance(token,AllCompliance, - &graphic_context[n]->fill,&image->exception); + &graphic_context[n]->fill,exception); if (status == MagickFalse) { ImageInfo @@ -1997,9 +2003,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, pattern_info=AcquireImageInfo(); (void) CopyMagickString(pattern_info->filename,token, MaxTextExtent); - graphic_context[n]->fill_pattern= - ReadImage(pattern_info,&image->exception); - CatchException(&image->exception); + graphic_context[n]->fill_pattern=ReadImage(pattern_info, + exception); + CatchException(exception); pattern_info=DestroyImageInfo(pattern_info); } } @@ -2243,9 +2249,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, { if (n <= 0) { - (void) ThrowMagickException(&image->exception, - GetMagickModule(),DrawError, - "UnbalancedGraphicContextPushPop","`%s'",token); + (void) ThrowMagickException(exception,GetMagickModule(), + DrawError,"UnbalancedGraphicContextPushPop","`%s'",token); n=0; break; } @@ -2409,9 +2414,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, graphic_context,(size_t) (n+1),sizeof(*graphic_context)); if (graphic_context == (DrawInfo **) NULL) { - (void) ThrowMagickException(&image->exception, - GetMagickModule(),ResourceLimitError, - "MemoryAllocationFailed","`%s'",image->filename); + (void) ThrowMagickException(exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'", + image->filename); break; } graphic_context[n]=CloneDrawInfo((ImageInfo *) NULL, @@ -2486,9 +2491,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, GetMagickToken(q,&q,token); (void) QueryColorCompliance(token,AllCompliance,&stop_color, - &image->exception); + exception); (void) GradientImage(image,LinearGradient,ReflectSpread, - &start_color,&stop_color,&image->exception); + &start_color,&stop_color,exception); start_color=stop_color; GetMagickToken(q,&q,token); break; @@ -2503,7 +2508,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, else { status=QueryColorCompliance(token,AllCompliance, - &graphic_context[n]->stroke,&image->exception); + &graphic_context[n]->stroke,exception); if (status == MagickFalse) { ImageInfo @@ -2512,9 +2517,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, pattern_info=AcquireImageInfo(); (void) CopyMagickString(pattern_info->filename,token, MaxTextExtent); - graphic_context[n]->stroke_pattern= - ReadImage(pattern_info,&image->exception); - CatchException(&image->exception); + graphic_context[n]->stroke_pattern=ReadImage(pattern_info, + exception); + CatchException(exception); pattern_info=DestroyImageInfo(pattern_info); } } @@ -2552,9 +2557,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, sizeof(*graphic_context[n]->dash_pattern)); if (graphic_context[n]->dash_pattern == (double *) NULL) { - (void) ThrowMagickException(&image->exception, - GetMagickModule(),ResourceLimitError, - "MemoryAllocationFailed","`%s'",image->filename); + (void) ThrowMagickException(exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'", + image->filename); break; } for (j=0; j < x; j++) @@ -2678,7 +2683,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, { GetMagickToken(q,&q,token); (void) QueryColorCompliance(token,AllCompliance, - &graphic_context[n]->undercolor,&image->exception); + &graphic_context[n]->undercolor,exception); break; } if (LocaleCompare("translate",keyword) == 0) @@ -2784,7 +2789,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, (size_t) number_points,sizeof(*primitive_info)); if (primitive_info == (PrimitiveInfo *) NULL) { - (void) ThrowMagickException(&image->exception,GetMagickModule(), + (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename); break; } @@ -2831,8 +2836,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, case BezierPrimitive: { if (primitive_info[j].coordinates > 107) - (void) ThrowMagickException(&image->exception,GetMagickModule(), - DrawError,"TooManyBezierCoordinates","`%s'",token); + (void) ThrowMagickException(exception,GetMagickModule(),DrawError, + "TooManyBezierCoordinates","`%s'",token); length=BezierQuantum*primitive_info[j].coordinates; break; } @@ -2890,7 +2895,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, (size_t) number_points,sizeof(*primitive_info)); if (primitive_info == (PrimitiveInfo *) NULL) { - (void) ThrowMagickException(&image->exception,GetMagickModule(), + (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", image->filename); break; @@ -3091,7 +3096,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, graphic_context[n-1]->clip_mask) != 0)) (void) DrawClipPath(image,graphic_context[n], graphic_context[n]->clip_mask,exception); - (void) DrawPrimitive(image,graphic_context[n],primitive_info); + (void) DrawPrimitive(image,graphic_context[n],primitive_info,exception); } if (primitive_info->text != (char *) NULL) primitive_info->text=(char *) RelinquishMagickMemory( @@ -3135,7 +3140,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, % The format of the DrawGradientImage method is: % % MagickBooleanType DrawGradientImage(Image *image, -% const DrawInfo *draw_info) +% const DrawInfo *draw_info,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -3143,6 +3148,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, % % o draw_info: the draw info. % +% o exception: return any errors or warnings in this structure. +% */ static inline MagickRealType GetStopColorOffset(const GradientInfo *gradient, @@ -3200,7 +3207,7 @@ static inline MagickRealType GetStopColorOffset(const GradientInfo *gradient, } MagickExport MagickBooleanType DrawGradientImage(Image *image, - const DrawInfo *draw_info) + const DrawInfo *draw_info,ExceptionInfo *exception) { CacheView *image_view; @@ -3211,9 +3218,6 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image, const SegmentInfo *gradient_vector; - ExceptionInfo - *exception; - MagickBooleanType status; @@ -3247,7 +3251,6 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image, length=sqrt(point.x*point.x+point.y*point.y); bounding_box=gradient->bounding_box; status=MagickTrue; - exception=(&image->exception); GetPixelInfo(image,&zero); image_view=AcquireCacheView(image); #if defined(MAGICKCORE_OPENMP_SUPPORT) @@ -3501,7 +3504,7 @@ MagickExport MagickBooleanType DrawPatternPath(Image *image, *pattern=DestroyImage(*pattern); image_info=AcquireImageInfo(); image_info->size=AcquireString(geometry); - *pattern=AcquireImage(image_info,&image->exception); + *pattern=AcquireImage(image_info,exception); image_info=DestroyImageInfo(image_info); (void) QueryColorCompliance("#00000000",AllCompliance, &(*pattern)->background_color,exception); @@ -3536,7 +3539,8 @@ MagickExport MagickBooleanType DrawPatternPath(Image *image, % The format of the DrawPolygonPrimitive method is: % % MagickBooleanType DrawPolygonPrimitive(Image *image, -% const DrawInfo *draw_info,const PrimitiveInfo *primitive_info) +% const DrawInfo *draw_info,const PrimitiveInfo *primitive_info, +% ExceptionInfo *exception) % % A description of each parameter follows: % @@ -3546,6 +3550,8 @@ MagickExport MagickBooleanType DrawPatternPath(Image *image, % % o primitive_info: Specifies a pointer to a PrimitiveInfo structure. % +% o exception: return any errors or warnings in this structure. +% */ static PolygonInfo **DestroyPolygonThreadSet(PolygonInfo **polygon_info) @@ -3768,14 +3774,12 @@ static MagickRealType GetPixelOpacity(PolygonInfo *polygon_info, } static MagickBooleanType DrawPolygonPrimitive(Image *image, - const DrawInfo *draw_info,const PrimitiveInfo *primitive_info) + const DrawInfo *draw_info,const PrimitiveInfo *primitive_info, + ExceptionInfo *exception) { CacheView *image_view; - ExceptionInfo - *exception; - MagickBooleanType fill, status; @@ -3816,7 +3820,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, if (polygon_info == (PolygonInfo **) NULL) return(MagickFalse); if (0) - DrawBoundingRectangles(image,draw_info,polygon_info[0]); + DrawBoundingRectangles(image,draw_info,polygon_info[0],exception); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-polygon"); fill=(primitive_info->method == FillToBorderMethod) || @@ -3848,7 +3852,6 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, bounds.y2=bounds.y2 < 0.0 ? 0.0 : (size_t) floor(bounds.y2+0.5) >= image->rows ? (double) image->rows-1.0 : bounds.y2; status=MagickTrue; - exception=(&image->exception); start=(ssize_t) ceil(bounds.x1-0.5); stop=(ssize_t) floor(bounds.x2+0.5); image_view=AcquireCacheView(image); @@ -3990,7 +3993,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, % The format of the DrawPrimitive method is: % % MagickBooleanType DrawPrimitive(Image *image,const DrawInfo *draw_info, -% PrimitiveInfo *primitive_info) +% PrimitiveInfo *primitive_info,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -4000,6 +4003,8 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, % % o primitive_info: Specifies a pointer to a PrimitiveInfo structure. % +% o exception: return any errors or warnings in this structure. +% */ static void LogPrimitiveInfo(const PrimitiveInfo *primitive_info) @@ -4105,14 +4110,12 @@ static void LogPrimitiveInfo(const PrimitiveInfo *primitive_info) } MagickExport MagickBooleanType DrawPrimitive(Image *image, - const DrawInfo *draw_info,const PrimitiveInfo *primitive_info) + const DrawInfo *draw_info,const PrimitiveInfo *primitive_info, + ExceptionInfo *exception) { CacheView *image_view; - ExceptionInfo - *exception; - MagickStatusType status; @@ -4133,7 +4136,6 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, draw_info->affine.tx,draw_info->affine.ty); } status=MagickTrue; - exception=(&image->exception); x=(ssize_t) ceil(primitive_info->point.x-0.5); y=(ssize_t) ceil(primitive_info->point.y-0.5); image_view=AcquireCacheView(image); @@ -4455,12 +4457,12 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, clone_info=AcquireImageInfo(); if (LocaleNCompare(primitive_info->text,"data:",5) == 0) composite_image=ReadInlineImage(clone_info,primitive_info->text, - &image->exception); + exception); else { (void) CopyMagickString(clone_info->filename,primitive_info->text, MaxTextExtent); - composite_image=ReadImage(clone_info,&image->exception); + composite_image=ReadImage(clone_info,exception); } clone_info=DestroyImageInfo(clone_info); if (composite_image == (Image *) NULL) @@ -4496,14 +4498,13 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, (void) FormatLocaleString(composite_geometry,MaxTextExtent, "%.20gx%.20g%+.20g%+.20g",(double) composite_image->columns,(double) composite_image->rows,(double) geometry.x,(double) geometry.y); - (void) ParseGravityGeometry(image,composite_geometry,&geometry, - &image->exception); + (void) ParseGravityGeometry(image,composite_geometry,&geometry,exception); affine=draw_info->affine; affine.tx=(double) geometry.x; affine.ty=(double) geometry.y; composite_image->interpolate=image->interpolate; if (draw_info->compose == OverCompositeOp) - (void) DrawAffineImage(image,composite_image,&affine); + (void) DrawAffineImage(image,composite_image,&affine,exception); else (void) CompositeImage(image,draw_info->compose,composite_image, geometry.x,geometry.y,exception); @@ -4533,9 +4534,10 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); clone_info->stroke_width=0.0; clone_info->stroke.alpha=(Quantum) TransparentAlpha; - status=DrawPolygonPrimitive(image,clone_info,primitive_info); + status=DrawPolygonPrimitive(image,clone_info,primitive_info, + exception); clone_info=DestroyDrawInfo(clone_info); - (void) DrawDashPolygon(draw_info,primitive_info,image); + (void) DrawDashPolygon(draw_info,primitive_info,image,exception); break; } mid=ExpandAffine(&draw_info->affine)*draw_info->stroke_width/2.0; @@ -4559,18 +4561,20 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, (draw_info->linejoin == RoundJoin)) || (primitive_info[i].primitive != UndefinedPrimitive)) { - (void) DrawPolygonPrimitive(image,draw_info,primitive_info); + (void) DrawPolygonPrimitive(image,draw_info,primitive_info, + exception); break; } clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); clone_info->stroke_width=0.0; clone_info->stroke.alpha=(Quantum) TransparentAlpha; - status=DrawPolygonPrimitive(image,clone_info,primitive_info); + status=DrawPolygonPrimitive(image,clone_info,primitive_info, + exception); clone_info=DestroyDrawInfo(clone_info); - status|=DrawStrokePolygon(image,draw_info,primitive_info); + status|=DrawStrokePolygon(image,draw_info,primitive_info,exception); break; } - status=DrawPolygonPrimitive(image,draw_info,primitive_info); + status=DrawPolygonPrimitive(image,draw_info,primitive_info,exception); break; } } @@ -4611,7 +4615,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, */ static void DrawRoundLinecap(Image *image,const DrawInfo *draw_info, - const PrimitiveInfo *primitive_info) + const PrimitiveInfo *primitive_info,ExceptionInfo *exception) { PrimitiveInfo linecap[5]; @@ -4627,11 +4631,12 @@ static void DrawRoundLinecap(Image *image,const DrawInfo *draw_info, linecap[2].point.y+=(double) (10.0*MagickEpsilon); linecap[3].point.y+=(double) (10.0*MagickEpsilon); linecap[4].primitive=UndefinedPrimitive; - (void) DrawPolygonPrimitive(image,draw_info,linecap); + (void) DrawPolygonPrimitive(image,draw_info,linecap,exception); } static MagickBooleanType DrawStrokePolygon(Image *image, - const DrawInfo *draw_info,const PrimitiveInfo *primitive_info) + const DrawInfo *draw_info,const PrimitiveInfo *primitive_info, + ExceptionInfo *exception) { DrawInfo *clone_info; @@ -4662,15 +4667,15 @@ static MagickBooleanType DrawStrokePolygon(Image *image, for (p=primitive_info; p->primitive != UndefinedPrimitive; p+=p->coordinates) { stroke_polygon=TraceStrokePolygon(draw_info,p); - status=DrawPolygonPrimitive(image,clone_info,stroke_polygon); + status=DrawPolygonPrimitive(image,clone_info,stroke_polygon,exception); stroke_polygon=(PrimitiveInfo *) RelinquishMagickMemory(stroke_polygon); q=p+p->coordinates-1; closed_path=(q->point.x == p->point.x) && (q->point.y == p->point.y) ? MagickTrue : MagickFalse; if ((draw_info->linecap == RoundCap) && (closed_path == MagickFalse)) { - DrawRoundLinecap(image,draw_info,p); - DrawRoundLinecap(image,draw_info,q); + DrawRoundLinecap(image,draw_info,p,exception); + DrawRoundLinecap(image,draw_info,q,exception); } } clone_info=DestroyDrawInfo(clone_info); diff --git a/MagickCore/draw.h b/MagickCore/draw.h index 16c9de00e..cb16cec24 100644 --- a/MagickCore/draw.h +++ b/MagickCore/draw.h @@ -376,13 +376,13 @@ extern MagickExport DrawInfo *DestroyDrawInfo(DrawInfo *); extern MagickExport MagickBooleanType - DrawAffineImage(Image *,const Image *,const AffineMatrix *), + DrawAffineImage(Image *,const Image *,const AffineMatrix *,ExceptionInfo *), DrawClipPath(Image *,const DrawInfo *,const char *,ExceptionInfo *), - DrawGradientImage(Image *,const DrawInfo *), + DrawGradientImage(Image *,const DrawInfo *,ExceptionInfo *), DrawImage(Image *,const DrawInfo *,ExceptionInfo *), DrawPatternPath(Image *,const DrawInfo *,const char *,Image **, ExceptionInfo *), - DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *); + DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *,ExceptionInfo *); extern MagickExport void GetAffineMatrix(AffineMatrix *), diff --git a/MagickCore/image.h b/MagickCore/image.h index 64cf5bc83..63da1c729 100644 --- a/MagickCore/image.h +++ b/MagickCore/image.h @@ -393,7 +393,7 @@ struct _ImageInfo *density; /* for image and draw_info */ double - pointsize, /* font pointsize - for draw_info */ + pointsize, fuzz; /* current color fuzz attribute */ PixelInfo diff --git a/MagickCore/paint.c b/MagickCore/paint.c index ae2d91f77..771e9a899 100644 --- a/MagickCore/paint.c +++ b/MagickCore/paint.c @@ -465,7 +465,7 @@ MagickExport MagickBooleanType GradientImage(Image *image, /* Draw a gradient on the image. */ - status=DrawGradientImage(image,draw_info); + status=DrawGradientImage(image,draw_info,exception); draw_info=DestroyDrawInfo(draw_info); if ((start_color->alpha == OpaqueAlpha) && (stop_color->alpha == OpaqueAlpha)) image->matte=MagickFalse; diff --git a/MagickWand/operation.c b/MagickWand/operation.c index c537a26b5..8bd5a3aa9 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -507,9 +507,6 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("blue-primary",option) == 0) { - /* Image chromaticity X,Y NB: Y=X if Y not defined - Used by many coders - */ (void) SetImageOption(image_info,option, IfSetOption ? argv[1] : "0" ); break; @@ -560,7 +557,6 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("caption",option) == 0) { - /* Only used for new images via AquireImage() */ (void) SetImageOption(image_info,option, IfSetOption ? argv[1] : (const char*)NULL); break; @@ -569,12 +565,11 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { image_info->channel=(ChannelType) ( IfSetOption ? ParseChannelOption(argv[1]) : DefaultChannels ); - /* FUTURE: This is also a SimpleImageOperator!!! */ + /* This is also a SimpleImageOperator */ break; } if (LocaleCompare("colorspace",option) == 0) { - /* Setting for new images, and for existing images */ /* This is also a SimpleImageOperator */ /* Undefined colorspace means don't modify images */ image_info->colorspace=UndefinedColorspace; @@ -585,16 +580,14 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("comment",option) == 0) { - /* Only used for new images via AquireImage() */ (void) SetImageOption(image_info,option, IfSetOption ? argv[1] : (const char*)NULL); break; } if (LocaleCompare("compose",option) == 0) { - /* FUTURE: image_info should be used, Option for escapes - This option should NOT be used to set image 'compose' - which is used by "-layer" operators is image_info is undefined + /* FUTURE: What should be used? image_info or ImageOption ??? + The former is more efficent, but Crisy prefers the latter! */ (void) SetImageOption(image_info,option, IfSetOption ? argv[1] : (const char*)NULL); @@ -657,8 +650,8 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("delay",option) == 0) { - /* Only used for new images via AcquireImage() - Option should also be used for "-morph" (color morphong) + /* transfered to new images only via AcquireImage() + -set delay must be used to set attributes directly. */ (void) SetImageOption(image_info,option, IfSetOption ? argv[1] : "0"); @@ -666,8 +659,10 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("density",option) == 0) { - /* Used by both draw_info and in images via SyncImageSettings() */ - if (IfSetOption) + /* FUTURE: At this time everyone is using image_info string + The Image Option is not being used. + */ + if (IsSetOption) { (void) CloneString(&image_info->density,argv[1]); (void) CloneString(&draw_info->density,argv[1]); @@ -767,8 +762,6 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("fill",option) == 0) { - /* set fill OR a fill-pattern */ - /* FUTURE: tile is only set in draw_info, not in image_info ! */ const char value; @@ -795,7 +788,7 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, IfSetOption ? argv[1] : "undefined"); break; } - if (LocaleCompare("font",option) == 0) + if (LocaleCompare("font",argv[0]+1) == 0) { (void) CloneString(&draw_info->font, IfSetOption ? argv[1] : (const char *) NULL); @@ -804,33 +797,31 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("format",option) == 0) { - /* FUTURE: why the ping test, you could set ping after this! */ - /* + /* FUTURE: why the ping test, the user could set ping after this! */ register const char *q; for (q=strchr(argv[1],'%'); q != (char *) NULL; q=strchr(q+1,'%')) if (strchr("Agkrz@[#",*(q+1)) != (char *) NULL) image_info->ping=MagickFalse; - */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : (const char *) NULL); + (void) SetImageOption(image_info,option,argv[1]); break; } if (LocaleCompare("fuzz",option) == 0) { /* FUTURE: image_info and ImageOption! Option used to set image fuzz! unless blank canvas (from color) - Image attribute used for color compare operations - image->fuzz is being set by SyncImageSettings() - Can't find anything making use of image_info->fuzz + image attribute used for color compare operations + Can't find anything using image_info->fuzz (except cloning)! */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : (const char *) NULL); if (IfSetOption) - image_info->fuzz=SiPrefixToDouble(argv[1],(double) QuantumRange+1.0); - else - image_info->fuzz=0.0; + { + image_info->fuzz=SiPrefixToDouble(argv[1],(double) QuantumRange+1.0); + (void) SetImageOption(image_info,option,argv[1]); + break; + } + image_info->fuzz=0.0; + (void) SetImageOption(image_info,option,"0"); break; } break; @@ -839,23 +830,25 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("gravity",option) == 0) { - /* FUTURE gravity also set in image via SyncImageSettings() */ - const char - value; - - value = IfSetOption ? argv[1] : "none"; - (void) SetImageOption(image_info,option,value); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"undefined"); + draw_info->gravity=UndefinedGravity; + break; + } + (void) SetImageOption(image_info,option,argv[1]); draw_info->gravity=(GravityType) ParseCommandOption( - MagickGravityOptions,MagickFalse,value); + MagickGravityOptions,MagickFalse,argv[1]); break; } if (LocaleCompare("green-primary",option) == 0) { - /* Image chromaticity X,Y NB: Y=X if Y not defined - Used by many coders - */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : "0.0"); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"0.0"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } break; @@ -864,58 +857,55 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("intent",option) == 0) { - /* FUTURE: this should also set image->rendering_intent - Which is only used by coders: MIFF, MPC, BMP, PNG - and for image profile call to AcquireTransformThreadSet() - */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : "undefined"); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"undefined"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } if (LocaleCompare("interlace",option) == 0) { - /* sets image attibute interlace via SyncImageSettings() - Also image_info is directly used by coders - */ - const char - value; - - value = IfSetOption ? argv[1] : "undefined"; - (void) SetImageOption(image_info,option, value); + if (*argv[0] == '+') + { + image_info->interlace=UndefinedInterlace; + (void) SetImageOption(image_info,option,"undefined"); + break; + } image_info->interlace=(InterlaceType) ParseCommandOption( - MagickInterlaceOptions,MagickFalse,value); + MagickInterlaceOptions,MagickFalse,argv[1]); + (void) SetImageOption(image_info,option,argv[1]); break; } if (LocaleCompare("interline-spacing",option) == 0) { - const char - value; - - value = IfSetOption ? argv[1] : "0"; /* undefined? */ - (void) SetImageOption(image_info,option, value); - draw_info->interline_spacing=InterpretLocaleValue(value, - (char **) NULL); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"undefined"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } if (LocaleCompare("interpolate",option) == 0) { - /* FUTURE: sets image interpolate value via SyncImageSettings() - It is NOT used by coders, only in image processing, - so shoud really be a image_info attribute. - */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : "undefined"); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"undefined"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } - if (LocaleCompare("interword-spacing",argv[0]+1) == 0) + if (LocaleCompare("interword-spacing",option) == 0) { - const char - value; - - value = IfSetOption ? argv[1] : "0"; /* undefined? */ - (void) SetImageOption(image_info,option, value); - draw_info->interword_spacing=InterpretLocaleValue(value, - (char **) NULL); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"undefined"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } break; @@ -924,12 +914,12 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("kerning",option) == 0) { - const char - value; - - value = IfSetOption ? argv[1] : "0"; /* undefined? */ - (void) SetImageOption(image_info,option, value); - draw_info->kerning=InterpretLocaleValue(value,(char **) NULL); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"undefined"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } break; @@ -938,9 +928,12 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("label",option) == 0) { - /* only used for new images */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : (char *)NULL); + if (*argv[0] == '+') + { + (void) DeleteImageOption(image_info,option); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } if (LocaleCompare("limit",option) == 0) @@ -951,7 +944,7 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, ResourceType type; - if (!IsSetOption) + if (*argv[0] == '+') break; type=(ResourceType) ParseCommandOption(MagickResourceOptions, MagickFalse,argv[1]); @@ -961,18 +954,14 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, (void) SetMagickResourceLimit(type,limit); break; } - if (LocaleCompare("linewidth",argv[0]+1) == 0) - { - /* FUTURE: obsoleted by stroke-width setting */ - draw_info->stroke_width=InterpretLocaleValue(argv[1], - (char **) NULL); - break; - } if (LocaleCompare("list",option) == 0) { ssize_t list; + /* + Display configuration list. + */ list=ParseCommandOption(MagickListOptions,MagickFalse,argv[1]); switch (list) { @@ -1057,26 +1046,47 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("log",option) == 0) { - if (IsSetOption) - (void) SetLogFormat(argv[1]); + if (*argv[0] == '+') + break; + (void) SetLogFormat(argv[1]); break; } if (LocaleCompare("loop",option) == 0) { - /* Sets image attibutes iterations via SyncImageSettings() */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : "0"); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"0"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } break; } case 'm': { + if (LocaleCompare("matte",option) == 0) + { + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"false"); + break; + } + (void) SetImageOption(image_info,option,"true"); + break; + } if (LocaleCompare("mattecolor",option) == 0) { + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,argv[1]); + (void) QueryColorCompliance(MatteColor,AllCompliance, + &image_info->matte_color,exception); + break; + } (void) SetImageOption(image_info,option,argv[1]); - (void) QueryColorCompliance(argv[1],AllCompliance, - &image_info->matte_color,exception); + (void) QueryColorCompliance(argv[1],AllCompliance,&image_info->matte_color, + exception); break; } if (LocaleCompare("monitor",option) == 0) @@ -1087,8 +1097,7 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("monochrome",option) == 0) { - /* Setting (for input coders) and a 'type' operation */ - image_info->monochrome=IsSetOption ? MagickTrue : MagickFalse; + image_info->monochrome=(*argv[0] == '-') ? MagickTrue : MagickFalse; break; } break; @@ -1097,17 +1106,15 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("orient",option) == 0) { - /* Sets image attribute orientation via SyncImageSettings() - Is not used when defining for new images. - This makes it more of a 'operation' than a setting - */ - const char - value; - - value = IfSetOption ? argv[1] : "undefined"; - (void) SetImageOption(image_info,option, value); - image_info->orientation=(InterlaceType) ParseCommandOption( - MagickOrientationOptions,MagickFalse,value); + if (*argv[0] == '+') + { + image_info->orientation=UndefinedOrientation; + (void) SetImageOption(image_info,option,"undefined"); + break; + } + image_info->orientation=(OrientationType) ParseCommandOption( + MagickOrientationOptions,MagickFalse,argv[1]); + (void) SetImageOption(image_info,option,argv[1]); break; } } @@ -1115,7 +1122,6 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("page",option) == 0) { - /* Only used for new images and image generators */ char *canonical_page, page[MaxTextExtent]; @@ -1129,7 +1135,7 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, RectangleInfo geometry; - if (!IsSetOption) + if (*argv[0] == '+') { (void) DeleteImageOption(image_info,option); (void) CloneString(&image_info->page,(char *) NULL); @@ -1152,6 +1158,16 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, (void) CloneString(&image_info->page,page); break; } + if (LocaleCompare("pen",option) == 0) + { + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"none"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); + break; + } if (LocaleCompare("ping",option) == 0) { image_info->ping=(*argv[0] == '-') ? MagickTrue : MagickFalse; @@ -1159,12 +1175,11 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, } if (LocaleCompare("pointsize",option) == 0) { - double - value=12.0; - - if (IfSetOption) - InterpretLocaleValue(argv[1],(char **) NULL); - image_info->pointsize=draw_info->pointsize=value; + if (*argv[0] == '+') + geometry_info.rho=0.0; + else + (void) ParseGeometry(argv[1],&geometry_info); + image_info->pointsize=geometry_info.rho; break; } if (LocaleCompare("precision",option) == 0) @@ -1172,55 +1187,55 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, (void) SetMagickPrecision(StringToInteger(argv[1])); break; } - /* FUTURE: Only the 'preview' coder appears to use this - * Depreciate the coder? Leaving only the 'preview' operator. if (LocaleCompare("preview",option) == 0) { - image_info->preview_type=UndefinedPreview; - if (IfSetOption) - image_info->preview_type=(PreviewType) ParseCommandOption( - MagickPreviewOptions,MagickFalse,argv[1]); + /* + Preview image. + */ + if (*argv[0] == '+') + { + image_info->preview_type=UndefinedPreview; + break; + } + image_info->preview_type=(PreviewType) ParseCommandOption( + MagickPreviewOptions,MagickFalse,argv[1]); break; } - */ break; } case 'q': { if (LocaleCompare("quality",option) == 0) { - if (IfSetOption) + /* + Set image compression quality. + */ + if (*argv[0] == '+') { - image_info->quality=StringToUnsignedLong(argv[1]); - (void) SetImageOption(image_info,option,argv[1]); + image_info->quality=UndefinedCompressionQuality; + (void) SetImageOption(image_info,option,"0"); break; } - image_info->quality=UndefinedCompressionQuality; - (void) SetImageOption(image_info,option,"0"); - break; - } - if (LocaleCompare("quantize",option) == 0) - { - /* no image_info setting! Only set direct in quantize_info */ - quantize_info->colorspace=UndefinedColorspace; - if (IfSetOption) - quantize_info->colorspace=(ColorspaceType) ParseCommandOption( - MagickColorspaceOptions,MagickFalse,argv[1]); + image_info->quality=StringToUnsignedLong(argv[1]); + (void) SetImageOption(image_info,option,argv[1]); break; } if (LocaleCompare("quiet",option) == 0) { - /* FUTURE: if two -quiet is performed you can not do +quiet! */ static WarningHandler warning_handler = (WarningHandler) NULL; if (*argv[0] == '+') { - /* Restore error or warning messages. */ + /* + Restore error or warning messages. + */ warning_handler=SetWarningHandler(warning_handler); break; } - /* Suppress error or warning messages. */ + /* + Suppress error or warning messages. + */ warning_handler=SetWarningHandler((WarningHandler) NULL); break; } @@ -1230,11 +1245,12 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, { if (LocaleCompare("red-primary",option) == 0) { - /* Image chromaticity X,Y NB: Y=X if Y not defined - Used by many coders - */ - (void) SetImageOption(image_info,option, - IfSetOption ? argv[1] : "0" ); + if (*argv[0] == '+') + { + (void) SetImageOption(image_info,option,"0.0"); + break; + } + (void) SetImageOption(image_info,option,argv[1]); break; } break; @@ -1355,13 +1371,6 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info, (void) CloneString(&image_info->texture,argv[1]); break; } - if (LocaleCompare("tile",option) == 0) - { - draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); - if (ISSetOption) - draw_info->fill_pattern=GetImageCache(image_info,argv[1],exception); - break; - } if (LocaleCompare("tile-offset",option) == 0) { if (*argv[0] == '+') @@ -1585,11 +1594,11 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image = (Image *)NULL; - switch (*(option)) + switch (*(argv[0]+1)) { case 'a': { - if (LocaleCompare("adaptive-blur",option) == 0) + if (LocaleCompare("adaptive-blur",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); @@ -1601,7 +1610,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } - if (LocaleCompare("adaptive-resize",option) == 0) + if (LocaleCompare("adaptive-resize",argv[0]+1) == 0) { /* FUTURE: this is really a "interpolate-resize" operator "adaptive-resize" uses a fixed "Mesh" interpolation @@ -1612,7 +1621,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry.height,interpolate_method,exception); break; } - if (LocaleCompare("adaptive-sharpen",option) == 0) + if (LocaleCompare("adaptive-sharpen",argv[0]+1) == 0) { /* Adaptive sharpen image. @@ -1627,7 +1636,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } - if (LocaleCompare("alpha",option) == 0) + if (LocaleCompare("alpha",argv[0]+1) == 0) { AlphaChannelType alpha_type; @@ -1638,7 +1647,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) SetImageAlphaChannel(*image,alpha_type,exception); break; } - if (LocaleCompare("annotate",option) == 0) + if (LocaleCompare("annotate",argv[0]+1) == 0) { char *text, @@ -1669,7 +1678,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) AnnotateImage(*image,draw_info,exception); break; } - if (LocaleCompare("auto-gamma",option) == 0) + if (LocaleCompare("auto-gamma",argv[0]+1) == 0) { /* Auto Adjust Gamma of image based on its mean @@ -1678,7 +1687,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) AutoGammaImage(*image,exception); break; } - if (LocaleCompare("auto-level",option) == 0) + if (LocaleCompare("auto-level",argv[0]+1) == 0) { /* Perfectly Normalize (max/min stretch) the image @@ -1687,7 +1696,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) AutoLevelImage(*image,exception); break; } - if (LocaleCompare("auto-orient",option) == 0) + if (LocaleCompare("auto-orient",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); switch ((*image)->orientation) @@ -1738,13 +1747,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'b': { - if (LocaleCompare("black-threshold",option) == 0) + if (LocaleCompare("black-threshold",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) BlackThresholdImage(*image,argv[1],exception); break; } - if (LocaleCompare("blue-shift",option) == 0) + if (LocaleCompare("blue-shift",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); geometry_info.rho=1.5; @@ -1753,7 +1762,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=BlueShiftImage(*image,geometry_info.rho,exception); break; } - if (LocaleCompare("blur",option) == 0) + if (LocaleCompare("blur",argv[0]+1) == 0) { /* FUTURE: use of "bias" in a blur is non-sensible */ (void) SyncImageSettings(image_info,*image); @@ -1766,7 +1775,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } - if (LocaleCompare("border",option) == 0) + if (LocaleCompare("border",argv[0]+1) == 0) { ComposeOperator compose; @@ -1789,7 +1798,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=BorderImage(*image,&geometry,compose,exception); break; } - if (LocaleCompare("brightness-contrast",option) == 0) + if (LocaleCompare("brightness-contrast",argv[0]+1) == 0) { double brightness, @@ -1815,7 +1824,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'c': { - if (LocaleCompare("cdl",option) == 0) + if (LocaleCompare("cdl",argv[0]+1) == 0) { char *color_correction_collection; @@ -1831,13 +1840,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("channel",option) == 0) + if (LocaleCompare("channel",argv[0]+1) == 0) { /* The "channel" setting has already been set */ SetPixelChannelMap(*image,image_info->channel); break; } - if (LocaleCompare("charcoal",option) == 0) + if (LocaleCompare("charcoal",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); @@ -1849,20 +1858,20 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } - if (LocaleCompare("chop",option) == 0) + if (LocaleCompare("chop",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) ParseGravityGeometry(*image,argv[1],&geometry,exception); new_image=ChopImage(*image,&geometry,exception); break; } - if (LocaleCompare("clamp",option) == 0) + if (LocaleCompare("clamp",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) ClampImage(*image,exception); break; } - if (LocaleCompare("clip",option) == 0) + if (LocaleCompare("clip",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); if (*argv[0] == '+') @@ -1873,7 +1882,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) ClipImage(*image,exception); break; } - if (LocaleCompare("clip-mask",option) == 0) + if (LocaleCompare("clip-mask",argv[0]+1) == 0) { CacheView *mask_view; @@ -1930,21 +1939,21 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, mask_image=DestroyImage(mask_image); break; } - if (LocaleCompare("clip-path",option) == 0) + if (LocaleCompare("clip-path",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) ClipImagePath(*image,argv[1],*argv[0] == '-' ? MagickTrue : MagickFalse,exception); break; } - if (LocaleCompare("colorize",option) == 0) + if (LocaleCompare("colorize",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); new_image=ColorizeImage(*image,argv[1],draw_info->fill, exception); break; } - if (LocaleCompare("color-matrix",option) == 0) + if (LocaleCompare("color-matrix",argv[0]+1) == 0) { KernelInfo *kernel; @@ -1957,7 +1966,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, kernel=DestroyKernelInfo(kernel); break; } - if (LocaleCompare("colors",option) == 0) + if (LocaleCompare("colors",argv[0]+1) == 0) { /* Reduce the number of colors in the image. */ (void) SyncImageSettings(image_info,*image); @@ -1971,7 +1980,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) CompressImageColormap(*image,exception); break; } - if (LocaleCompare("colorspace",option) == 0) + if (LocaleCompare("colorspace",argv[0]+1) == 0) { /* This is a Image Setting, which should already been set */ /* FUTURE: default colorspace should be sRGB! @@ -1985,14 +1994,14 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("contrast",option) == 0) + if (LocaleCompare("contrast",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) ContrastImage(*image,(*argv[0] == '-') ? MagickTrue : MagickFalse,exception); break; } - if (LocaleCompare("contrast-stretch",option) == 0) + if (LocaleCompare("contrast-stretch",argv[0]+1) == 0) { double black_point, @@ -2020,7 +2029,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("convolve",option) == 0) + if (LocaleCompare("convolve",argv[0]+1) == 0) { KernelInfo *kernel_info; @@ -2034,7 +2043,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, kernel_info=DestroyKernelInfo(kernel_info); break; } - if (LocaleCompare("crop",option) == 0) + if (LocaleCompare("crop",argv[0]+1) == 0) { /* Crop a image to a smaller size @@ -2043,7 +2052,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=CropImageToTiles(*image,argv[1],exception); break; } - if (LocaleCompare("cycle",option) == 0) + if (LocaleCompare("cycle",argv[0]+1) == 0) { /* Cycle an image colormap. @@ -2057,7 +2066,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'd': { - if (LocaleCompare("decipher",option) == 0) + if (LocaleCompare("decipher",argv[0]+1) == 0) { StringInfo *passkey; @@ -2074,7 +2083,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } break; } - if (LocaleCompare("depth",option) == 0) + if (LocaleCompare("depth",argv[0]+1) == 0) { /* the image_info->depth setting has already bee set * We just need to apply it to all images in current sequence */ @@ -2082,7 +2091,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) SetImageDepth(*image,image_info->depth); break; } - if (LocaleCompare("deskew",option) == 0) + if (LocaleCompare("deskew",argv[0]+1) == 0) { double threshold; @@ -2098,7 +2107,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=DeskewImage(*image,threshold,exception); break; } - if (LocaleCompare("despeckle",option) == 0) + if (LocaleCompare("despeckle",argv[0]+1) == 0) { /* Reduce the speckles within an image. @@ -2107,12 +2116,12 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=DespeckleImage(*image,exception); break; } - if (LocaleCompare("display",option) == 0) + if (LocaleCompare("display",argv[0]+1) == 0) { (void) CloneString(&draw_info->server_name,argv[1]); break; } - if (LocaleCompare("distort",option) == 0) + if (LocaleCompare("distort",argv[0]+1) == 0) { char *args, @@ -2187,7 +2196,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, arguments=(double *) RelinquishMagickMemory(arguments); break; } - if (LocaleCompare("draw",option) == 0) + if (LocaleCompare("draw",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) CloneString(&draw_info->primitive,argv[1]); @@ -2198,7 +2207,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'e': { - if (LocaleCompare("edge",option) == 0) + if (LocaleCompare("edge",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); @@ -2208,7 +2217,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,exception); break; } - if (LocaleCompare("emboss",option) == 0) + if (LocaleCompare("emboss",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); @@ -2218,7 +2227,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,exception); break; } - if (LocaleCompare("encipher",option) == 0) + if (LocaleCompare("encipher",argv[0]+1) == 0) { StringInfo *passkey; @@ -2232,19 +2241,19 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } break; } - if (LocaleCompare("enhance",option) == 0) + if (LocaleCompare("enhance",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); new_image=EnhanceImage(*image,exception); break; } - if (LocaleCompare("equalize",option) == 0) + if (LocaleCompare("equalize",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) EqualizeImage(*image,exception); break; } - if (LocaleCompare("evaluate",option) == 0) + if (LocaleCompare("evaluate",argv[0]+1) == 0) { double constant; @@ -2259,7 +2268,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) EvaluateImage(*image,op,constant,exception); break; } - if (LocaleCompare("extent",option) == 0) + if (LocaleCompare("extent",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); flags=ParseGravityGeometry(*image,argv[1],&geometry,exception); @@ -2274,30 +2283,39 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'f': { - if (LocaleCompare("features",option) == 0) + if (LocaleCompare("features",argv[0]+1) == 0) { - /* FUTURE: Assign Artifact to all images -- really a setting */ + /* FUTURE: Assign Artifact all images */ (void) SetImageArtifact(*image,"identify:features", IfSetOption ? argv[1] : (const char *) NULL); break; } - if (LocaleCompare("flip",option) == 0) + if (LocaleCompare("flip",argv[0]+1) == 0) { + /* + Flip image scanlines. + */ (void) SyncImageSettings(image_info,*image); new_image=FlipImage(*image,exception); break; } - if (LocaleCompare("flop",option) == 0) + if (LocaleCompare("flop",argv[0]+1) == 0) { + /* + Flop image scanlines. + */ (void) SyncImageSettings(image_info,*image); new_image=FlopImage(*image,exception); break; } - if (LocaleCompare("floodfill",option) == 0) + if (LocaleCompare("floodfill",argv[0]+1) == 0) { PixelInfo target; + /* + Floodfill image. + */ (void) SyncImageSettings(image_info,*image); (void) ParsePageGeometry(*image,argv[1],&geometry,exception); (void) QueryColorCompliance(argv[2],AllCompliance,&target, @@ -2306,11 +2324,21 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry.y,*argv[0] == '-' ? MagickFalse : MagickTrue,exception); break; } - if (LocaleCompare("frame",option) == 0) + /* FUTURE: should be from ImageOption "format" + if (LocaleCompare("format",argv[0]+1) == 0) + { + format=argv[1]; + break; + } + */ + if (LocaleCompare("frame",argv[0]+1) == 0) { FrameInfo frame_info; + /* + Surround image with an ornamental border. + */ (void) SyncImageSettings(image_info,*image); flags=ParsePageGeometry(*image,argv[1],&geometry,exception); frame_info.width=geometry.width; @@ -2326,7 +2354,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=FrameImage(*image,&frame_info,COMPOSE,exception); break; } - if (LocaleCompare("function",option) == 0) + if (LocaleCompare("function",argv[0]+1) == 0) { char *arguments, @@ -2347,6 +2375,9 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, size_t number_parameters; + /* + Function Modify Image Values + */ (void) SyncImageSettings(image_info,*image); function=(MagickFunction) ParseCommandOption(MagickFunctionOptions, MagickFalse,argv[1]); @@ -2387,7 +2418,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'g': { - if (LocaleCompare("gamma",option) == 0) + if (LocaleCompare("gamma",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); if (*argv[0] == '+') @@ -2397,8 +2428,8 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (char **) NULL),exception); break; } - if ((LocaleCompare("gaussian-blur",option) == 0) || - (LocaleCompare("gaussian",option) == 0)) + if ((LocaleCompare("gaussian-blur",argv[0]+1) == 0) || + (LocaleCompare("gaussian",argv[0]+1) == 0)) { (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); @@ -2410,7 +2441,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } - if (LocaleCompare("geometry",option) == 0) + if (LocaleCompare("geometry",argv[0]+1) == 0) { /* Record Image offset for composition, @@ -2435,16 +2466,16 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'h': { - if (LocaleCompare("highlight-color",option) == 0) + if (LocaleCompare("highlight-color",argv[0]+1) == 0) { - (void) SetImageArtifact(*image,option,argv[1]); + (void) SetImageArtifact(*image,argv[0]+1,argv[1]); break; } break; } case 'i': { - if (LocaleCompare("identify",option) == 0) + if (LocaleCompare("identify",argv[0]+1) == 0) { char *text; @@ -2465,19 +2496,59 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, text=DestroyString(text); break; } - if (LocaleCompare("implode",option) == 0) + if (LocaleCompare("implode",argv[0]+1) == 0) { + /* + Implode image. + */ (void) SyncImageSettings(image_info,*image); (void) ParseGeometry(argv[1],&geometry_info); new_image=ImplodeImage(*image,geometry_info.rho, interpolate_method,exception); break; } + if (LocaleCompare("interline-spacing",argv[0]+1) == 0) + { + if (*argv[0] == '+') + (void) ParseGeometry("0",&geometry_info); + else + (void) ParseGeometry(argv[1],&geometry_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] == '+') + (void) ParseGeometry("0",&geometry_info); + else + (void) ParseGeometry(argv[1],&geometry_info); + draw_info->interword_spacing=geometry_info.rho; + break; + } + break; + } + case 'k': + { + if (LocaleCompare("kerning",argv[0]+1) == 0) + { + if (*argv[0] == '+') + (void) ParseGeometry("0",&geometry_info); + else + (void) ParseGeometry(argv[1],&geometry_info); + draw_info->kerning=geometry_info.rho; + break; + } break; } case 'l': { - if (LocaleCompare("lat",option) == 0) + if (LocaleCompare("lat",argv[0]+1) == 0) { /* Local adaptive threshold image. @@ -2491,7 +2562,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.xi,exception); break; } - if (LocaleCompare("level",option) == 0) + if (LocaleCompare("level",argv[0]+1) == 0) { MagickRealType black_point, @@ -2501,6 +2572,9 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, MagickStatusType flags; + /* + Parse levels. + */ (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); black_point=geometry_info.rho; @@ -2525,7 +2599,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("level-colors",option) == 0) + if (LocaleCompare("level-colors",argv[0]+1) == 0) { char token[MaxTextExtent]; @@ -2564,7 +2638,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, *argv[0] == '+' ? MagickTrue : MagickFalse,exception); break; } - if (LocaleCompare("linear-stretch",option) == 0) + if (LocaleCompare("linear-stretch",argv[0]+1) == 0) { double black_point, @@ -2590,7 +2664,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) LinearStretchImage(*image,black_point,white_point,exception); break; } - if (LocaleCompare("liquid-rescale",option) == 0) + if (LocaleCompare("linewidth",argv[0]+1) == 0) + { + draw_info->stroke_width=InterpretLocaleValue(argv[1], + (char **) NULL); + break; + } + if (LocaleCompare("liquid-rescale",argv[0]+1) == 0) { /* Liquid rescale image. @@ -2605,20 +2685,23 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry.height,1.0*geometry.x,1.0*geometry.y,exception); break; } - if (LocaleCompare("lowlight-color",option) == 0) + if (LocaleCompare("lowlight-color",argv[0]+1) == 0) { - (void) SetImageArtifact(*image,option,argv[1]); + (void) SetImageArtifact(*image,argv[0]+1,argv[1]); break; } break; } case 'm': { - if (LocaleCompare("map",option) == 0) + if (LocaleCompare("map",argv[0]+1) == 0) { Image *remap_image; + /* + Transform image colors to match this set of colors. + */ (void) SyncImageSettings(image_info,*image); if (*argv[0] == '+') break; @@ -2629,7 +2712,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, remap_image=DestroyImage(remap_image); break; } - if (LocaleCompare("mask",option) == 0) + if (LocaleCompare("mask",argv[0]+1) == 0) { Image *mask; @@ -2637,9 +2720,15 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) SyncImageSettings(image_info,*image); if (*argv[0] == '+') { + /* + Remove a mask. + */ (void) SetImageMask(*image,(Image *) NULL,exception); break; } + /* + Set the image mask. + */ mask=GetImageCache(image_info,argv[1],exception); if (mask == (Image *) NULL) break; @@ -2647,15 +2736,17 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, mask=DestroyImage(mask); break; } - if (LocaleCompare("matte",option) == 0) + if (LocaleCompare("matte",argv[0]+1) == 0) { - /* FUTURE: Obsoleted by -alpha not used by anything */ - (void) SetImageAlphaChannel(*image,IfSetOption ? - SetAlphaChannel : DeactivateAlphaChannel,exception); + (void) SetImageAlphaChannel(*image,(*argv[0] == '-') ? + SetAlphaChannel : DeactivateAlphaChannel,exception); break; } - if (LocaleCompare("median",option) == 0) + if (LocaleCompare("median",argv[0]+1) == 0) { + /* + Median filter image. + */ (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); if ((flags & SigmaValue) == 0) @@ -2664,10 +2755,10 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.rho,(size_t) geometry_info.sigma,exception); break; } - if (LocaleCompare("mode",option) == 0) + if (LocaleCompare("mode",argv[0]+1) == 0) { /* - Statistical Mode image + Mode image. */ (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); @@ -2677,13 +2768,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.rho,(size_t) geometry_info.sigma,exception); break; } - if (LocaleCompare("modulate",option) == 0) + if (LocaleCompare("modulate",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) ModulateImage(*image,argv[1],exception); break; } - if (LocaleCompare("monitor",option) == 0) + if (LocaleCompare("monitor",argv[0]+1) == 0) { if (*argv[0] == '+') { @@ -2695,14 +2786,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void *) NULL); break; } - if (LocaleCompare("monochrome",option) == 0) + if (LocaleCompare("monochrome",argv[0]+1) == 0) { - /* A setting (for input coders) and a 'type' operation */ (void) SyncImageSettings(image_info,*image); (void) SetImageType(*image,BilevelType,exception); break; } - if (LocaleCompare("morphology",option) == 0) + if (LocaleCompare("morphology",argv[0]+1) == 0) { char token[MaxTextExtent]; @@ -2746,8 +2836,11 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, kernel=DestroyKernelInfo(kernel); break; } - if (LocaleCompare("motion-blur",option) == 0) + if (LocaleCompare("motion-blur",argv[0]+1) == 0) { + /* + Motion blur image. + */ (void) SyncImageSettings(image_info,*image); flags=ParseGeometry(argv[1],&geometry_info); if ((flags & SigmaValue) == 0) @@ -2761,14 +2854,14 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'n': { - if (LocaleCompare("negate",option) == 0) + if (LocaleCompare("negate",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) NegateImage(*image,*argv[0] == '+' ? MagickTrue : MagickFalse,exception); break; } - if (LocaleCompare("noise",option) == 0) + if (LocaleCompare("noise",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); if (*argv[0] == '-') @@ -2790,7 +2883,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } break; } - if (LocaleCompare("normalize",option) == 0) + if (LocaleCompare("normalize",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) NormalizeImage(*image,exception); @@ -2800,7 +2893,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'o': { - if (LocaleCompare("opaque",option) == 0) + if (LocaleCompare("opaque",argv[0]+1) == 0) { PixelInfo target; @@ -2812,7 +2905,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, MagickFalse : MagickTrue,exception); break; } - if (LocaleCompare("ordered-dither",option) == 0) + if (LocaleCompare("ordered-dither",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) OrderedPosterizeImage(*image,argv[1],exception); @@ -2822,7 +2915,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'p': { - if (LocaleCompare("paint",option) == 0) + if (LocaleCompare("paint",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); (void) ParseGeometry(argv[1],&geometry_info); @@ -2830,7 +2923,28 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,exception); break; } - if (LocaleCompare("polaroid",option) == 0) + if (LocaleCompare("pen",argv[0]+1) == 0) + { + if (*argv[0] == '+') + { + (void) QueryColorCompliance("none",AllCompliance,&draw_info->fill, + exception); + break; + } + (void) QueryColorCompliance(argv[1],AllCompliance,&draw_info->fill, + exception); + break; + } + if (LocaleCompare("pointsize",argv[0]+1) == 0) + { + if (*argv[0] == '+') + (void) ParseGeometry("12",&geometry_info); + else + (void) ParseGeometry(argv[1],&geometry_info); + draw_info->pointsize=geometry_info.rho; + break; + } + if (LocaleCompare("polaroid",argv[0]+1) == 0) { double angle; @@ -2838,6 +2952,9 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, RandomInfo *random_info; + /* + Simulate a Polaroid picture. + */ (void) SyncImageSettings(image_info,*image); random_info=AcquireRandomInfo(); angle=22.5*(GetPseudoRandomValue(random_info)-0.5); @@ -2852,26 +2969,34 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, interpolate_method,exception); break; } - if (LocaleCompare("posterize",option) == 0) + if (LocaleCompare("posterize",argv[0]+1) == 0) { + /* + Posterize image. + */ (void) SyncImageSettings(image_info,*image); (void) PosterizeImage(*image,StringToUnsignedLong(argv[1]), quantize_info->dither,exception); break; } - if (LocaleCompare("preview",option) == 0) + if (LocaleCompare("preview",argv[0]+1) == 0) { PreviewType - preview_type=UndefinedPreview; + preview_type; + /* + Preview image. + */ (void) SyncImageSettings(image_info,*image); - if (IfSetOption) + if (*argv[0] == '+') + preview_type=UndefinedPreview; + else preview_type=(PreviewType) ParseCommandOption( MagickPreviewOptions,MagickFalse,argv[1]); new_image=PreviewImage(*image,preview_type,exception); break; } - if (LocaleCompare("profile",option) == 0) + if (LocaleCompare("profile",argv[0]+1) == 0) { const char *name; @@ -2886,12 +3011,18 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, *profile_info; (void) SyncImageSettings(image_info,*image); - if (!IfSetOption) + if (*argv[0] == '+') { + /* + Remove a profile from the image. + */ (void) ProfileImage(*image,argv[1],(const unsigned char *) NULL,0,exception); break; } + /* + Associate a profile with the image. + */ profile_info=CloneImageInfo(image_info); profile=GetImageProfile(*image,"iptc"); if (profile != (StringInfo *) NULL) @@ -2932,9 +3063,24 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } break; } + case 'q': + { + if (LocaleCompare("quantize",argv[0]+1) == 0) + { + if (*argv[0] == '+') + { + quantize_info->colorspace=UndefinedColorspace; + break; + } + quantize_info->colorspace=(ColorspaceType) ParseCommandOption( + MagickColorspaceOptions,MagickFalse,argv[1]); + break; + } + break; + } case 'r': { - if (LocaleCompare("radial-blur",option) == 0) + if (LocaleCompare("radial-blur",argv[0]+1) == 0) { /* Radial blur image. @@ -2945,7 +3091,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,exception); break; } - if (LocaleCompare("raise",option) == 0) + if (LocaleCompare("raise",argv[0]+1) == 0) { /* Surround image with a raise of solid color. @@ -2957,7 +3103,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, MagickFalse,exception); break; } - if (LocaleCompare("random-threshold",option) == 0) + if (LocaleCompare("random-threshold",argv[0]+1) == 0) { /* Threshold image. @@ -2966,7 +3112,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) RandomThresholdImage(*image,argv[1],exception); break; } - if (LocaleCompare("recolor",option) == 0) + if (LocaleCompare("recolor",argv[0]+1) == 0) { KernelInfo *kernel; @@ -2979,13 +3125,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, kernel=DestroyKernelInfo(kernel); break; } - if (LocaleCompare("render",option) == 0) + if (LocaleCompare("render",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); draw_info->render=(*argv[0] == '+') ? MagickTrue : MagickFalse; break; } - if (LocaleCompare("remap",option) == 0) + if (LocaleCompare("remap",argv[0]+1) == 0) { Image *remap_image; @@ -3003,7 +3149,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, remap_image=DestroyImage(remap_image); break; } - if (LocaleCompare("repage",option) == 0) + if (LocaleCompare("repage",argv[0]+1) == 0) { if (*argv[0] == '+') { @@ -3013,7 +3159,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) ResetImagePage(*image,argv[1]); break; } - if (LocaleCompare("resample",option) == 0) + if (LocaleCompare("resample",argv[0]+1) == 0) { /* Resample image. @@ -3026,7 +3172,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,(*image)->filter,(*image)->blur,exception); break; } - if (LocaleCompare("resize",option) == 0) + if (LocaleCompare("resize",argv[0]+1) == 0) { /* Resize image. @@ -3037,7 +3183,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (*image)->filter,(*image)->blur,exception); break; } - if (LocaleCompare("roll",option) == 0) + if (LocaleCompare("roll",argv[0]+1) == 0) { /* Roll image. @@ -3047,7 +3193,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=RollImage(*image,geometry.x,geometry.y,exception); break; } - if (LocaleCompare("rotate",option) == 0) + if (LocaleCompare("rotate",argv[0]+1) == 0) { char *geometry; @@ -3077,7 +3223,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 's': { - if (LocaleCompare("sample",option) == 0) + if (LocaleCompare("sample",argv[0]+1) == 0) { /* Sample image with pixel replication. @@ -3088,7 +3234,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("scale",option) == 0) + if (LocaleCompare("scale",argv[0]+1) == 0) { /* Resize image. @@ -3099,7 +3245,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("selective-blur",option) == 0) + if (LocaleCompare("selective-blur",argv[0]+1) == 0) { /* Selectively blur pixels within a contrast threshold. @@ -3112,7 +3258,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception); break; } - if (LocaleCompare("separate",option) == 0) + if (LocaleCompare("separate",argv[0]+1) == 0) { /* Break channels into separate images. @@ -3122,7 +3268,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=SeparateImages(*image,exception); break; } - if (LocaleCompare("sepia-tone",option) == 0) + if (LocaleCompare("sepia-tone",argv[0]+1) == 0) { double threshold; @@ -3135,7 +3281,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=SepiaToneImage(*image,threshold,exception); break; } - if (LocaleCompare("segment",option) == 0) + if (LocaleCompare("segment",argv[0]+1) == 0) { /* Segment image. @@ -3149,7 +3295,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("set",option) == 0) + if (LocaleCompare("set",argv[0]+1) == 0) { char *value; @@ -3186,7 +3332,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, value=DestroyString(value); break; } - if (LocaleCompare("shade",option) == 0) + if (LocaleCompare("shade",argv[0]+1) == 0) { /* Shade image. @@ -3199,7 +3345,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, MagickFalse,geometry_info.rho,geometry_info.sigma,exception); break; } - if (LocaleCompare("shadow",option) == 0) + if (LocaleCompare("shadow",argv[0]+1) == 0) { /* Shadow image. @@ -3217,7 +3363,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, ceil(geometry_info.psi-0.5),exception); break; } - if (LocaleCompare("sharpen",option) == 0) + if (LocaleCompare("sharpen",argv[0]+1) == 0) { /* Sharpen image. @@ -3232,7 +3378,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,exception); break; } - if (LocaleCompare("shave",option) == 0) + if (LocaleCompare("shave",argv[0]+1) == 0) { /* Shave the image edges. @@ -3242,7 +3388,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=ShaveImage(*image,&geometry,exception); break; } - if (LocaleCompare("shear",option) == 0) + if (LocaleCompare("shear",argv[0]+1) == 0) { /* Shear image. @@ -3255,7 +3401,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,exception); break; } - if (LocaleCompare("sigmoidal-contrast",option) == 0) + if (LocaleCompare("sigmoidal-contrast",argv[0]+1) == 0) { /* Sigmoidal non-linearity contrast control. @@ -3272,7 +3418,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("sketch",option) == 0) + if (LocaleCompare("sketch",argv[0]+1) == 0) { /* Sketch image. @@ -3285,7 +3431,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception); break; } - if (LocaleCompare("solarize",option) == 0) + if (LocaleCompare("solarize",argv[0]+1) == 0) { double threshold; @@ -3295,7 +3441,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) SolarizeImage(*image,threshold,exception); break; } - if (LocaleCompare("sparse-color",option) == 0) + if (LocaleCompare("sparse-color",argv[0]+1) == 0) { SparseColorMethod method; @@ -3318,7 +3464,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, arguments=DestroyString(arguments); break; } - if (LocaleCompare("splice",option) == 0) + if (LocaleCompare("splice",argv[0]+1) == 0) { /* Splice a solid color into the image. @@ -3328,7 +3474,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=SpliceImage(*image,&geometry,exception); break; } - if (LocaleCompare("spread",option) == 0) + if (LocaleCompare("spread",argv[0]+1) == 0) { /* Spread an image. @@ -3339,7 +3485,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, interpolate_method,exception); break; } - if (LocaleCompare("statistic",option) == 0) + if (LocaleCompare("statistic",argv[0]+1) == 0) { StatisticType type; @@ -3352,7 +3498,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (size_t) geometry_info.sigma,exception); break; } - if (LocaleCompare("stretch",option) == 0) + if (LocaleCompare("stretch",argv[0]+1) == 0) { if (*argv[0] == '+') { @@ -3363,7 +3509,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, MagickStretchOptions,MagickFalse,argv[1]); break; } - if (LocaleCompare("strip",option) == 0) + if (LocaleCompare("strip",argv[0]+1) == 0) { /* Strip image of profiles and comments. @@ -3372,7 +3518,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) StripImage(*image,exception); break; } - if (LocaleCompare("stroke",option) == 0) + if (LocaleCompare("stroke",argv[0]+1) == 0) { ExceptionInfo *sans; @@ -3394,13 +3540,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("strokewidth",option) == 0) + if (LocaleCompare("strokewidth",argv[0]+1) == 0) { draw_info->stroke_width=InterpretLocaleValue(argv[1], (char **) NULL); break; } - if (LocaleCompare("style",option) == 0) + if (LocaleCompare("style",argv[0]+1) == 0) { if (*argv[0] == '+') { @@ -3411,7 +3557,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, MagickFalse,argv[1]); break; } - if (LocaleCompare("swirl",option) == 0) + if (LocaleCompare("swirl",argv[0]+1) == 0) { /* Swirl image. @@ -3426,7 +3572,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 't': { - if (LocaleCompare("threshold",option) == 0) + if (LocaleCompare("threshold",argv[0]+1) == 0) { double threshold; @@ -3442,7 +3588,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) BilevelImage(*image,threshold,exception); break; } - if (LocaleCompare("thumbnail",option) == 0) + if (LocaleCompare("thumbnail",argv[0]+1) == 0) { /* Thumbnail image. @@ -3453,7 +3599,19 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("tint",option) == 0) + if (LocaleCompare("tile",argv[0]+1) == 0) + { + if (*argv[0] == '+') + { + if (draw_info->fill_pattern != (Image *) NULL) + draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); + break; + } + draw_info->fill_pattern=GetImageCache(image_info,argv[1], + exception); + break; + } + if (LocaleCompare("tint",argv[0]+1) == 0) { /* Tint the image. @@ -3462,7 +3620,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=TintImage(*image,argv[1],&fill,exception); break; } - if (LocaleCompare("transform",option) == 0) + if (LocaleCompare("transform",argv[0]+1) == 0) { /* Affine transform image. @@ -3472,7 +3630,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("transparent",option) == 0) + if (LocaleCompare("transparent",argv[0]+1) == 0) { PixelInfo target; @@ -3485,7 +3643,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, exception); break; } - if (LocaleCompare("transpose",option) == 0) + if (LocaleCompare("transpose",argv[0]+1) == 0) { /* Transpose image scanlines. @@ -3494,7 +3652,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=TransposeImage(*image,exception); break; } - if (LocaleCompare("transverse",option) == 0) + if (LocaleCompare("transverse",argv[0]+1) == 0) { /* Transverse image scanlines. @@ -3503,12 +3661,12 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=TransverseImage(*image,exception); break; } - if (LocaleCompare("treedepth",option) == 0) + if (LocaleCompare("treedepth",argv[0]+1) == 0) { quantize_info->tree_depth=StringToUnsignedLong(argv[1]); break; } - if (LocaleCompare("trim",option) == 0) + if (LocaleCompare("trim",argv[0]+1) == 0) { /* Trim image. @@ -3517,7 +3675,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=TrimImage(*image,exception); break; } - if (LocaleCompare("type",option) == 0) + if (LocaleCompare("type",argv[0]+1) == 0) { ImageType type; @@ -3536,13 +3694,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'u': { - if (LocaleCompare("undercolor",option) == 0) + if (LocaleCompare("undercolor",argv[0]+1) == 0) { (void) QueryColorCompliance(argv[1],AllCompliance,&draw_info->undercolor, exception); break; } - if (LocaleCompare("unique",option) == 0) + if (LocaleCompare("unique",argv[0]+1) == 0) { if (*argv[0] == '+') { @@ -3553,7 +3711,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, (void) SetImageArtifact(*image,"verbose","true"); break; } - if (LocaleCompare("unique-colors",option) == 0) + if (LocaleCompare("unique-colors",argv[0]+1) == 0) { /* Unique image colors. @@ -3562,7 +3720,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, new_image=UniqueImageColors(*image,exception); break; } - if (LocaleCompare("unsharp",option) == 0) + if (LocaleCompare("unsharp",argv[0]+1) == 0) { /* Unsharp mask image. @@ -3583,13 +3741,13 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'v': { - if (LocaleCompare("verbose",option) == 0) + if (LocaleCompare("verbose",argv[0]+1) == 0) { - (void) SetImageArtifact(*image,option, + (void) SetImageArtifact(*image,argv[0]+1, *argv[0] == '+' ? "false" : "true"); break; } - if (LocaleCompare("vignette",option) == 0) + if (LocaleCompare("vignette",argv[0]+1) == 0) { /* Vignette image. @@ -3607,7 +3765,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, ceil(geometry_info.psi-0.5),exception); break; } - if (LocaleCompare("virtual-pixel",option) == 0) + if (LocaleCompare("virtual-pixel",argv[0]+1) == 0) { if (*argv[0] == '+') { @@ -3624,7 +3782,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, } case 'w': { - if (LocaleCompare("wave",option) == 0) + if (LocaleCompare("wave",argv[0]+1) == 0) { /* Wave image. @@ -3637,7 +3795,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, geometry_info.sigma,interpolate_method,exception); break; } - if (LocaleCompare("weight",option) == 0) + if (LocaleCompare("weight",argv[0]+1) == 0) { draw_info->weight=StringToUnsignedLong(argv[1]); if (LocaleCompare(argv[1],"all") == 0) @@ -3654,8 +3812,11 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, draw_info->weight=400; break; } - if (LocaleCompare("white-threshold",option) == 0) + if (LocaleCompare("white-threshold",argv[0]+1) == 0) { + /* + White threshold image. + */ (void) SyncImageSettings(image_info,*image); (void) WhiteThresholdImage(*image,argv[1],exception); break; diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index bbc68cc19..f1c95c95e 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -5279,7 +5279,7 @@ Get(ref,...) { s=newSViv(MAGICKCORE_QUANTUM_DEPTH); if (image != (Image *) NULL) - s=newSVnv(GetImageTotalInkDensity(image)); + s=newSVnv(GetImageTotalInkDensity(image,exception)); PUSHs(s ? sv_2mortal(s) : &sv_undef); continue; } diff --git a/coders/ttf.c b/coders/ttf.c index c655ea31c..170d754d4 100644 --- a/coders/ttf.c +++ b/coders/ttf.c @@ -176,20 +176,7 @@ static Image *ReadTTFImage(const ImageInfo *image_info,ExceptionInfo *exception) *Text = (char *) "abcdefghijklmnopqrstuvwxyz\n" "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" - "0123456789.:,;(*!?}^)#${%^&-+@\n", - *Phrase = (char *) "The five boxing wizards jump quickly!"; - /* NOTE: These are Pangrams, which contain every letter in English - See http://www.artlebedev.ru/kovodstvo/sections/33/ - - "A quick brown fox jumps over the lazy dog."; - "The quick onyx goblin jumps over the lazy dwarf!"; - "Pack my box with five dozen liquor jugs."; - "Five or six big jet planes zoomed quickly by the tower."; - "Grumpy wizards make toxic brew for the evil Queen and Jack."; - - IMv6 used this well known phrase, but it is not a pangram! - "That which does not destroy me, only makes me stronger."; - */ + "0123456789.:,;(*!?}^)#${%^&-+@\n"; const TypeInfo *type_info; @@ -276,31 +263,22 @@ static Image *ReadTTFImage(const ImageInfo *image_info,ExceptionInfo *exception) text=DestroyString(text); (void) FormatLocaleString(buffer,MaxTextExtent,"'\n"); ConcatenateString(&draw_info->primitive,buffer); - y+=12*(ssize_t) MultilineCensus((char *) Text); - /* FUTURE: A setting to specify the text to use */ - for (i=4; i <= 72; ) + y+=20*(ssize_t) MultilineCensus((char *) Text)+20; + for (i=12; i <= 72; i+=6) { - y += (i+2>12) ? i+2 : 12; /* line spacing */ - ConcatenateString(&draw_info->primitive," font-size 12\n"); - (void) FormatLocaleString(buffer,MaxTextExtent," text 10,%g '%-2g'\n", + y+=i+12; + ConcatenateString(&draw_info->primitive," font-size 18\n"); + (void) FormatLocaleString(buffer,MaxTextExtent," text 10,%.20g '%.20g'\n", (double) y,(double) i); ConcatenateString(&draw_info->primitive,buffer); - (void) FormatLocaleString(buffer,MaxTextExtent," font-size %g\n", + (void) FormatLocaleString(buffer,MaxTextExtent," font-size %.20g\n", (double) i); ConcatenateString(&draw_info->primitive,buffer); - (void) FormatLocaleString(buffer,MaxTextExtent," text 50,%g '%s'\n", - (double) y, Phrase); + (void) FormatLocaleString(buffer,MaxTextExtent," text 50,%.20g " + "'That which does not destroy me, only makes me stronger.'\n",(double) y); ConcatenateString(&draw_info->primitive,buffer); - if (i < 14) - i+=1; - else if (i < 20) - i+=2; - else if (i < 24) - i+=4; - else if ( i < 48 ) - i+=12; - else - i+=24; + if (i >= 24) + i+=6; } ConcatenateString(&draw_info->primitive,"pop graphic-context"); (void) DrawImage(image,draw_info,exception);