% March 2002 %
% %
% %
-% Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2010 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 %
#include "wand/MagickWand.h"
#include "wand/magick-wand-private.h"
#include "wand/wand.h"
+#include "magick/string-private.h"
\f
/*
Define declarations.
struct _DrawingWand
{
- unsigned long
+ size_t
id;
char
mvg_alloc, /* total allocated memory */
mvg_length; /* total MVG length */
- unsigned long
+ size_t
mvg_width; /* current line width */
/* Pattern support */
pattern_offset;
/* Graphic wand */
- unsigned long
+ size_t
index; /* array index */
DrawInfo
filter_off; /* true if not filtering attributes */
/* Pretty-printing depth */
- unsigned long
+ size_t
indent_depth; /* number of left-hand pad characters */
/* Path operation support */
destroy,
debug;
- unsigned long
+ size_t
signature;
};
const unsigned char *);
void (*DrawArc)(DrawingWand *,const double,const double,const double,
const double,const double,const double);
- void (*DrawBezier)(DrawingWand *,const unsigned long,const PointInfo *);
+ void (*DrawBezier)(DrawingWand *,const size_t,const PointInfo *);
void (*DrawCircle)(DrawingWand *,const double,const double,const double,
const double);
void (*DrawColor)(DrawingWand *,const double,const double,const PaintMethod);
void (*DrawPathMoveToRelative)(DrawingWand *,const double,const double);
void (*DrawPathStart)(DrawingWand *);
void (*DrawPoint)(DrawingWand *,const double,const double);
- void (*DrawPolygon)(DrawingWand *,const unsigned long,const PointInfo *);
- void (*DrawPolyline)(DrawingWand *,const unsigned long,const PointInfo *);
+ void (*DrawPolygon)(DrawingWand *,const size_t,const PointInfo *);
+ void (*DrawPolyline)(DrawingWand *,const size_t,const PointInfo *);
void (*DrawPopClipPath)(DrawingWand *);
void (*DrawPopDefs)(DrawingWand *);
MagickBooleanType (*DrawPopPattern)(DrawingWand *);
void (*DrawSetFontSize)(DrawingWand *,const double);
void (*DrawSetFontStretch)(DrawingWand *,const StretchType);
void (*DrawSetFontStyle)(DrawingWand *,const StyleType);
- void (*DrawSetFontWeight)(DrawingWand *,const unsigned long);
+ void (*DrawSetFontWeight)(DrawingWand *,const size_t);
void (*DrawSetGravity)(DrawingWand *,const GravityType);
void (*DrawRotate)(DrawingWand *,const double);
void (*DrawScale)(DrawingWand *,const double,const double);
void (*DrawSetStrokeDashOffset)(DrawingWand *,const double);
void (*DrawSetStrokeLineCap)(DrawingWand *,const LineCap);
void (*DrawSetStrokeLineJoin)(DrawingWand *,const LineJoin);
- void (*DrawSetStrokeMiterLimit)(DrawingWand *,const unsigned long);
+ void (*DrawSetStrokeMiterLimit)(DrawingWand *,const size_t);
MagickBooleanType (*DrawSetStrokePatternURL)(DrawingWand *,const char *);
void (*DrawSetStrokeWidth)(DrawingWand *,const double);
void (*DrawSetTextAntialias)(DrawingWand *,const MagickBooleanType);
void (*DrawSetTextDecoration)(DrawingWand *,const DecorationType);
void (*DrawSetTextUnderColor)(DrawingWand *,const PixelWand *);
void (*DrawTranslate)(DrawingWand *,const double,const double);
- void (*DrawSetViewbox)(DrawingWand *,unsigned long,unsigned long,
- unsigned long,unsigned long);
+ void (*DrawSetViewbox)(DrawingWand *,size_t,size_t,
+ size_t,size_t);
void (*PeekDrawingWand)(DrawingWand *);
MagickBooleanType (*PopDrawingWand)(DrawingWand *);
MagickBooleanType (*PushDrawingWand)(DrawingWand *);
}
static void MvgAppendPointsCommand(DrawingWand *wand,const char *command,
- const unsigned long number_coordinates,const PointInfo *coordinates)
+ const size_t number_coordinates,const PointInfo *coordinates)
{
const PointInfo
*coordinate;
- unsigned long
+ size_t
i;
(void) MvgPrintf(wand,"%s",command);
DrawingWand
*clone_wand;
- register long
+ register ssize_t
i;
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- clone_wand=(DrawingWand *) AcquireMagickMemory(sizeof(*clone_wand));
+ clone_wand=(DrawingWand *) AcquireAlignedMemory(1,sizeof(*clone_wand));
if (clone_wand == (DrawingWand *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",GetExceptionMessage(errno));
(void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
clone_wand->id=AcquireWandId();
- (void) FormatMagickString(clone_wand->name,MaxTextExtent,"DrawingWand-%lu",
- clone_wand->id);
+ (void) FormatMagickString(clone_wand->name,MaxTextExtent,"DrawingWand-%.20g",
+ (double) clone_wand->id);
clone_wand->exception=AcquireExceptionInfo();
InheritException(clone_wand->exception,wand->exception);
clone_wand->mvg=AcquireString(wand->mvg);
if (clone_wand->graphic_context == (DrawInfo **) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
- for (i=0; i <= (long) wand->index; i++)
+ for (i=0; i <= (ssize_t) wand->index; i++)
clone_wand->graphic_context[i]=
CloneDrawInfo((ImageInfo *) NULL,wand->graphic_context[i]);
clone_wand->filter_off=wand->filter_off;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
assert(affine != (const AffineMatrix *) NULL);
AdjustAffine(wand,affine);
- (void) MvgPrintf(wand,"affine %g,%g,%g,%g,%g,%g\n",affine->sx,affine->rx,
- affine->ry,affine->sy,affine->tx,affine->ty);
+ (void) MvgPrintf(wand,"affine %g,%g,%g,%g,%g,%g\n",
+ affine->sx,affine->rx,affine->ry,affine->sy,affine->tx,affine->ty);
}
\f
/*
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) MvgPrintf(wand,"arc %g,%g %g,%g %g,%g\n",sx,sy,ex,ey,sd,ed);
+ (void) MvgPrintf(wand,"arc %g,%g %g,%g %g,%g\n",sx,sy,ex,
+ ey,sd,ed);
}
\f
/*
% The format of the DrawBezier method is:
%
% void DrawBezier(DrawingWand *wand,
-% const unsigned long number_coordinates,const PointInfo *coordinates)
+% const size_t number_coordinates,const PointInfo *coordinates)
%
% A description of each parameter follows:
%
%
*/
WandExport void DrawBezier(DrawingWand *wand,
- const unsigned long number_coordinates,const PointInfo *coordinates)
+ const size_t number_coordinates,const PointInfo *coordinates)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
register char
*p;
- register long
+ register ssize_t
i;
size_t
char
buffer[MaxTextExtent];
- (void) FormatMagickString(buffer,MaxTextExtent,"%ld bytes",
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g bytes",(double)
(4L*blob_length/3L+4L));
ThrowDrawException(ResourceLimitWarning,"MemoryAllocationFailed",
wand->name);
return(MagickFalse);
}
- mode=MagickOptionToMnemonic(MagickComposeOptions,(long) compose);
+ mode=MagickOptionToMnemonic(MagickComposeOptions,(ssize_t) compose);
media_type=MagickToMime(image->magick);
- (void) MvgPrintf(wand,"image %s %g,%g %g,%g 'data:%s;base64,\n",mode,x,y,
- width,height,media_type);
+ (void) MvgPrintf(wand,"image %s %g,%g %g,%g 'data:%s;base64,\n",
+ mode,x,y,width,height,media_type);
p=base64;
- for (i=(long) encoded_length; i > 0; i-=76)
+ for (i=(ssize_t) encoded_length; i > 0; i-=76)
{
(void) MvgPrintf(wand,"%.76s",p);
p+=76;
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
(void) MvgPrintf(wand,"color %g,%g '%s'\n",x,y,MagickOptionToMnemonic(
- MagickMethodOptions,(long) paint_method));
+ MagickMethodOptions,(ssize_t) paint_method));
}
\f
/*
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) MvgPrintf(wand,"ellipse %g,%g %g,%g %g,%g\n",ox,oy,rx,ry,start,end);
+ (void) MvgPrintf(wand,"ellipse %g,%g %g,%g %g,%g\n",ox,oy,
+ rx,ry,start,end);
}
\f
/*
%
% The format of the DrawGetFontWeight method is:
%
-% unsigned long DrawGetFontWeight(const DrawingWand *wand)
+% size_t DrawGetFontWeight(const DrawingWand *wand)
%
% A description of each parameter follows:
%
% o wand: the drawing wand.
%
*/
-WandExport unsigned long DrawGetFontWeight(const DrawingWand *wand)
+WandExport size_t DrawGetFontWeight(const DrawingWand *wand)
{
assert(wand != (const DrawingWand *) NULL);
assert(wand->signature == WandSignature);
% The format of the DrawGetStrokeDashArray method is:
%
% double *DrawGetStrokeDashArray(const DrawingWand *wand,
-% unsigned long *number_elements)
+% size_t *number_elements)
%
% A description of each parameter follows:
%
%
*/
WandExport double *DrawGetStrokeDashArray(const DrawingWand *wand,
- unsigned long *number_elements)
+ size_t *number_elements)
{
double
*dash_array;
register double
*q;
- register long
+ register ssize_t
i;
- unsigned long
+ size_t
n;
assert(wand != (const DrawingWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- assert(number_elements != (unsigned long *) NULL);
+ assert(number_elements != (size_t *) NULL);
n=0;
p=CurrentContext->dash_pattern;
if (p != (const double *) NULL)
sizeof(*dash_array));
p=CurrentContext->dash_pattern;
q=dash_array;
- for (i=0; i < (long) n; i++)
+ for (i=0; i < (ssize_t) n; i++)
*q++=(*p++);
}
return(dash_array);
%
% The format of the DrawGetStrokeMiterLimit method is:
%
-% unsigned long DrawGetStrokeMiterLimit(const DrawingWand *wand)
+% size_t DrawGetStrokeMiterLimit(const DrawingWand *wand)
%
% A description of each parameter follows:
%
% o wand: the drawing wand.
%
*/
-WandExport unsigned long DrawGetStrokeMiterLimit(const DrawingWand *wand)
+WandExport size_t DrawGetStrokeMiterLimit(const DrawingWand *wand)
{
assert(wand != (const DrawingWand *) NULL);
assert(wand->signature == WandSignature);
% %
% %
% %
+% D r a w G e t T e x t I n t e r L i n e S p a c i n g %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DrawGetTextInterwordSpacing() gets the spacing between lines in text.
+%
+% The format of the DrawSetFontKerning method is:
+%
+% double DrawGetTextInterwordSpacing(DrawingWand *wand)
+%
+% A description of each parameter follows:
+%
+% o wand: the drawing wand.
+%
+*/
+WandExport double DrawGetTextInterlineSpacing(DrawingWand *wand)
+{
+ assert(wand != (DrawingWand *) NULL);
+ assert(wand->signature == WandSignature);
+ if (wand->debug != MagickFalse)
+ (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+ return(CurrentContext->interline_spacing);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% D r a w G e t T e x t I n t e r w o r d S p a c i n g %
% %
% %
MagickPixelPacket
pixel;
- register long
+ register ssize_t
i;
XMLTreeInfo
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(
- MagickClipPathOptions,(long) CurrentContext->clip_units),MaxTextExtent);
+ MagickClipPathOptions,(ssize_t) CurrentContext->clip_units),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"decorate",0);
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(
- MagickDecorateOptions,(long) CurrentContext->decorate),MaxTextExtent);
+ MagickDecorateOptions,(ssize_t) CurrentContext->decorate),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"encoding",0);
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(
- MagickFillRuleOptions,(long) CurrentContext->fill_rule),MaxTextExtent);
+ MagickFillRuleOptions,(ssize_t) CurrentContext->fill_rule),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"font",0);
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(
- MagickStretchOptions,(long) CurrentContext->stretch),MaxTextExtent);
+ MagickStretchOptions,(ssize_t) CurrentContext->stretch),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"font-style",0);
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(
- MagickStyleOptions,(long) CurrentContext->style),MaxTextExtent);
+ MagickStyleOptions,(ssize_t) CurrentContext->style),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"font-weight",0);
if (child != (XMLTreeInfo *) NULL)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
CurrentContext->weight);
(void) SetXMLTreeContent(child,value);
}
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(MagickGravityOptions,
- (long) CurrentContext->gravity),MaxTextExtent);
+ (ssize_t) CurrentContext->gravity),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"stroke",0);
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(MagickLineCapOptions,
- (long) CurrentContext->linecap),MaxTextExtent);
+ (ssize_t) CurrentContext->linecap),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"stroke-linejoin",0);
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(
- MagickLineJoinOptions,(long) CurrentContext->linejoin),MaxTextExtent);
+ MagickLineJoinOptions,(ssize_t) CurrentContext->linejoin),
+ MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"stroke-miterlimit",0);
if (child != (XMLTreeInfo *) NULL)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
CurrentContext->miterlimit);
(void) SetXMLTreeContent(child,value);
}
if (child != (XMLTreeInfo *) NULL)
{
(void) CopyMagickString(value,MagickOptionToMnemonic(MagickAlignOptions,
- (long) CurrentContext->align),MaxTextExtent);
+ (ssize_t) CurrentContext->align),MaxTextExtent);
(void) SetXMLTreeContent(child,value);
}
child=AddChildToXMLTree(xml_info,"text-antialias",0);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
(void) MvgPrintf(wand,"matte %g,%g '%s'\n",x,y,MagickOptionToMnemonic(
- MagickMethodOptions,(long) paint_method));
+ MagickMethodOptions,(ssize_t) paint_method));
}
\f
/*
mode == AbsolutePathMode ? 'C' : 'c',x1,y1,x2,y2,x,y);
}
else
- (void) MvgAutoWrapPrintf(wand," %g,%g %g,%g %g,%g",x1,y1,x2,y2,x,y);
+ (void) MvgAutoWrapPrintf(wand," %g,%g %g,%g %g,%g",x1,y1,
+ x2,y2,x,y);
}
WandExport void DrawPathCurveToAbsolute(DrawingWand *wand,const double x1,
{
wand->path_operation=PathCurveToQuadraticBezierOperation;
wand->path_mode=mode;
- (void) MvgAutoWrapPrintf(wand, "%c%g,%g %g,%g",mode == AbsolutePathMode ?
- 'Q' : 'q',x1,y1,x,y);
+ (void) MvgAutoWrapPrintf(wand, "%c%g,%g %g,%g",
+ mode == AbsolutePathMode ? 'Q' : 'q',x1,y1,x,y);
}
else
(void) MvgAutoWrapPrintf(wand," %g,%g %g,%g",x1,y1,x,y);
{
wand->path_operation=PathCurveToSmoothOperation;
wand->path_mode=mode;
- (void) MvgAutoWrapPrintf(wand,"%c%g,%g %g,%g",mode == AbsolutePathMode ?
- 'S' : 's',x2,y2,x,y);
+ (void) MvgAutoWrapPrintf(wand,"%c%g,%g %g,%g",
+ mode == AbsolutePathMode ? 'S' : 's',x2,y2,x,y);
}
else
(void) MvgAutoWrapPrintf(wand," %g,%g %g,%g",x2,y2,x,y);
large_arc_flag,sweep_flag,x,y);
}
else
- (void) MvgAutoWrapPrintf(wand," %g,%g %g %u %u %g,%g",rx,ry,x_axis_rotation,
- large_arc_flag,sweep_flag,x,y);
+ (void) MvgAutoWrapPrintf(wand," %g,%g %g %u %u %g,%g",rx,ry,
+ x_axis_rotation,large_arc_flag,sweep_flag,x,y);
}
WandExport void DrawPathEllipticArcAbsolute(DrawingWand *wand,const double rx,
% The format of the DrawPolygon method is:
%
% void DrawPolygon(DrawingWand *wand,
-% const unsigned long number_coordinates,const PointInfo *coordinates)
+% const size_t number_coordinates,const PointInfo *coordinates)
%
% A description of each parameter follows:
%
%
*/
WandExport void DrawPolygon(DrawingWand *wand,
- const unsigned long number_coordinates,const PointInfo *coordinates)
+ const size_t number_coordinates,const PointInfo *coordinates)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
% The format of the DrawPolyline method is:
%
% void DrawPolyline(DrawingWand *wand,
-% const unsigned long number_coordinates,const PointInfo *coordinates)
+% const size_t number_coordinates,const PointInfo *coordinates)
%
% A description of each parameter follows:
%
%
*/
WandExport void DrawPolyline(DrawingWand *wand,
- const unsigned long number_coordinates,const PointInfo *coordinates)
+ const size_t number_coordinates,const PointInfo *coordinates)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
}
(void) FormatMagickString(key,MaxTextExtent,"%s",wand->pattern_id);
(void) SetImageArtifact(wand->image,key,wand->mvg+wand->pattern_offset);
- (void) FormatMagickString(geometry,MaxTextExtent,"%lux%lu%+ld%+ld",
- wand->pattern_bounds.width,wand->pattern_bounds.height,
- wand->pattern_bounds.x,wand->pattern_bounds.y);
+ (void) FormatMagickString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
+ (double) wand->pattern_bounds.width,(double) wand->pattern_bounds.height,
+ (double) wand->pattern_bounds.x,(double) wand->pattern_bounds.y);
(void) SetImageArtifact(wand->image,key,geometry);
wand->pattern_id=DestroyString(wand->pattern_id);
wand->pattern_offset=0;
return(MagickFalse);
}
wand->filter_off=MagickTrue;
- (void) MvgPrintf(wand,"push pattern %s %g,%g %g,%g\n",pattern_id,x,y,
- width,height);
+ (void) MvgPrintf(wand,"push pattern %s %g,%g %g,%g\n",pattern_id,
+ x,y,width,height);
wand->indent_depth++;
wand->pattern_id=AcquireString(pattern_id);
- wand->pattern_bounds.x=(long) ceil(x-0.5);
- wand->pattern_bounds.y=(long) ceil(y-0.5);
- wand->pattern_bounds.width=(unsigned long) (width+0.5);
- wand->pattern_bounds.height=(unsigned long) (height+0.5);
+ wand->pattern_bounds.x=(ssize_t) ceil(x-0.5);
+ wand->pattern_bounds.y=(ssize_t) ceil(y-0.5);
+ wand->pattern_bounds.width=(size_t) floor(width+0.5);
+ wand->pattern_bounds.height=(size_t) floor(height+0.5);
wand->pattern_offset=wand->mvg_length;
return(MagickTrue);
}
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) MvgPrintf(wand,"roundrectangle %g,%g %g,%g %g,%g\n",x1,y1,x2,y2,rx,ry);
+ (void) MvgPrintf(wand,"roundrectangle %g,%g %g,%g %g,%g\n",
+ x1,y1,x2,y2,rx,ry);
}
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DrawSetClipPath() associates a named clipping path with the image. Only
-% the areas drawn on by the clipping path will be modified as long as it
+% the areas drawn on by the clipping path will be modified as ssize_t as it
% remains in effect.
%
% The format of the DrawSetClipPath method is:
{
CurrentContext->fill_rule=fill_rule;
(void) MvgPrintf(wand, "clip-rule '%s'\n",MagickOptionToMnemonic(
- MagickFillRuleOptions,(long) fill_rule));
+ MagickFillRuleOptions,(ssize_t) fill_rule));
}
}
\f
AdjustAffine(wand,&affine);
}
(void) MvgPrintf(wand, "clip-units '%s'\n",MagickOptionToMnemonic(
- MagickClipPathOptions,(long) clip_units));
+ MagickClipPathOptions,(ssize_t) clip_units));
}
}
\f
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- opacity=RoundToQuantum((double) QuantumRange*(1.0-fill_opacity));
+ opacity=ClampToQuantum((double) QuantumRange*(1.0-fill_opacity));
if ((wand->filter_off != MagickFalse) ||
(CurrentContext->fill.opacity != opacity))
{
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- quantum_opacity=RoundToQuantum((double) QuantumRange*(1.0-opacity));
+ quantum_opacity=ClampToQuantum((double) QuantumRange*(1.0-opacity));
if ((wand->filter_off != MagickFalse) ||
(CurrentContext->opacity != quantum_opacity))
{
- CurrentContext->opacity=opacity;
+ CurrentContext->opacity=(Quantum) opacity;
(void) MvgPrintf(wand,"opacity %g\n",opacity);
}
}
{
CurrentContext->fill_rule=fill_rule;
(void) MvgPrintf(wand, "fill-rule '%s'\n",MagickOptionToMnemonic(
- MagickFillRuleOptions,(long) fill_rule));
+ MagickFillRuleOptions,(ssize_t) fill_rule));
}
}
\f
{
CurrentContext->stretch=font_stretch;
(void) MvgPrintf(wand, "font-stretch '%s'\n",MagickOptionToMnemonic(
- MagickStretchOptions,(long) font_stretch));
+ MagickStretchOptions,(ssize_t) font_stretch));
}
}
\f
{
CurrentContext->style=style;
(void) MvgPrintf(wand, "font-style '%s'\n",MagickOptionToMnemonic(
- MagickStyleOptions,(long) style));
+ MagickStyleOptions,(ssize_t) style));
}
}
\f
% The format of the DrawSetFontWeight method is:
%
% void DrawSetFontWeight(DrawingWand *wand,
-% const unsigned long font_weight)
+% const size_t font_weight)
%
% A description of each parameter follows:
%
%
*/
WandExport void DrawSetFontWeight(DrawingWand *wand,
- const unsigned long font_weight)
+ const size_t font_weight)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
(CurrentContext->weight != font_weight))
{
CurrentContext->weight=font_weight;
- (void) MvgPrintf(wand,"font-weight %lu\n",font_weight);
+ (void) MvgPrintf(wand,"font-weight %.20g\n",(double) font_weight);
}
}
\f
{
CurrentContext->gravity=gravity;
(void) MvgPrintf(wand,"gravity '%s'\n",MagickOptionToMnemonic(
- MagickGravityOptions,(long) gravity));
+ MagickGravityOptions,(ssize_t) gravity));
}
}
\f
% The format of the DrawSetStrokeDashArray method is:
%
% MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
-% const unsigned long number_elements,const double *dash_array)
+% const size_t number_elements,const double *dash_array)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand,
- const unsigned long number_elements,const double *dash_array)
+ const size_t number_elements,const double *dash_array)
{
MagickBooleanType
update;
register double
*q;
- register long
+ register ssize_t
i;
- unsigned long
+ size_t
n_new,
n_old;
{
p=dash_array;
q=CurrentContext->dash_pattern;
- for (i=0; i < (long) n_new; i++)
+ for (i=0; i < (ssize_t) n_new; i++)
{
if (fabs((*p)-(*q)) > MagickEpsilon)
{
}
q=CurrentContext->dash_pattern;
p=dash_array;
- for (i=0; i < (long) n_new; i++)
+ for (i=0; i < (ssize_t) n_new; i++)
*q++=(*p++);
*q=0;
}
{
p=dash_array;
(void) MvgPrintf(wand,"%g",*p++);
- for (i=1; i < (long) n_new; i++)
+ for (i=1; i < (ssize_t) n_new; i++)
(void) MvgPrintf(wand,",%g",*p++);
(void) MvgPrintf(wand,"\n");
}
{
CurrentContext->linecap=linecap;
(void) MvgPrintf(wand,"stroke-linecap '%s'\n",MagickOptionToMnemonic(
- MagickLineCapOptions,(long) linecap));
+ MagickLineCapOptions,(ssize_t) linecap));
}
}
\f
{
CurrentContext->linejoin=linejoin;
(void) MvgPrintf(wand, "stroke-linejoin '%s'\n",MagickOptionToMnemonic(
- MagickLineJoinOptions,(long) linejoin));
+ MagickLineJoinOptions,(ssize_t) linejoin));
}
}
\f
% The format of the DrawSetStrokeMiterLimit method is:
%
% void DrawSetStrokeMiterLimit(DrawingWand *wand,
-% const unsigned long miterlimit)
+% const size_t miterlimit)
%
% A description of each parameter follows:
%
%
*/
WandExport void DrawSetStrokeMiterLimit(DrawingWand *wand,
- const unsigned long miterlimit)
+ const size_t miterlimit)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
if (CurrentContext->miterlimit != miterlimit)
{
CurrentContext->miterlimit=miterlimit;
- (void) MvgPrintf(wand,"stroke-miterlimit %lu\n",miterlimit);
+ (void) MvgPrintf(wand,"stroke-miterlimit %.20g\n",(double) miterlimit);
}
}
\f
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- opacity=RoundToQuantum((double) QuantumRange*(1.0-stroke_opacity));
+ opacity=ClampToQuantum((double) QuantumRange*(1.0-stroke_opacity));
if ((wand->filter_off != MagickFalse) ||
(CurrentContext->stroke.opacity != opacity))
{
{
CurrentContext->align=alignment;
(void) MvgPrintf(wand,"text-align '%s'\n",MagickOptionToMnemonic(
- MagickAlignOptions,(long) alignment));
+ MagickAlignOptions,(ssize_t) alignment));
}
}
\f
{
CurrentContext->decorate=decoration;
(void) MvgPrintf(wand,"decorate '%s'\n",MagickOptionToMnemonic(
- MagickDecorateOptions,(long) decoration));
+ MagickDecorateOptions,(ssize_t) decoration));
}
}
\f
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if ((wand->filter_off != MagickFalse) &&
+ if ((wand->filter_off != MagickFalse) &&
(CurrentContext->kerning != kerning))
{
CurrentContext->kerning=kerning;
% %
% %
% %
+% D r a w S e t T e x t I n t e r L i n e S p a c i n g %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DrawSetTextInterwordSpacing() sets the spacing between line in text.
+%
+% The format of the DrawSetInterwordSpacing method is:
+%
+% void DrawSetTextInterwordSpacing(DrawingWand *wand,
+% const double interline_spacing)
+%
+% A description of each parameter follows:
+%
+% o wand: the drawing wand.
+%
+% o interline_spacing: text line spacing
+%
+*/
+WandExport void DrawSetTextInterlineSpacing(DrawingWand *wand,
+ const double interline_spacing)
+{
+ assert(wand != (DrawingWand *) NULL);
+ assert(wand->signature == WandSignature);
+
+ if (wand->debug != MagickFalse)
+ (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+ if ((wand->filter_off != MagickFalse) &&
+ (CurrentContext->interline_spacing != interline_spacing))
+ {
+ CurrentContext->interline_spacing=interline_spacing;
+ (void) MvgPrintf(wand,"interline-spacing %lf\n",interline_spacing);
+ }
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% D r a w S e t T e x t I n t e r w o r d S p a c i n g %
% %
% %
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if ((wand->filter_off != MagickFalse) &&
+ if ((wand->filter_off != MagickFalse) &&
(CurrentContext->interword_spacing != interword_spacing))
{
CurrentContext->interword_spacing=interword_spacing;
- (void) MvgPrintf(wand,"interword_spacing %lf\n",interword_spacing);
+ (void) MvgPrintf(wand,"interword-spacing %lf\n",interword_spacing);
}
}
\f
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->fill.opacity=RoundToQuantum((MagickRealType)
- QuantumRange*(1.0-atof(value)));
+ CurrentContext->fill.opacity=ClampToQuantum((MagickRealType)
+ QuantumRange*(1.0-StringToDouble(value)));
}
child=GetXMLTreeChild(xml_info,"fill-rule");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->pointsize=atof(value);
+ CurrentContext->pointsize=StringToDouble(value);
}
child=GetXMLTreeChild(xml_info,"font-stretch");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->weight=(unsigned long) atol(value);
+ CurrentContext->weight=StringToUnsignedLong(value);
}
child=GetXMLTreeChild(xml_info,"gravity");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->stroke_antialias=atol(value) != 0 ? MagickTrue :
+ CurrentContext->stroke_antialias=StringToLong(value) != 0 ? MagickTrue :
MagickFalse;
}
child=GetXMLTreeChild(xml_info,"stroke-dasharray");
const char
*q;
- long
+ ssize_t
j;
- register long
+ register ssize_t
x;
value=GetXMLTreeContent(child);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- CurrentContext->dash_pattern[j]=atof(token);
+ CurrentContext->dash_pattern[j]=StringToDouble(token);
}
if ((x & 0x01) != 0)
for ( ; j < (2*x); j++)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->dash_offset=atof(value);
+ CurrentContext->dash_offset=StringToDouble(value);
}
child=GetXMLTreeChild(xml_info,"stroke-linecap");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->miterlimit=(unsigned long) atol(value);
+ CurrentContext->miterlimit=StringToUnsignedLong(value);
}
child=GetXMLTreeChild(xml_info,"stroke-opacity");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->stroke.opacity=RoundToQuantum((MagickRealType)
- QuantumRange*(1.0-atof(value)));
+ CurrentContext->stroke.opacity=ClampToQuantum((MagickRealType)
+ QuantumRange*(1.0-StringToDouble(value)));
}
child=GetXMLTreeChild(xml_info,"stroke-width");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->stroke_width=atof(value);
+ CurrentContext->stroke_width=StringToDouble(value);
}
child=GetXMLTreeChild(xml_info,"text-align");
if (child != (XMLTreeInfo *) NULL)
{
value=GetXMLTreeContent(child);
if (value != (const char *) NULL)
- CurrentContext->text_antialias=atol(value) != 0 ? MagickTrue :
+ CurrentContext->text_antialias=StringToLong(value) != 0 ? MagickTrue :
MagickFalse;
}
child=GetXMLTreeChild(xml_info,"text-undercolor");
%
% The format of the DrawSetViewbox method is:
%
-% void DrawSetViewbox(DrawingWand *wand,unsigned long x1,
-% unsigned long y1,unsigned long x2,unsigned long y2)
+% void DrawSetViewbox(DrawingWand *wand,size_t x1,
+% size_t y1,size_t x2,size_t y2)
%
% A description of each parameter follows:
%
% o y2: bottom y ordinate
%
*/
-WandExport void DrawSetViewbox(DrawingWand *wand,unsigned long x1,
- unsigned long y1,unsigned long x2,unsigned long y2)
+WandExport void DrawSetViewbox(DrawingWand *wand,ssize_t x1,ssize_t y1,
+ ssize_t x2,ssize_t y2)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) MvgPrintf(wand,"viewbox %lu %lu %lu %lu\n",x1,y1,x2,y2);
+ (void) MvgPrintf(wand,"viewbox %.20g %.20g %.20g %.20g\n",(double) x1,
+ (double) y1,(double) x2,(double) y2);
}
\f
/*
DrawingWand
*wand;
- unsigned long
+ size_t
depth;
quantum=GetMagickQuantumDepth(&depth);
if (depth != MAGICKCORE_QUANTUM_DEPTH)
ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
- wand=(DrawingWand *) AcquireMagickMemory(sizeof(*wand));
+ wand=(DrawingWand *) AcquireAlignedMemory(1,sizeof(*wand));
if (wand == (DrawingWand *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(wand,0,sizeof(*wand));
wand->id=AcquireWandId();
- (void) FormatMagickString(wand->name,MaxTextExtent,"%s-%lu",DrawingWandId,
- wand->id);
+ (void) FormatMagickString(wand->name,MaxTextExtent,"%s-%.20g",DrawingWandId,
+ (double) wand->id);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
wand->mvg=(char *) NULL;
wand->pattern_bounds.width=0;
wand->pattern_bounds.height=0;
wand->index=0;
- wand->graphic_context=(DrawInfo **) AcquireMagickMemory(sizeof(
+ wand->graphic_context=(DrawInfo **) AcquireAlignedMemory(1,sizeof(
*wand->graphic_context));
if (wand->graphic_context == (DrawInfo **) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",