% July 1998 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
DrawInfo
*draw_info;
- draw_info=(DrawInfo *) AcquireAlignedMemory(1,sizeof(*draw_info));
+ draw_info=(DrawInfo *) AcquireMagickMemory(sizeof(*draw_info));
if (draw_info == (DrawInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
GetDrawInfo((ImageInfo *) NULL,draw_info);
DrawInfo
*clone_info;
- clone_info=(DrawInfo *) AcquireAlignedMemory(1,sizeof(*clone_info));
+ clone_info=(DrawInfo *) AcquireMagickMemory(sizeof(*clone_info));
if (clone_info == (DrawInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
GetDrawInfo(image_info,clone_info);
p=polygon_info->edges;
for (i=0; i < (ssize_t) polygon_info->number_edges; i++)
{
- (void) LogMagickEvent(DrawEvent,GetMagickModule()," edge %lu:",i);
+ (void) LogMagickEvent(DrawEvent,GetMagickModule()," edge %.20g:",
+ (double) i);
(void) LogMagickEvent(DrawEvent,GetMagickModule()," direction: %s",
p->direction != MagickFalse ? "down" : "up");
(void) LogMagickEvent(DrawEvent,GetMagickModule()," ghostline: %s",
p->ghostline != MagickFalse ? "transparent" : "opaque");
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- " bounds: %g,%g - %g,%g",p->bounds.x1,p->bounds.y1,
+ " bounds: %g %g - %g %g",p->bounds.x1,p->bounds.y1,
p->bounds.x2,p->bounds.y2);
for (j=0; j < (ssize_t) p->number_points; j++)
- (void) LogMagickEvent(DrawEvent,GetMagickModule()," %g,%g",
+ (void) LogMagickEvent(DrawEvent,GetMagickModule()," %g %g",
p->points[j].x,p->points[j].y);
p++;
}
static PolygonInfo *ConvertPathToPolygon(
const DrawInfo *magick_unused(draw_info),const PathInfo *path_info)
{
- ssize_t
+ long
direction,
next_direction;
/*
Convert a path to the more efficient sorted rendering form.
*/
- polygon_info=(PolygonInfo *) AcquireAlignedMemory(1,sizeof(*polygon_info));
+ polygon_info=(PolygonInfo *) AcquireMagickMemory(sizeof(*polygon_info));
if (polygon_info == (PolygonInfo *) NULL)
return((PolygonInfo *) NULL);
number_edges=16;
(void) LogMagickEvent(DrawEvent,GetMagickModule()," begin vector-path");
for (p=path_info; p->code != EndCode; p++)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- " %g,%g %s",p->point.x,p->point.y,p->code == GhostlineCode ?
+ " %g %g %s",p->point.x,p->point.y,p->code == GhostlineCode ?
"moveto ghostline" : p->code == OpenCode ? "moveto open" :
p->code == MoveToCode ? "moveto" : p->code == LineToCode ? "lineto" :
"?");
static PathInfo *ConvertPrimitiveToPath(
const DrawInfo *magick_unused(draw_info),const PrimitiveInfo *primitive_info)
{
- ssize_t
- coordinates,
- start;
-
PathInfo
*path_info;
i,
n;
+ ssize_t
+ coordinates,
+ start;
+
/*
Converts a PrimitiveInfo structure into a vector path structure.
*/
ExceptionInfo
*exception;
- ssize_t
- y;
-
MagickBooleanType
status;
register ssize_t
i;
- ResampleFilter
- **restrict resample_filter;
-
SegmentInfo
edge;
+ ssize_t
+ y;
+
/*
Determine bounding box.
*/
inverse_affine=InverseAffineMatrix(affine);
GetMagickPixelPacket(image,&zero);
exception=(&image->exception);
- resample_filter=AcquireResampleFilterThreadSet(source,
- UndefinedVirtualPixelMethod,MagickTrue,exception);
image_view=AcquireCacheView(image);
source_view=AcquireCacheView(source);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#endif
for (y=(ssize_t) ceil(edge.y1-0.5); y <= (ssize_t) floor(edge.y2+0.5); y++)
{
- ssize_t
- x_offset;
-
MagickPixelPacket
composite,
pixel;
*restrict indexes;
register ssize_t
- id,
x;
register PixelPacket
SegmentInfo
inverse_edge;
+ ssize_t
+ x_offset;
+
inverse_edge=AffineEdge(source,&inverse_affine,(double) y,&edge);
if (inverse_edge.x2 < inverse_edge.x1)
continue;
- q=GetCacheViewAuthenticPixels(image_view,(ssize_t) ceil(inverse_edge.x1-0.5),y,
- (size_t) ((ssize_t) floor(inverse_edge.x2+0.5)-(ssize_t) floor(
+ q=GetCacheViewAuthenticPixels(image_view,(ssize_t) ceil(inverse_edge.x1-
+ 0.5),y,(size_t) ((ssize_t) floor(inverse_edge.x2+0.5)-(ssize_t) floor(
inverse_edge.x1+0.5)+1),1,exception);
if (q == (PixelPacket *) NULL)
continue;
- id=GetOpenMPThreadId();
indexes=GetCacheViewAuthenticIndexQueue(image_view);
pixel=zero;
composite=zero;
inverse_affine.tx;
point.y=(double) x*inverse_affine.rx+y*inverse_affine.sy+
inverse_affine.ty;
- (void) ResamplePixelColor(resample_filter[id],point.x,point.y,&pixel);
+ (void) InterpolateMagickPixelPacket(source,source_view,
+ UndefinedInterpolatePixel,point.x,point.y,&pixel,exception);
SetMagickPixelPacket(image,q,indexes+x_offset,&composite);
MagickPixelCompositeOver(&pixel,pixel.opacity,&composite,
composite.opacity,&composite);
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
- resample_filter=DestroyResampleFilterThreadSet(resample_filter);
source_view=DestroyCacheView(source_view);
image_view=DestroyCacheView(image_view);
return(status);
DrawInfo
*clone_info;
- ssize_t
- coordinates;
-
MagickRealType
mid;
SegmentInfo
bounds;
+ ssize_t
+ coordinates;
+
clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
(void) QueryColorDatabase("#0000",&clone_info->fill,&image->exception);
resolution.x=DefaultResolution;
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(draw_info != (const DrawInfo *) NULL);
- (void) FormatMagickString(clip_mask,MaxTextExtent,"%s",name);
+ (void) FormatLocaleString(clip_mask,MaxTextExtent,"%s",name);
value=GetImageArtifact(image,clip_mask);
if (value == (const char *) NULL)
return(MagickFalse);
DrawInfo
*clone_info;
- ssize_t
- j,
- n;
-
MagickRealType
length,
maximum_length,
size_t
number_vertices;
+ ssize_t
+ j,
+ n;
+
assert(draw_info != (const DrawInfo *) NULL);
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-dash");
double
value;
- value=strtod(point,&p);
+ value=InterpretLocaleValue(point,&p);
return((value == 0.0) && (p == point) ? MagickFalse : MagickTrue);
}
DrawInfo
**graphic_context;
- ssize_t
- j,
- k,
- n;
-
MagickBooleanType
proceed,
status;
bounds;
size_t
- length;
-
- size_t
+ length,
number_points;
+ ssize_t
+ j,
+ k,
+ n;
+
/*
Ensure the annotation info is valid.
*/
/*
Allocate primitive info memory.
*/
- graphic_context=(DrawInfo **) AcquireAlignedMemory(1,
+ graphic_context=(DrawInfo **) AcquireMagickMemory(
sizeof(*graphic_context));
if (graphic_context == (DrawInfo **) NULL)
{
if (LocaleCompare("affine",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.sx=StringToDouble(token);
+ affine.sx=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.rx=StringToDouble(token);
+ affine.rx=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.ry=StringToDouble(token);
+ affine.ry=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.sy=StringToDouble(token);
+ affine.sy=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.tx=StringToDouble(token);
+ affine.tx=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.ty=StringToDouble(token);
+ affine.ty=InterpretLocaleValue(token,(char **) NULL);
break;
}
if (LocaleCompare("arc",keyword) == 0)
fill_rule;
GetMagickToken(q,&q,token);
- fill_rule=ParseMagickOption(MagickFillRuleOptions,MagickFalse,
+ fill_rule=ParseCommandOption(MagickFillRuleOptions,MagickFalse,
token);
if (fill_rule == -1)
{
clip_units;
GetMagickToken(q,&q,token);
- clip_units=ParseMagickOption(MagickClipPathOptions,MagickFalse,
+ clip_units=ParseCommandOption(MagickClipPathOptions,MagickFalse,
token);
if (clip_units == -1)
{
decorate;
GetMagickToken(q,&q,token);
- decorate=ParseMagickOption(MagickDecorateOptions,MagickFalse,
+ decorate=ParseCommandOption(MagickDecorateOptions,MagickFalse,
token);
if (decorate == -1)
{
if (LocaleCompare("fill",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(pattern,MaxTextExtent,"%s",token);
+ (void) FormatLocaleString(pattern,MaxTextExtent,"%s",token);
if (GetImageArtifact(image,pattern) != (const char *) NULL)
(void) DrawPatternPath(image,draw_info,token,
&graphic_context[n]->fill_pattern);
GetMagickToken(q,&q,token);
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
graphic_context[n]->fill.opacity=ClampToQuantum((MagickRealType)
- QuantumRange*(1.0-factor*StringToDouble(token)));
+ QuantumRange*(1.0-factor*InterpretLocaleValue(token,
+ (char **) NULL)));
break;
}
if (LocaleCompare("fill-rule",keyword) == 0)
fill_rule;
GetMagickToken(q,&q,token);
- fill_rule=ParseMagickOption(MagickFillRuleOptions,MagickFalse,
+ fill_rule=ParseCommandOption(MagickFillRuleOptions,MagickFalse,
token);
if (fill_rule == -1)
{
if (LocaleCompare("font-size",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->pointsize=StringToDouble(token);
+ graphic_context[n]->pointsize=InterpretLocaleValue(token,
+ (char **) NULL);
break;
}
if (LocaleCompare("font-stretch",keyword) == 0)
stretch;
GetMagickToken(q,&q,token);
- stretch=ParseMagickOption(MagickStretchOptions,MagickFalse,token);
+ stretch=ParseCommandOption(MagickStretchOptions,MagickFalse,token);
if (stretch == -1)
{
status=MagickFalse;
style;
GetMagickToken(q,&q,token);
- style=ParseMagickOption(MagickStyleOptions,MagickFalse,token);
+ style=ParseCommandOption(MagickStyleOptions,MagickFalse,token);
if (style == -1)
{
status=MagickFalse;
gravity;
GetMagickToken(q,&q,token);
- gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,token);
+ gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,token);
if (gravity == -1)
{
status=MagickFalse;
primitive_type=ImagePrimitive;
GetMagickToken(q,&q,token);
- compose=ParseMagickOption(MagickComposeOptions,MagickFalse,token);
+ compose=ParseCommandOption(MagickComposeOptions,MagickFalse,token);
if (compose == -1)
{
status=MagickFalse;
if (LocaleCompare("interline-spacing",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->interline_spacing=StringToDouble(token);
+ graphic_context[n]->interline_spacing=InterpretLocaleValue(token,
+ (char **) NULL);
break;
}
if (LocaleCompare("interword-spacing",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->interword_spacing=StringToDouble(token);
+ graphic_context[n]->interword_spacing=InterpretLocaleValue(token,
+ (char **) NULL);
break;
}
status=MagickFalse;
if (LocaleCompare("kerning",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->kerning=StringToDouble(token);
+ graphic_context[n]->kerning=InterpretLocaleValue(token,
+ (char **) NULL);
break;
}
status=MagickFalse;
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
graphic_context[n]->opacity=ClampToQuantum((MagickRealType)
QuantumRange*(1.0-((1.0-QuantumScale*graphic_context[n]->opacity)*
- factor*StringToDouble(token))));
+ factor*InterpretLocaleValue(token,(char **) NULL))));
graphic_context[n]->fill.opacity=graphic_context[n]->opacity;
graphic_context[n]->stroke.opacity=graphic_context[n]->opacity;
break;
name[MaxTextExtent];
GetMagickToken(q,&q,token);
- (void) FormatMagickString(name,MaxTextExtent,"%s",token);
+ (void) FormatLocaleString(name,MaxTextExtent,"%s",token);
for (p=q; *q != '\0'; )
{
GetMagickToken(q,&q,token);
name[MaxTextExtent],
type[MaxTextExtent];
- ElementInfo
- element;
-
SegmentInfo
segment;
GetMagickToken(q,&q,token);
(void) CopyMagickString(type,token,MaxTextExtent);
GetMagickToken(q,&q,token);
- segment.x1=StringToDouble(token);
- element.cx=StringToDouble(token);
+ segment.x1=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- segment.y1=StringToDouble(token);
- element.cy=StringToDouble(token);
+ segment.y1=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- segment.x2=StringToDouble(token);
- element.major=StringToDouble(token);
+ segment.x2=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- segment.y2=StringToDouble(token);
- element.minor=StringToDouble(token);
+ segment.y2=InterpretLocaleValue(token,(char **) NULL);
if (LocaleCompare(type,"radial") == 0)
{
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- element.angle=StringToDouble(token);
}
for (p=q; *q != '\0'; )
{
bounds.y2=graphic_context[n]->affine.rx*segment.x2+
graphic_context[n]->affine.sy*segment.y2+
graphic_context[n]->affine.ty;
- (void) FormatMagickString(key,MaxTextExtent,"%s",name);
+ (void) FormatLocaleString(key,MaxTextExtent,"%s",name);
(void) SetImageArtifact(image,key,token);
- (void) FormatMagickString(key,MaxTextExtent,"%s-geometry",name);
- (void) FormatMagickString(geometry,MaxTextExtent,
+ (void) FormatLocaleString(key,MaxTextExtent,"%s-geometry",name);
+ (void) FormatLocaleString(geometry,MaxTextExtent,
"%gx%g%+.15g%+.15g",
MagickMax(fabs(bounds.x2-bounds.x1+1.0),1.0),
MagickMax(fabs(bounds.y2-bounds.y1+1.0),1.0),
GetMagickToken(q,&q,token);
(void) CopyMagickString(name,token,MaxTextExtent);
GetMagickToken(q,&q,token);
- bounds.x=(ssize_t) ceil(StringToDouble(token)-0.5);
+ bounds.x=(ssize_t) ceil(InterpretLocaleValue(token,
+ (char **) NULL)-0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- bounds.y=(ssize_t) ceil(StringToDouble(token)-0.5);
+ bounds.y=(ssize_t) ceil(InterpretLocaleValue(token,
+ (char **) NULL)-0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- bounds.width=(size_t) floor(StringToDouble(token)+0.5);
+ bounds.width=(size_t) floor(InterpretLocaleValue(token,
+ (char **) NULL)+0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- bounds.height=(size_t) floor(StringToDouble(token)+0.5);
+ bounds.height=(size_t) floor(InterpretLocaleValue(token,
+ (char **) NULL)+0.5);
for (p=q; *q != '\0'; )
{
GetMagickToken(q,&q,token);
break;
}
(void) CopyMagickString(token,p,(size_t) (q-p-4+1));
- (void) FormatMagickString(key,MaxTextExtent,"%s",name);
+ (void) FormatLocaleString(key,MaxTextExtent,"%s",name);
(void) SetImageArtifact(image,key,token);
- (void) FormatMagickString(key,MaxTextExtent,"%s-geometry",name);
- (void) FormatMagickString(geometry,MaxTextExtent,
- "%lux%lu%+ld%+ld",bounds.width,bounds.height,bounds.x,
- bounds.y);
+ (void) FormatLocaleString(key,MaxTextExtent,"%s-geometry",name);
+ (void) FormatLocaleString(geometry,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) bounds.width,(double)
+ bounds.height,(double) bounds.x,(double) bounds.y);
(void) SetImageArtifact(image,key,geometry);
GetMagickToken(q,&q,token);
break;
if (LocaleCompare("rotate",keyword) == 0)
{
GetMagickToken(q,&q,token);
- angle=StringToDouble(token);
+ angle=InterpretLocaleValue(token,(char **) NULL);
affine.sx=cos(DegreesToRadians(fmod((double) angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod((double) angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod((double) angle,360.0))));
if (LocaleCompare("scale",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.sx=StringToDouble(token);
+ affine.sx=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.sy=StringToDouble(token);
+ affine.sy=InterpretLocaleValue(token,(char **) NULL);
break;
}
if (LocaleCompare("skewX",keyword) == 0)
{
GetMagickToken(q,&q,token);
- angle=StringToDouble(token);
+ angle=InterpretLocaleValue(token,(char **) NULL);
affine.ry=sin(DegreesToRadians(angle));
break;
}
if (LocaleCompare("skewY",keyword) == 0)
{
GetMagickToken(q,&q,token);
- angle=StringToDouble(token);
+ angle=InterpretLocaleValue(token,(char **) NULL);
affine.rx=(-tan(DegreesToRadians(angle)/2.0));
break;
}
if (LocaleCompare("stroke",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(pattern,MaxTextExtent,"%s",token);
+ (void) FormatLocaleString(pattern,MaxTextExtent,"%s",token);
if (GetImageArtifact(image,pattern) != (const char *) NULL)
(void) DrawPatternPath(image,draw_info,token,
&graphic_context[n]->stroke_pattern);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- graphic_context[n]->dash_pattern[j]=StringToDouble(token);
+ graphic_context[n]->dash_pattern[j]=InterpretLocaleValue(
+ token,(char **) NULL);
}
if ((x & 0x01) != 0)
for ( ; j < (2*x); j++)
if (LocaleCompare("stroke-dashoffset",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->dash_offset=StringToDouble(token);
+ graphic_context[n]->dash_offset=InterpretLocaleValue(token,
+ (char **) NULL);
break;
}
if (LocaleCompare("stroke-linecap",keyword) == 0)
linecap;
GetMagickToken(q,&q,token);
- linecap=ParseMagickOption(MagickLineCapOptions,MagickFalse,token);
+ linecap=ParseCommandOption(MagickLineCapOptions,MagickFalse,token);
if (linecap == -1)
{
status=MagickFalse;
linejoin;
GetMagickToken(q,&q,token);
- linejoin=ParseMagickOption(MagickLineJoinOptions,MagickFalse,token);
+ linejoin=ParseCommandOption(MagickLineJoinOptions,MagickFalse,token);
if (linejoin == -1)
{
status=MagickFalse;
GetMagickToken(q,&q,token);
factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0;
graphic_context[n]->stroke.opacity=ClampToQuantum((MagickRealType)
- QuantumRange*(1.0-factor*StringToDouble(token)));
+ QuantumRange*(1.0-factor*InterpretLocaleValue(token,
+ (char **) NULL)));
break;
}
if (LocaleCompare("stroke-width",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->stroke_width=StringToDouble(token);
+ graphic_context[n]->stroke_width=InterpretLocaleValue(token,
+ (char **) NULL);
break;
}
status=MagickFalse;
align;
GetMagickToken(q,&q,token);
- align=ParseMagickOption(MagickAlignOptions,MagickFalse,token);
+ align=ParseCommandOption(MagickAlignOptions,MagickFalse,token);
if (align == -1)
{
status=MagickFalse;
align;
GetMagickToken(q,&q,token);
- align=ParseMagickOption(MagickAlignOptions,MagickFalse,token);
+ align=ParseCommandOption(MagickAlignOptions,MagickFalse,token);
if (align == -1)
{
status=MagickFalse;
if (LocaleCompare("translate",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.tx=StringToDouble(token);
+ affine.tx=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.ty=StringToDouble(token);
+ affine.ty=InterpretLocaleValue(token,(char **) NULL);
break;
}
status=MagickFalse;
if (LocaleCompare("viewbox",keyword) == 0)
{
GetMagickToken(q,&q,token);
- graphic_context[n]->viewbox.x=(ssize_t) ceil(StringToDouble(token)-
- 0.5);
+ graphic_context[n]->viewbox.x=(ssize_t) ceil(InterpretLocaleValue(
+ token,(char **) NULL)-0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- graphic_context[n]->viewbox.y=(ssize_t) ceil(StringToDouble(token)-
- 0.5);
+ graphic_context[n]->viewbox.y=(ssize_t) ceil(InterpretLocaleValue(
+ token,(char **) NULL)-0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
graphic_context[n]->viewbox.width=(size_t) floor(
- StringToDouble(token)+0.5);
+ InterpretLocaleValue(token,(char **) NULL)+0.5);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
graphic_context[n]->viewbox.height=(size_t) floor(
- StringToDouble(token)+0.5);
+ InterpretLocaleValue(token,(char **) NULL)+0.5);
break;
}
status=MagickFalse;
graphic_context[n]->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
graphic_context[n]->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
graphic_context[n]->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
- graphic_context[n]->affine.tx=
- current.sx*affine.tx+current.ry*affine.ty+current.tx;
- graphic_context[n]->affine.ty=
- current.rx*affine.tx+current.sy*affine.ty+current.ty;
+ graphic_context[n]->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
+ current.tx;
+ graphic_context[n]->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
+ current.ty;
}
if (primitive_type == UndefinedPrimitive)
{
if (IsPoint(q) == MagickFalse)
break;
GetMagickToken(q,&q,token);
- point.x=StringToDouble(token);
+ point.x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- point.y=StringToDouble(token);
+ point.y=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(q,(const char **) NULL,token);
if (*token == ',')
GetMagickToken(q,&q,token);
double
value;
- value=strtod(s,&t);
+ value=InterpretLocaleValue(s,&t);
+ (void) value;
if (s == t)
{
t++;
continue;
}
- length+=BezierQuantum;
+ length++;
}
+ length=3*length/2+6*BezierQuantum+360;
break;
}
case CirclePrimitive:
alpha=bounds.x2-bounds.x1;
beta=bounds.y2-bounds.y1;
radius=hypot((double) alpha,(double) beta);
- length=2*((size_t) (MagickPI*radius))+6*BezierQuantum+360+1;
+ length=2*((size_t) ceil((double) MagickPI*radius))+6*BezierQuantum+360;
break;
}
default:
break;
}
GetMagickToken(q,&q,token);
- method=ParseMagickOption(MagickMethodOptions,MagickFalse,token);
+ method=ParseCommandOption(MagickMethodOptions,MagickFalse,token);
if (method == -1)
{
status=MagickFalse;
ExceptionInfo
*exception;
- ssize_t
- y;
-
MagickBooleanType
status;
RectangleInfo
bounding_box;
+ ssize_t
+ y;
+
/*
Draw linear or radial gradient on image.
*/
#endif
for (y=bounding_box.y; y < (ssize_t) bounding_box.height; y++)
{
- ssize_t
- j;
-
MagickPixelPacket
composite,
pixel;
register PixelPacket
*restrict q;
+ ssize_t
+ j;
+
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(draw_info != (const DrawInfo *) NULL);
assert(name != (const char *) NULL);
- (void) FormatMagickString(property,MaxTextExtent,"%s",name);
+ (void) FormatLocaleString(property,MaxTextExtent,"%s",name);
path=GetImageArtifact(image,property);
if (path == (const char *) NULL)
return(MagickFalse);
- (void) FormatMagickString(property,MaxTextExtent,"%s-geometry",name);
+ (void) FormatLocaleString(property,MaxTextExtent,"%s-geometry",name);
geometry=GetImageArtifact(image,property);
if (geometry == (const char *) NULL)
return(MagickFalse);
for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
if (polygon_info[i] != (PolygonInfo *) NULL)
polygon_info[i]=DestroyPolygonInfo(polygon_info[i]);
- polygon_info=(PolygonInfo **) RelinquishAlignedMemory(polygon_info);
+ polygon_info=(PolygonInfo **) RelinquishMagickMemory(polygon_info);
return(polygon_info);
}
PathInfo
*restrict path_info;
- register ssize_t
- i;
-
PolygonInfo
**polygon_info;
+ register ssize_t
+ i;
+
size_t
number_threads;
number_threads=GetOpenMPMaximumThreads();
- polygon_info=(PolygonInfo **) AcquireAlignedMemory(number_threads,
+ polygon_info=(PolygonInfo **) AcquireQuantumMemory(number_threads,
sizeof(*polygon_info));
if (polygon_info == (PolygonInfo **) NULL)
return((PolygonInfo **) NULL);
const FillRule fill_rule,const double x,const double y,
MagickRealType *stroke_opacity)
{
- int
- winding_number;
-
- ssize_t
- j;
-
MagickRealType
alpha,
beta,
register ssize_t
i;
+ ssize_t
+ j,
+ winding_number;
+
/*
Compute fill & stroke opacity for this (x,y) point.
*/
ExceptionInfo
*exception;
- ssize_t
- start,
- stop,
- y;
-
MagickBooleanType
fill,
status;
SegmentInfo
bounds;
+ ssize_t
+ start,
+ stop,
+ y;
+
/*
Compute bounding box.
*/
#endif
for (y=(ssize_t) ceil(bounds.y1-0.5); y <= (ssize_t) floor(bounds.y2+0.5); y++)
{
+ const int
+ id = GetOpenMPThreadId();
+
MagickRealType
fill_opacity,
stroke_opacity;
fill_color,
stroke_color;
- register ssize_t
- id,
- x;
-
register PixelPacket
*restrict q;
+ register ssize_t
+ x;
+
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,start,y,(size_t) (stop-
status=MagickFalse;
continue;
}
- id=GetOpenMPThreadId();
for (x=start; x <= stop; x++)
{
/*
"?"
};
- ssize_t
- coordinates,
- y;
-
PointInfo
p,
q,
i,
x;
+ ssize_t
+ coordinates,
+ y;
+
x=(ssize_t) ceil(primitive_info->point.x-0.5);
y=(ssize_t) ceil(primitive_info->point.y-0.5);
switch (primitive_info->primitive)
case PointPrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- "PointPrimitive %ld,%ld %s",x,y,methods[primitive_info->method]);
+ "PointPrimitive %.20g,%.20g %s",(double) x,(double) y,
+ methods[primitive_info->method]);
return;
}
case ColorPrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- "ColorPrimitive %ld,%ld %s",x,y,methods[primitive_info->method]);
+ "ColorPrimitive %.20g,%.20g %s",(double) x,(double) y,
+ methods[primitive_info->method]);
return;
}
case MattePrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- "MattePrimitive %ld,%ld %s",x,y,methods[primitive_info->method]);
+ "MattePrimitive %.20g,%.20g %s",(double) x,(double) y,
+ methods[primitive_info->method]);
return;
}
case TextPrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- "TextPrimitive %ld,%ld",x,y);
+ "TextPrimitive %.20g,%.20g",(double) x,(double) y);
return;
}
case ImagePrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- "ImagePrimitive %ld,%ld",x,y);
+ "ImagePrimitive %.20g,%.20g",(double) x,(double) y);
return;
}
default:
{
coordinates=(ssize_t) primitive_info[i].coordinates;
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- " begin open (%ld)",coordinates);
+ " begin open (%.20g)",(double) coordinates);
p=point;
}
point=primitive_info[i].point;
if ((fabs(q.x-point.x) > MagickEpsilon) ||
(fabs(q.y-point.y) > MagickEpsilon))
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- " %ld: %.18g,%.18g",coordinates,point.x,point.y);
+ " %.20g: %.18g,%.18g",(double) coordinates,point.x,point.y);
else
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- " %ld: %g,%g (duplicate)",coordinates,point.x,point.y);
+ " %.20g: %g %g (duplicate)",(double) coordinates,point.x,point.y);
q=point;
coordinates--;
if (coordinates > 0)
continue;
if ((fabs(p.x-point.x) > MagickEpsilon) ||
(fabs(p.y-point.y) > MagickEpsilon))
- (void) LogMagickEvent(DrawEvent,GetMagickModule()," end last (%ld)",
- coordinates);
+ (void) LogMagickEvent(DrawEvent,GetMagickModule()," end last (%.20g)",
+ (double) coordinates);
else
- (void) LogMagickEvent(DrawEvent,GetMagickModule()," end open (%ld)",
- coordinates);
+ (void) LogMagickEvent(DrawEvent,GetMagickModule()," end open (%.20g)",
+ (double) coordinates);
}
}
ExceptionInfo
*exception;
- ssize_t
- y;
-
MagickStatusType
status;
i,
x;
+ ssize_t
+ y;
+
if (image->debug != MagickFalse)
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
" begin draw-primitive");
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
- " affine: %g,%g,%g,%g,%g,%g",draw_info->affine.sx,
+ " affine: %g %g %g %g %g %g",draw_info->affine.sx,
draw_info->affine.rx,draw_info->affine.ry,draw_info->affine.sy,
draw_info->affine.tx,draw_info->affine.ty);
}
for (y=0; y < (ssize_t) image->rows; y++)
{
- register ssize_t
- x;
-
register PixelPacket
*restrict q;
+ register ssize_t
+ x;
+
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
if (q == (PixelPacket *) NULL)
break;
(void) GetFillColor(draw_info,x,y,&pixel);
- q->opacity=pixel.opacity;
+ SetOpacityPixelComponent(q,pixel.opacity);
(void) SyncCacheViewAuthenticPixels(image_view,exception);
break;
}
(void) GetOneCacheViewVirtualPixel(image_view,x,y,&target,exception);
for (y=0; y < (ssize_t) image->rows; y++)
{
- register ssize_t
- x;
-
register PixelPacket
*restrict q;
+ register ssize_t
+ x;
+
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
continue;
}
(void) GetFillColor(draw_info,x,y,&pixel);
- q->opacity=pixel.opacity;
+ SetOpacityPixelComponent(q,pixel.opacity);
q++;
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
for (y=0; y < (ssize_t) image->rows; y++)
{
- register ssize_t
- x;
-
register PixelPacket
*restrict q;
+ register ssize_t
+ x;
+
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
for (x=0; x < (ssize_t) image->columns; x++)
{
(void) GetFillColor(draw_info,x,y,&pixel);
- q->opacity=pixel.opacity;
+ SetOpacityPixelComponent(q,pixel.opacity);
q++;
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
break;
clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
(void) CloneString(&clone_info->text,primitive_info->text);
- (void) FormatMagickString(geometry,MaxTextExtent,"%+f%+f",
+ (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);
ImageInfo
*clone_info;
+ RectangleInfo
+ geometry;
+
ssize_t
x1,
y1;
- RectangleInfo
- geometry;
-
if (primitive_info->text == (char *) NULL)
break;
clone_info=AcquireImageInfo();
/*
Resize image.
*/
- (void) FormatMagickString(geometry,MaxTextExtent,"%gx%g!",
+ (void) FormatLocaleString(geometry,MaxTextExtent,"%gx%g!",
primitive_info[1].point.x,primitive_info[1].point.y);
composite_image->filter=image->filter;
(void) TransformImage(&composite_image,(char *) NULL,geometry);
image->gravity=draw_info->gravity;
geometry.x=x;
geometry.y=y;
- (void) FormatMagickString(composite_geometry,MaxTextExtent,
- "%lux%lu%+ld%+ld",composite_image->columns,composite_image->rows,
- geometry.x,geometry.y);
+ (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);
affine=draw_info->affine;
(void) CloneString(&draw_info->encoding,option);
option=GetImageOption(clone_info,"kerning");
if (option != (const char *) NULL)
- draw_info->kerning=StringToDouble(option);
+ draw_info->kerning=InterpretLocaleValue(option,(char **) NULL);
option=GetImageOption(clone_info,"interline-spacing");
if (option != (const char *) NULL)
- draw_info->interline_spacing=StringToDouble(option);
+ draw_info->interline_spacing=InterpretLocaleValue(option,(char **) NULL);
draw_info->direction=UndefinedDirection;
option=GetImageOption(clone_info,"interword-spacing");
if (option != (const char *) NULL)
- draw_info->interword_spacing=StringToDouble(option);
+ draw_info->interword_spacing=InterpretLocaleValue(option,(char **) NULL);
option=GetImageOption(clone_info,"direction");
if (option != (const char *) NULL)
- draw_info->direction=(DirectionType) ParseMagickOption(
+ draw_info->direction=(DirectionType) ParseCommandOption(
MagickDirectionOptions,MagickFalse,option);
option=GetImageOption(clone_info,"fill");
if (option != (const char *) NULL)
(void) QueryColorDatabase(option,&draw_info->stroke,exception);
option=GetImageOption(clone_info,"strokewidth");
if (option != (const char *) NULL)
- draw_info->stroke_width=StringToDouble(option);
+ 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);
option=GetImageOption(clone_info,"gravity");
if (option != (const char *) NULL)
- draw_info->gravity=(GravityType) ParseMagickOption(MagickGravityOptions,
+ draw_info->gravity=(GravityType) ParseCommandOption(MagickGravityOptions,
MagickFalse,option);
exception=DestroyExceptionInfo(exception);
draw_info->signature=MagickSignature;
if ((theta > 0.0) && (sweep == MagickFalse))
theta-=(MagickRealType) (2.0*MagickPI);
arc_segments=(size_t) ceil(fabs((double) (theta/(0.5*MagickPI+
- MagickEpsilon)))-0.5);
+ MagickEpsilon))));
p=primitive_info;
for (i=0; i < (ssize_t) arc_segments; i++)
{
point,
*points;
+ register PrimitiveInfo
+ *p;
+
register ssize_t
i,
j;
- register PrimitiveInfo
- *p;
-
size_t
control_points,
quantum;
}
delta=2.0/MagickMax(stop.x,stop.y);
step=(MagickRealType) (MagickPI/8.0);
- if ((delta >= 0.0) && (delta < (MagickPI/8.0)))
- step=MagickPI/(4*(MagickPI/delta/2+0.5));
+ if ((delta >= 0.0) && (delta < (MagickRealType) (MagickPI/8.0)))
+ step=(MagickRealType) (MagickPI/(4*(MagickPI/delta/2+0.5)));
angle.x=DegreesToRadians(degrees.x);
y=degrees.y;
while (y < degrees.x)
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- arc.x=StringToDouble(token);
+ arc.x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- arc.y=StringToDouble(token);
+ arc.y=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- angle=StringToDouble(token);
+ angle=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
end.x=(double) (attribute == (int) 'A' ? x : point.x+x);
end.y=(double) (attribute == (int) 'A' ? y : point.y+y);
TraceArcPath(q,point,end,arc,angle,large_arc,sweep);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
end.x=(double) (attribute == (int) 'C' ? x : point.x+x);
end.y=(double) (attribute == (int) 'C' ? y : point.y+y);
points[i]=end;
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
point.x=(double) (attribute == (int) 'H' ? x: point.x+x);
TracePoint(q,point);
q+=q->coordinates;
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
point.x=(double) (attribute == (int) 'L' ? x : point.x+x);
point.y=(double) (attribute == (int) 'L' ? y : point.y+y);
TracePoint(q,point);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
point.x=(double) (attribute == (int) 'M' ? x : point.x+x);
point.y=(double) (attribute == (int) 'M' ? y : point.y+y);
if (i == 0)
i++;
TracePoint(q,point);
q+=q->coordinates;
- if (attribute == (int) 'M')
+ if ((i != 0) && (attribute == (int) 'M'))
{
TracePoint(q,point);
q+=q->coordinates;
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
if (*p == ',')
p++;
end.x=(double) (attribute == (int) 'Q' ? x : point.x+x);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
if (*p == ',')
p++;
end.x=(double) (attribute == (int) 'S' ? x : point.x+x);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=StringToDouble(token);
+ x=InterpretLocaleValue(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
end.x=(double) (attribute == (int) 'T' ? x : point.x+x);
end.y=(double) (attribute == (int) 'T' ? y : point.y+y);
points[i]=end;
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=StringToDouble(token);
+ y=InterpretLocaleValue(token,(char **) NULL);
point.y=(double) (attribute == (int) 'V' ? y : point.y+y);
TracePoint(q,point);
q+=q->coordinates;
default:
{
if (isalpha((int) ((unsigned char) attribute)) != 0)
- (void) fprintf(stderr,"attribute not recognized: %c\n",attribute);
+ (void) FormatLocaleFile(stderr,"attribute not recognized: %c\n",
+ attribute);
break;
}
}
MagickRealType
distance;
- ssize_t
- j;
-
register MagickRealType
dx,
dy;
register ssize_t
i;
+ ssize_t
+ j;
+
dx=0.0;
dy=0.0;
for (i=1; i < (ssize_t) number_vertices; i++)
slope,
theta;
- ssize_t
- j,
- n,
- p,
- q;
-
MagickBooleanType
closed_path;
max_strokes,
number_vertices;
+ ssize_t
+ j,
+ n,
+ p,
+ q;
+
/*
Allocate paths.
*/