% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% CloneDrawInfo() makes a copy of the given draw info structure. If NULL
-% is specified, a new image info structure is created initialized to
-% default values.
+% CloneDrawInfo() makes a copy of the given draw_info structure. If NULL
+% is specified, a new draw_info structure is created initialized to
+% default values, according to the given image_info.
%
% The format of the CloneDrawInfo method is:
%
/*
Affine transform image.
*/
- if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+ exception=(&image->exception);
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
status=MagickTrue;
edge.x1=MagickMax(min.x,0.0);
edge.y2=MagickMin(max.y,(double) image->rows-1.0);
inverse_affine=InverseAffineMatrix(affine);
GetPixelInfo(image,&zero);
- exception=(&image->exception);
image_view=AcquireCacheView(image);
source_view=AcquireCacheView(source);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
coordinates;
clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
- (void) QueryColorDatabase("#0000",&clone_info->fill,&image->exception);
+ (void) QueryColorCompliance("#0000",AllCompliance,&clone_info->fill,
+ &image->exception);
resolution.x=DefaultResolution;
resolution.y=DefaultResolution;
if (clone_info->density != (char *) NULL)
for (i=0; i < (ssize_t) polygon_info->number_edges; i++)
{
if (polygon_info->edges[i].direction != 0)
- (void) QueryColorDatabase("red",&clone_info->stroke,
+ (void) QueryColorCompliance("red",AllCompliance,&clone_info->stroke,
&image->exception);
else
- (void) QueryColorDatabase("green",&clone_info->stroke,
+ (void) QueryColorCompliance("green",AllCompliance,&clone_info->stroke,
&image->exception);
start.x=(double) (polygon_info->edges[i].bounds.x1-mid);
start.y=(double) (polygon_info->edges[i].bounds.y1-mid);
(void) DrawPrimitive(image,clone_info,primitive_info);
}
}
- (void) QueryColorDatabase("blue",&clone_info->stroke,&image->exception);
+ (void) QueryColorCompliance("blue",AllCompliance,&clone_info->stroke,
+ &image->exception);
start.x=(double) (bounds.x1-mid);
start.y=(double) (bounds.y1-mid);
end.x=(double) (bounds.x2+mid);
% The format of the DrawClipPath method is:
%
% MagickBooleanType DrawClipPath(Image *image,const DrawInfo *draw_info,
-% const char *name)
+% const char *name,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o name: the name of the clip path.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport MagickBooleanType DrawClipPath(Image *image,
- const DrawInfo *draw_info,const char *name)
+ const DrawInfo *draw_info,const char *name,ExceptionInfo *exception)
{
char
clip_mask[MaxTextExtent];
&image->exception);
if (clip_mask == (Image *) NULL)
return(MagickFalse);
- (void) SetImageClipMask(image,clip_mask);
+ (void) SetImageClipMask(image,clip_mask,exception);
clip_mask=DestroyImage(clip_mask);
}
- (void) QueryColorDatabase("#00000000",&image->clip_mask->background_color,
- &image->exception);
+ (void) QueryColorCompliance("#00000000",AllCompliance,
+ &image->clip_mask->background_color,&image->exception);
image->clip_mask->background_color.alpha=(Quantum) TransparentAlpha;
(void) SetImageBackgroundColor(image->clip_mask);
if (image->debug != MagickFalse)
draw_info->clip_mask);
clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
(void) CloneString(&clone_info->primitive,value);
- (void) QueryColorDatabase("#ffffff",&clone_info->fill,&image->exception);
+ (void) QueryColorCompliance("#ffffff",AllCompliance,&clone_info->fill,
+ &image->exception);
clone_info->clip_mask=(char *) NULL;
- status=DrawImage(image->clip_mask,clone_info);
- status|=NegateImage(image->clip_mask,MagickFalse);
+ status=DrawImage(image->clip_mask,clone_info,exception);
+ status|=NegateImage(image->clip_mask,MagickFalse,&image->exception);
clone_info=DestroyDrawInfo(clone_info);
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
%
% The format of the DrawImage method is:
%
-% MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
+% MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o draw_info: the draw info.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static inline MagickBooleanType IsPoint(const char *point)
primitive_info->point=point;
}
-MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info)
+MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
+ ExceptionInfo *exception)
{
#define RenderImageTag "Render/Image"
graphic_context[n]->viewbox.height=image->rows;
}
token=AcquireString(primitive);
- (void) QueryColorDatabase("#000000",&start_color,&image->exception);
- if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+ (void) QueryColorCompliance("#000000",AllCompliance,&start_color,
+ &image->exception);
+ if (SetImageStorageClass(image,DirectClass,&image->exception) == MagickFalse)
return(MagickFalse);
status=MagickTrue;
for (q=primitive; *q != '\0'; )
if (LocaleCompare("border-color",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) QueryColorDatabase(token,&graphic_context[n]->border_color,
- &image->exception);
+ (void) QueryColorCompliance(token,AllCompliance,
+ &graphic_context[n]->border_color,&image->exception);
break;
}
status=MagickFalse;
GetMagickToken(q,&q,token);
(void) CloneString(&graphic_context[n]->clip_mask,token);
(void) DrawClipPath(image,graphic_context[n],
- graphic_context[n]->clip_mask);
+ graphic_context[n]->clip_mask,exception);
break;
}
if (LocaleCompare("clip-rule",keyword) == 0)
(void) FormatLocaleString(pattern,MaxTextExtent,"%s",token);
if (GetImageArtifact(image,pattern) != (const char *) NULL)
(void) DrawPatternPath(image,draw_info,token,
- &graphic_context[n]->fill_pattern);
+ &graphic_context[n]->fill_pattern,exception);
else
{
- status=QueryColorDatabase(token,&graphic_context[n]->fill,
- &image->exception);
+ status=QueryColorCompliance(token,AllCompliance,
+ &graphic_context[n]->fill,&image->exception);
if (status == MagickFalse)
{
ImageInfo
GetMagickToken(q,&q,token);
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
graphic_context[n]->fill.alpha=ClampToQuantum((MagickRealType)
- QuantumRange*(1.0-factor*InterpretLocaleValue(token,
- (char **) NULL)));
+ QuantumRange*factor*InterpretLocaleValue(token,
+ (char **) NULL));
break;
}
if (LocaleCompare("fill-rule",keyword) == 0)
if (graphic_context[n]->clip_mask != (char *) NULL)
if (LocaleCompare(graphic_context[n]->clip_mask,
graphic_context[n-1]->clip_mask) != 0)
- (void) SetImageClipMask(image,(Image *) NULL);
+ (void) SetImageClipMask(image,(Image *) NULL,exception);
graphic_context[n]=DestroyDrawInfo(graphic_context[n]);
n--;
break;
stop_color;
GetMagickToken(q,&q,token);
- (void) QueryColorDatabase(token,&stop_color,&image->exception);
+ (void) QueryColorCompliance(token,AllCompliance,&stop_color,
+ &image->exception);
(void) GradientImage(image,LinearGradient,ReflectSpread,
- &start_color,&stop_color);
+ &start_color,&stop_color,&image->exception);
start_color=stop_color;
GetMagickToken(q,&q,token);
break;
(void) FormatLocaleString(pattern,MaxTextExtent,"%s",token);
if (GetImageArtifact(image,pattern) != (const char *) NULL)
(void) DrawPatternPath(image,draw_info,token,
- &graphic_context[n]->stroke_pattern);
+ &graphic_context[n]->stroke_pattern,exception);
else
{
- status=QueryColorDatabase(token,&graphic_context[n]->stroke,
- &image->exception);
+ status=QueryColorCompliance(token,AllCompliance,
+ &graphic_context[n]->stroke,&image->exception);
if (status == MagickFalse)
{
ImageInfo
GetMagickToken(q,&q,token);
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
graphic_context[n]->stroke.alpha=ClampToQuantum((MagickRealType)
- QuantumRange*(1.0-factor*InterpretLocaleValue(token,
- (char **) NULL)));
+ QuantumRange*factor*InterpretLocaleValue(token,
+ (char **) NULL));
break;
}
if (LocaleCompare("stroke-width",keyword) == 0)
if (LocaleCompare("text-undercolor",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) QueryColorDatabase(token,&graphic_context[n]->undercolor,
- &image->exception);
+ (void) QueryColorCompliance(token,AllCompliance,
+ &graphic_context[n]->undercolor,&image->exception);
break;
}
if (LocaleCompare("translate",keyword) == 0)
(LocaleCompare(graphic_context[n]->clip_mask,
graphic_context[n-1]->clip_mask) != 0))
(void) DrawClipPath(image,graphic_context[n],
- graphic_context[n]->clip_mask);
+ graphic_context[n]->clip_mask,exception);
(void) DrawPrimitive(image,graphic_context[n],primitive_info);
}
if (primitive_info->text != (char *) NULL)
% The format of the DrawPatternPath method is:
%
% MagickBooleanType DrawPatternPath(Image *image,const DrawInfo *draw_info,
-% const char *name,Image **pattern)
+% const char *name,Image **pattern,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport MagickBooleanType DrawPatternPath(Image *image,
- const DrawInfo *draw_info,const char *name,Image **pattern)
+ const DrawInfo *draw_info,const char *name,Image **pattern,
+ ExceptionInfo *exception)
{
char
property[MaxTextExtent];
*pattern=DestroyImage(*pattern);
image_info=AcquireImageInfo();
image_info->size=AcquireString(geometry);
- *pattern=AcquireImage(image_info);
+ *pattern=AcquireImage(image_info,&image->exception);
image_info=DestroyImageInfo(image_info);
- (void) QueryColorDatabase("#00000000",&(*pattern)->background_color,
- &image->exception);
+ (void) QueryColorCompliance("#00000000",AllCompliance,
+ &(*pattern)->background_color,&image->exception);
(void) SetImageBackgroundColor(*pattern);
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
clone_info->fill_pattern=NewImageList();
clone_info->stroke_pattern=NewImageList();
(void) CloneString(&clone_info->primitive,path);
- status=DrawImage(*pattern,clone_info);
+ status=DrawImage(*pattern,clone_info,exception);
clone_info=DestroyDrawInfo(clone_info);
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),"end pattern-path");
if ((x == (ssize_t) ceil(primitive_info->point.x-0.5)) &&
(y == (ssize_t) ceil(primitive_info->point.y-0.5)))
{
- (void) GetStrokeColor(draw_info,x,y,&pixel);
+ (void) GetStrokeColor(draw_info,x,y,&pixel,exception);
SetPixelPacket(image,&pixel,q);
}
q+=GetPixelChannels(image);
Draw polygon or line.
*/
if (image->matte == MagickFalse)
- (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
+ (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(status)
#endif
fill_opacity=fill_opacity > 0.25 ? 1.0 : 0.0;
stroke_opacity=stroke_opacity > 0.25 ? 1.0 : 0.0;
}
- (void) GetFillColor(draw_info,x,y,&fill_color);
+ (void) GetFillColor(draw_info,x,y,&fill_color,exception);
fill_opacity=fill_opacity*fill_color.alpha;
CompositePixelOver(image,&fill_color,fill_opacity,q,(MagickRealType)
GetPixelAlpha(image,q),q);
- (void) GetStrokeColor(draw_info,x,y,&stroke_color);
+ (void) GetStrokeColor(draw_info,x,y,&stroke_color,exception);
stroke_opacity=stroke_opacity*stroke_color.alpha;
CompositePixelOver(image,&stroke_color,stroke_opacity,q,(MagickRealType)
GetPixelAlpha(image,q),q);
q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
if (q == (Quantum *) NULL)
break;
- (void) GetFillColor(draw_info,x,y,&fill_color);
+ (void) GetFillColor(draw_info,x,y,&fill_color,exception);
CompositePixelOver(image,&fill_color,(MagickRealType) fill_color.alpha,q,
(MagickRealType) GetPixelAlpha(image,q),q);
(void) SyncCacheViewAuthenticPixels(image_view,exception);
q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
if (q == (Quantum *) NULL)
break;
- (void) GetFillColor(draw_info,x,y,&pixel);
+ (void) GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelPacket(image,&pixel,q);
(void) SyncCacheViewAuthenticPixels(image_view,exception);
break;
pixel,
target;
- (void) GetOneCacheViewVirtualPixel(image_view,x,y,&target,exception);
+ Quantum
+ virtual_pixel[MaxPixelChannels];
+
+ (void) GetOneCacheViewVirtualPixel(image_view,x,y,virtual_pixel,
+ exception);
+ target.red=virtual_pixel[RedPixelChannel];
+ target.green=virtual_pixel[GreenPixelChannel];
+ target.blue=virtual_pixel[BluePixelChannel];
+ target.alpha=virtual_pixel[AlphaPixelChannel];
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- GetPixelPacket(image,q,&pixel);
+ GetPixelPacketPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelPacket(image,&pixel,&target) == MagickFalse)
{
q+=GetPixelChannels(image);
continue;
}
- (void) GetFillColor(draw_info,x,y,&pixel);
+ (void) GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelPacket(image,&pixel,q);
q+=GetPixelChannels(image);
}
target.green=(MagickRealType) draw_info->border_color.green;
target.blue=(MagickRealType) draw_info->border_color.blue;
}
- (void) FloodfillPaintImage(image,DefaultChannels,draw_info,&target,x,
- y,primitive_info->method == FloodfillMethod ? MagickFalse :
- MagickTrue);
+ (void) FloodfillPaintImage(image,draw_info,&target,x,y,
+ primitive_info->method == FloodfillMethod ? MagickFalse :
+ MagickTrue,exception);
break;
}
case ResetMethod:
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- (void) GetFillColor(draw_info,x,y,&pixel);
+ (void) GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelPacket(image,&pixel,q);
q+=GetPixelChannels(image);
}
case MattePrimitive:
{
if (image->matte == MagickFalse)
- (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
+ (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
switch (primitive_info->method)
{
case PointMethod:
q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,exception);
if (q == (Quantum *) NULL)
break;
- (void) GetFillColor(draw_info,x,y,&pixel);
+ (void) GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelAlpha(image,pixel.alpha,q);
(void) SyncCacheViewAuthenticPixels(image_view,exception);
break;
pixel,
target;
- (void) GetOneCacheViewVirtualPixel(image_view,x,y,&target,exception);
+ Quantum
+ virtual_pixel[MaxPixelChannels];
+
+ (void) GetOneCacheViewVirtualPixel(image_view,x,y,virtual_pixel,
+ exception);
+ target.red=virtual_pixel[RedPixelChannel];
+ target.green=virtual_pixel[GreenPixelChannel];
+ target.blue=virtual_pixel[BluePixelChannel];
+ target.alpha=virtual_pixel[AlphaPixelChannel];
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- GetPixelPacket(image,q,&pixel);
+ GetPixelPacketPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelPacket(image,&pixel,&target) == MagickFalse)
{
q+=GetPixelChannels(image);
continue;
}
- (void) GetFillColor(draw_info,x,y,&pixel);
+ (void) GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelAlpha(image,pixel.alpha,q);
q+=GetPixelChannels(image);
}
case FloodfillMethod:
case FillToBorderMethod:
{
+ ChannelType
+ channel_mask;
+
PixelInfo
target;
target.green=(MagickRealType) draw_info->border_color.green;
target.blue=(MagickRealType) draw_info->border_color.blue;
}
- (void) FloodfillPaintImage(image,OpacityChannel,draw_info,&target,x,y,
+ channel_mask=SetPixelChannelMask(image,AlphaChannel);
+ (void) FloodfillPaintImage(image,draw_info,&target,x,y,
primitive_info->method == FloodfillMethod ? MagickFalse :
- MagickTrue);
+ MagickTrue,exception);
+ (void) SetPixelChannelMask(image,channel_mask);
break;
}
case ResetMethod:
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- (void) GetFillColor(draw_info,x,y,&pixel);
+ (void) GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelAlpha(image,pixel.alpha,q);
q+=GetPixelChannels(image);
}
(void) FormatLocaleString(geometry,MaxTextExtent,"%+f%+f",
primitive_info->point.x,primitive_info->point.y);
(void) CloneString(&clone_info->geometry,geometry);
- status=AnnotateImage(image,clone_info);
+ status=AnnotateImage(image,clone_info,exception);
clone_info=DestroyDrawInfo(clone_info);
break;
}
(void) TransformImage(&composite_image,(char *) NULL,geometry);
}
if (composite_image->matte == MagickFalse)
- (void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel);
+ (void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel,
+ exception);
if (draw_info->alpha != OpaqueAlpha)
(void) SetImageOpacity(composite_image,draw_info->alpha);
SetGeometry(image,&geometry);
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetDrawInfo() initializes draw_info to default values.
+% GetDrawInfo() initializes draw_info to default values from image_info.
%
% The format of the GetDrawInfo method is:
%
clone_info=CloneImageInfo(image_info);
GetAffineMatrix(&draw_info->affine);
exception=AcquireExceptionInfo();
- (void) QueryColorDatabase("#000F",&draw_info->fill,exception);
- (void) QueryColorDatabase("#FFF0",&draw_info->stroke,exception);
+ (void) QueryColorCompliance("#000F",AllCompliance,&draw_info->fill,
+ exception);
+ (void) QueryColorCompliance("#FFF0",AllCompliance,&draw_info->stroke,
+ exception);
draw_info->stroke_antialias=clone_info->antialias;
draw_info->stroke_width=1.0;
draw_info->alpha=OpaqueAlpha;
MagickDirectionOptions,MagickFalse,option);
option=GetImageOption(clone_info,"fill");
if (option != (const char *) NULL)
- (void) QueryColorDatabase(option,&draw_info->fill,exception);
+ (void) QueryColorCompliance(option,AllCompliance,&draw_info->fill,
+ exception);
option=GetImageOption(clone_info,"stroke");
if (option != (const char *) NULL)
- (void) QueryColorDatabase(option,&draw_info->stroke,exception);
+ (void) QueryColorCompliance(option,AllCompliance,&draw_info->stroke,
+ exception);
option=GetImageOption(clone_info,"strokewidth");
if (option != (const char *) NULL)
draw_info->stroke_width=InterpretLocaleValue(option,(char **) NULL);
option=GetImageOption(clone_info,"undercolor");
if (option != (const char *) NULL)
- (void) QueryColorDatabase(option,&draw_info->undercolor,exception);
+ (void) QueryColorCompliance(option,AllCompliance,&draw_info->undercolor,
+ exception);
option=GetImageOption(clone_info,"gravity");
if (option != (const char *) NULL)
draw_info->gravity=(GravityType) ParseCommandOption(MagickGravityOptions,