% Read/Write Scalable Vector Graphics Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% William Radcliffe %
% March 2000 %
% %
% %
-% Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 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 declarations.
*/
-#include "magick/studio.h"
-#include "magick/annotate.h"
-#include "magick/artifact.h"
-#include "magick/attribute.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/constitute.h"
-#include "magick/composite-private.h"
-#include "magick/draw.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/gem.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/log.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/quantum-private.h"
-#include "magick/pixel-private.h"
-#include "magick/property.h"
-#include "magick/resource_.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/token.h"
-#include "magick/utility.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/annotate.h"
+#include "MagickCore/artifact.h"
+#include "MagickCore/attribute.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/composite-private.h"
+#include "MagickCore/delegate.h"
+#include "MagickCore/delegate-private.h"
+#include "MagickCore/draw.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/gem.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/log.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/property.h"
+#include "MagickCore/resource_.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
+#include "MagickCore/token.h"
+#include "MagickCore/utility.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
-# if defined(__MINGW32__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
+# if defined(__MINGW32__) || defined(__MINGW64__)
# define _MSC_VER
# else
# include <win32config.h>
#if defined(MAGICKCORE_RSVG_DELEGATE)
#include "librsvg/rsvg.h"
-#if defined(MAGICKCORE_CAIRO_DELEGATE)
+#if !defined(LIBRSVG_CHECK_VERSION)
+#include "librsvg/rsvg-cairo.h"
+#include "librsvg/librsvg-features.h"
+#elif !LIBRSVG_CHECK_VERSION(2,36,2)
#include "librsvg/rsvg-cairo.h"
-#endif
#include "librsvg/librsvg-features.h"
#endif
-\f
-/*
- Define declarations.
-*/
-#define MVGPrintf (void) fprintf
+#endif
\f
/*
Typedef declarations.
AffineMatrix
affine;
- unsigned long
+ size_t
width,
height;
Forward declarations.
*/
static MagickBooleanType
- WriteSVGImage(const ImageInfo *,Image *);
+ WriteSVGImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (svg_info->text != (char *) NULL)
svg_info->text=DestroyString(svg_info->text);
if (svg_info->scale != (double *) NULL)
- svg_info->scale=(double *) (svg_info->scale);
+ svg_info->scale=(double *) RelinquishMagickMemory(svg_info->scale);
if (svg_info->title != (char *) NULL)
svg_info->title=DestroyString(svg_info->title);
if (svg_info->comment != (char *) NULL)
assert(string != (const char *) NULL);
p=(const char *) string;
GetMagickToken(p,&p,token);
- value=atof(token);
+ value=StringToDouble(token,(char **) NULL);
if (strchr(token,'%') != (char *) NULL)
{
double
if (type > 0)
{
if (svg_info->view_box.width == 0.0)
- return(1000.0);
+ return(0.0);
return(svg_info->view_box.width*value/100.0);
}
if (type < 0)
{
if (svg_info->view_box.height == 0.0)
- return(1000.0);
+ return(0.0);
return(svg_info->view_box.height*value/100.0);
}
alpha=value-svg_info->view_box.width;
if (LocaleNCompare(token,"pc",2) == 0)
return(DefaultResolution*svg_info->scale[0]/6.0*value);
if (LocaleNCompare(token,"pt",2) == 0)
- return(svg_info->scale[0]*value);
+ return(1.25*svg_info->scale[0]*value);
if (LocaleNCompare(token,"px",2) == 0)
return(value);
return(value);
*text,
**tokens;
- register long
+ register ssize_t
i;
SVGInfo
*svg_info;
svg_info=(SVGInfo *) context;
+ (void) svg_info;
*number_tokens=0;
if (style == (const char *) NULL)
return((char **) NULL);
*p,
*q;
- register long
+ register ssize_t
i;
SVGInfo
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.setDocumentLocator()");
svg_info=(SVGInfo *) context;
+ (void) svg_info;
}
static void SVGStartDocument(void *context)
SVGInfo
*svg_info;
- register long
+ register ssize_t
i,
j;
break;
}
}
+ if (strchr((char *) name,':') != (char *) NULL)
+ {
+ /*
+ Skip over namespace.
+ */
+ for ( ; *name != ':'; name++) ;
+ name++;
+ }
switch (*name)
{
case 'C':
{
if (LocaleCompare((const char *) name,"circle") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"clipPath") == 0)
{
- MVGPrintf(svg_info->file,"push clip-path '%s'\n",id);
+ (void) FormatLocaleFile(svg_info->file,"push clip-path '%s'\n",id);
break;
}
break;
{
if (LocaleCompare((const char *) name,"defs") == 0)
{
- MVGPrintf(svg_info->file,"push defs\n");
+ (void) FormatLocaleFile(svg_info->file,"push defs\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"ellipse") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"g") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"image") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"line") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"linearGradient") == 0)
{
- MVGPrintf(svg_info->file,"push gradient '%s' linear %g,%g %g,%g\n",id,
+ (void) FormatLocaleFile(svg_info->file,
+ "push gradient '%s' linear %g,%g %g,%g\n",id,
svg_info->segment.x1,svg_info->segment.y1,svg_info->segment.x2,
svg_info->segment.y2);
break;
{
if (LocaleCompare((const char *) name,"path") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"pattern") == 0)
{
- MVGPrintf(svg_info->file,"push pattern '%s' %g,%g %g,%g\n",id,
+ (void) FormatLocaleFile(svg_info->file,
+ "push pattern '%s' %g,%g %g,%g\n",id,
svg_info->bounds.x,svg_info->bounds.y,svg_info->bounds.width,
svg_info->bounds.height);
break;
}
if (LocaleCompare((const char *) name,"polygon") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"polyline") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"radialGradient") == 0)
{
- MVGPrintf(svg_info->file,"push gradient '%s' radial %g,%g %g,%g %g\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "push gradient '%s' radial %g,%g %g,%g %g\n",
id,svg_info->element.cx,svg_info->element.cy,
svg_info->element.major,svg_info->element.minor,
svg_info->element.angle);
}
if (LocaleCompare((const char *) name,"rect") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"svg") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"text") == 0)
{
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
+ svg_info->bounds.x=0.0;
+ svg_info->bounds.y=0.0;
+ svg_info->bounds.width=0.0;
+ svg_info->bounds.height=0.0;
break;
}
if (LocaleCompare((const char *) name,"tspan") == 0)
*text;
text=EscapeString(svg_info->text,'\'');
- MVGPrintf(svg_info->file,"text %g,%g '%s'\n",svg_info->bounds.x-
- svg_info->center.x,svg_info->bounds.y-svg_info->center.y,text);
+ (void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
+ svg_info->bounds.x-svg_info->center.x,svg_info->bounds.y-
+ svg_info->center.y,text);
text=DestroyString(text);
draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL);
draw_info->pointsize=svg_info->pointsize;
draw_info->text=AcquireString(svg_info->text);
(void) ConcatenateString(&draw_info->text," ");
- GetTypeMetrics(svg_info->image,draw_info,&metrics);
+ (void) GetTypeMetrics(svg_info->image,draw_info,
+ &metrics,svg_info->exception);
svg_info->bounds.x+=metrics.width;
draw_info=DestroyDrawInfo(draw_info);
*svg_info->text='\0';
}
- MVGPrintf(svg_info->file,"push graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
{
if (LocaleCompare(keyword,"angle") == 0)
{
- MVGPrintf(svg_info->file,"angle %g\n",
+ (void) FormatLocaleFile(svg_info->file,"angle %g\n",
GetUserSpaceCoordinateValue(svg_info,0,value));
break;
}
{
if (LocaleCompare(keyword,"clip-path") == 0)
{
- MVGPrintf(svg_info->file,"clip-path '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"clip-path '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clip-rule") == 0)
{
- MVGPrintf(svg_info->file,"clip-rule '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"clip-rule '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clipPathUnits") == 0)
{
(void) CloneString(&units,value);
- MVGPrintf(svg_info->file,"clip-units '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"clip-units '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"color") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
- MVGPrintf(svg_info->file,"fill '%s'\n",color);
+ (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",color);
break;
}
- MVGPrintf(svg_info->file,"fill '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"fillcolor") == 0)
{
- MVGPrintf(svg_info->file,"fill '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"fill-rule") == 0)
{
- MVGPrintf(svg_info->file,"fill-rule '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"fill-rule '%s'\n",value);
break;
}
- if (LocaleCompare(keyword,"fill-opacity") == 0)
+ if (LocaleCompare(keyword,"fill-alpha") == 0)
{
- MVGPrintf(svg_info->file,"fill-opacity '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"fill-alpha '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"font-family") == 0)
{
- MVGPrintf(svg_info->file,"font-family '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"font-family '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"font-stretch") == 0)
{
- MVGPrintf(svg_info->file,"font-stretch '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"font-stretch '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"font-style") == 0)
{
- MVGPrintf(svg_info->file,"font-style '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"font-style '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-size") == 0)
{
svg_info->pointsize=GetUserSpaceCoordinateValue(svg_info,0,value);
- MVGPrintf(svg_info->file,"font-size %g\n",svg_info->pointsize);
+ (void) FormatLocaleFile(svg_info->file,"font-size %g\n",
+ svg_info->pointsize);
break;
}
if (LocaleCompare(keyword,"font-weight") == 0)
{
- MVGPrintf(svg_info->file,"font-weight '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"font-weight '%s'\n",
+ value);
break;
}
break;
{
p=(const char *) value;
GetMagickToken(p,&p,token);
- affine.sx=atof(value);
+ affine.sx=StringToDouble(value,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.rx=atof(token);
+ affine.rx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.ry=atof(token);
+ affine.ry=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.sy=atof(token);
+ affine.sy=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.tx=atof(token);
+ affine.tx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.ty=atof(token);
+ affine.ty=StringToDouble(token,(char **) NULL);
break;
}
break;
default:
break;
}
- transform.sx=current.sx*affine.sx+current.ry*affine.rx;
- transform.rx=current.rx*affine.sx+current.sy*affine.rx;
- transform.ry=current.sx*affine.ry+current.ry*affine.sy;
- transform.sy=current.rx*affine.ry+current.sy*affine.sy;
- transform.tx=current.sx*affine.tx+current.ry*affine.ty+
+ transform.sx=affine.sx*current.sx+affine.ry*current.rx;
+ transform.rx=affine.rx*current.sx+affine.sy*current.rx;
+ transform.ry=affine.sx*current.ry+affine.ry*current.sy;
+ transform.sy=affine.rx*current.ry+affine.sy*current.sy;
+ transform.tx=affine.tx*current.sx+affine.ty*current.ry+
current.tx;
- transform.ty=current.rx*affine.tx+current.sy*affine.ty+
+ transform.ty=affine.tx*current.rx+affine.ty*current.sy+
current.ty;
}
- MVGPrintf(svg_info->file,"affine %g %g %g %g %g %g\n",
- transform.sx,transform.rx,transform.ry,transform.sy,
- transform.tx,transform.ty);
+ (void) FormatLocaleFile(svg_info->file,
+ "affine %g %g %g %g %g %g\n",transform.sx,
+ transform.rx,transform.ry,transform.sy,transform.tx,
+ transform.ty);
for (j=0; tokens[j] != (char *) NULL; j++)
tokens[j]=DestroyString(tokens[j]);
tokens=(char **) RelinquishMagickMemory(tokens);
if (LocaleCompare(keyword,"gradientUnits") == 0)
{
(void) CloneString(&units,value);
- MVGPrintf(svg_info->file,"gradient-units '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"gradient-units '%s'\n",
+ value);
break;
}
break;
}
if (LocaleCompare(keyword,"opacity") == 0)
{
- MVGPrintf(svg_info->file,"opacity '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"opacity '%s'\n",value);
break;
}
break;
angle;
angle=GetUserSpaceCoordinateValue(svg_info,0,value);
- MVGPrintf(svg_info->file,"translate %g,%g\n",svg_info->bounds.x,
- svg_info->bounds.y);
+ (void) FormatLocaleFile(svg_info->file,"translate %g,%g\n",
+ svg_info->bounds.x,svg_info->bounds.y);
svg_info->bounds.x=0;
svg_info->bounds.y=0;
- MVGPrintf(svg_info->file,"rotate %g\n",angle);
+ (void) FormatLocaleFile(svg_info->file,"rotate %g\n",angle);
break;
}
if (LocaleCompare(keyword,"rx") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
- MVGPrintf(svg_info->file,"stroke '%s'\n",color);
+ (void) FormatLocaleFile(svg_info->file,"stroke '%s'\n",color);
break;
}
- MVGPrintf(svg_info->file,"stroke '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-antialiasing") == 0)
{
- MVGPrintf(svg_info->file,"stroke-antialias %d\n",
+ (void) FormatLocaleFile(svg_info->file,"stroke-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
if (LocaleCompare(keyword,"stroke-dasharray") == 0)
{
- MVGPrintf(svg_info->file,"stroke-dasharray %s\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke-dasharray %s\n",
+ value);
break;
}
if (LocaleCompare(keyword,"stroke-dashoffset") == 0)
{
- MVGPrintf(svg_info->file,"stroke-dashoffset %s\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke-dashoffset %s\n",
+ value);
break;
}
if (LocaleCompare(keyword,"stroke-linecap") == 0)
{
- MVGPrintf(svg_info->file,"stroke-linecap '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke-linecap '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"stroke-linejoin") == 0)
{
- MVGPrintf(svg_info->file,"stroke-linejoin '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke-linejoin '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"stroke-miterlimit") == 0)
{
- MVGPrintf(svg_info->file,"stroke-miterlimit '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke-miterlimit '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"stroke-opacity") == 0)
{
- MVGPrintf(svg_info->file,"stroke-opacity '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"stroke-opacity '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"stroke-width") == 0)
{
- MVGPrintf(svg_info->file,"stroke-width %g\n",
+ (void) FormatLocaleFile(svg_info->file,"stroke-width %g\n",
GetUserSpaceCoordinateValue(svg_info,1,value));
break;
}
{
if (LocaleCompare(keyword,"clip-path") == 0)
{
- MVGPrintf(svg_info->file,"clip-path '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "clip-path '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clip-rule") == 0)
{
- MVGPrintf(svg_info->file,"clip-rule '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "clip-rule '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clipPathUnits") == 0)
{
(void) CloneString(&units,value);
- MVGPrintf(svg_info->file,"clip-units '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "clip-units '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"color") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
- MVGPrintf(svg_info->file,"fill '%s'\n",color);
+ (void) FormatLocaleFile(svg_info->file,
+ "fill '%s'\n",color);
break;
}
- if (LocaleCompare(value,"#00000000") == 0)
- MVGPrintf(svg_info->file,"fill '#000000'\n");
+ if (LocaleCompare(value,"#000000ff") == 0)
+ (void) FormatLocaleFile(svg_info->file,
+ "fill '#000000'\n");
else
- MVGPrintf(svg_info->file,"fill '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"fillcolor") == 0)
{
- MVGPrintf(svg_info->file,"fill '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"fill-rule") == 0)
{
- MVGPrintf(svg_info->file,"fill-rule '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "fill-rule '%s'\n",value);
break;
}
- if (LocaleCompare(keyword,"fill-opacity") == 0)
+ if (LocaleCompare(keyword,"fill-alpha") == 0)
{
- MVGPrintf(svg_info->file,"fill-opacity '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "fill-alpha '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-family") == 0)
{
- MVGPrintf(svg_info->file,"font-family '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "font-family '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-stretch") == 0)
{
- MVGPrintf(svg_info->file,"font-stretch '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "font-stretch '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-style") == 0)
{
- MVGPrintf(svg_info->file,"font-style '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "font-style '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-size") == 0)
{
svg_info->pointsize=GetUserSpaceCoordinateValue(
svg_info,0,value);
- MVGPrintf(svg_info->file,"font-size %g\n",
+ (void) FormatLocaleFile(svg_info->file,"font-size %g\n",
svg_info->pointsize);
break;
}
if (LocaleCompare(keyword,"font-weight") == 0)
{
- MVGPrintf(svg_info->file,"font-weight '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "font-weight '%s'\n",value);
break;
}
break;
{
if (LocaleCompare(keyword,"offset") == 0)
{
- MVGPrintf(svg_info->file,"offset %g\n",
+ (void) FormatLocaleFile(svg_info->file,"offset %g\n",
GetUserSpaceCoordinateValue(svg_info,1,value));
break;
}
if (LocaleCompare(keyword,"opacity") == 0)
{
- MVGPrintf(svg_info->file,"opacity '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "opacity '%s'\n",value);
break;
}
break;
{
if (LocaleCompare(value,"currentColor") == 0)
{
- MVGPrintf(svg_info->file,"stroke '%s'\n",color);
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke '%s'\n",color);
break;
}
- if (LocaleCompare(value,"#00000000") == 0)
- MVGPrintf(svg_info->file,"fill '#000000'\n");
+ if (LocaleCompare(value,"#000000ff") == 0)
+ (void) FormatLocaleFile(svg_info->file,
+ "fill '#000000'\n");
else
- MVGPrintf(svg_info->file,"stroke '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-antialiasing") == 0)
{
- MVGPrintf(svg_info->file,"stroke-antialias %d\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
if (LocaleCompare(keyword,"stroke-dasharray") == 0)
{
- MVGPrintf(svg_info->file,"stroke-dasharray %s\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-dasharray %s\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-dashoffset") == 0)
{
- MVGPrintf(svg_info->file,"stroke-dashoffset %s\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-dashoffset %s\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-linecap") == 0)
{
- MVGPrintf(svg_info->file,"stroke-linecap '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-linecap '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-linejoin") == 0)
{
- MVGPrintf(svg_info->file,"stroke-linejoin '%s'\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-linejoin '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-miterlimit") == 0)
{
- MVGPrintf(svg_info->file,"stroke-miterlimit '%s'\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-miterlimit '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-opacity") == 0)
{
- MVGPrintf(svg_info->file,"stroke-opacity '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-opacity '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-width") == 0)
{
- MVGPrintf(svg_info->file,"stroke-width %g\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "stroke-width %g\n",
GetUserSpaceCoordinateValue(svg_info,1,value));
break;
}
{
if (LocaleCompare(keyword,"text-align") == 0)
{
- MVGPrintf(svg_info->file,"text-align '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "text-align '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"text-anchor") == 0)
{
- MVGPrintf(svg_info->file,"text-anchor '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,
+ "text-anchor '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"text-decoration") == 0)
{
if (LocaleCompare(value,"underline") == 0)
- MVGPrintf(svg_info->file,"decorate underline\n");
+ (void) FormatLocaleFile(svg_info->file,
+ "decorate underline\n");
if (LocaleCompare(value,"line-through") == 0)
- MVGPrintf(svg_info->file,"decorate line-through\n");
+ (void) FormatLocaleFile(svg_info->file,
+ "decorate line-through\n");
if (LocaleCompare(value,"overline") == 0)
- MVGPrintf(svg_info->file,"decorate overline\n");
+ (void) FormatLocaleFile(svg_info->file,
+ "decorate overline\n");
break;
}
if (LocaleCompare(keyword,"text-antialiasing") == 0)
{
- MVGPrintf(svg_info->file,"text-antialias %d\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "text-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
{
if (LocaleCompare(keyword,"text-align") == 0)
{
- MVGPrintf(svg_info->file,"text-align '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"text-align '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"text-anchor") == 0)
{
- MVGPrintf(svg_info->file,"text-anchor '%s'\n",value);
+ (void) FormatLocaleFile(svg_info->file,"text-anchor '%s'\n",
+ value);
break;
}
if (LocaleCompare(keyword,"text-decoration") == 0)
{
if (LocaleCompare(value,"underline") == 0)
- MVGPrintf(svg_info->file,"decorate underline\n");
+ (void) FormatLocaleFile(svg_info->file,"decorate underline\n");
if (LocaleCompare(value,"line-through") == 0)
- MVGPrintf(svg_info->file,"decorate line-through\n");
+ (void) FormatLocaleFile(svg_info->file,
+ "decorate line-through\n");
if (LocaleCompare(value,"overline") == 0)
- MVGPrintf(svg_info->file,"decorate overline\n");
+ (void) FormatLocaleFile(svg_info->file,"decorate overline\n");
break;
}
if (LocaleCompare(keyword,"text-antialiasing") == 0)
{
- MVGPrintf(svg_info->file,"text-antialias %d\n",
+ (void) FormatLocaleFile(svg_info->file,"text-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
{
p=(const char *) value;
GetMagickToken(p,&p,token);
- affine.sx=atof(value);
+ affine.sx=StringToDouble(value,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.rx=atof(token);
+ affine.rx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.ry=atof(token);
+ affine.ry=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.sy=atof(token);
+ affine.sy=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.tx=atof(token);
+ affine.tx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- affine.ty=atof(token);
+ affine.ty=StringToDouble(token,(char **) NULL);
break;
}
break;
p=(const char *) value;
GetMagickToken(p,&p,token);
- angle=atof(value);
+ angle=StringToDouble(value,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- x=atof(token);
+ x=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- y=atof(token);
+ y=StringToDouble(token,(char **) NULL);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
default:
break;
}
- transform.sx=current.sx*affine.sx+current.ry*affine.rx;
- transform.rx=current.rx*affine.sx+current.sy*affine.rx;
- transform.ry=current.sx*affine.ry+current.ry*affine.sy;
- transform.sy=current.rx*affine.ry+current.sy*affine.sy;
- transform.tx=current.sx*affine.tx+current.ry*affine.ty+
+ transform.sx=affine.sx*current.sx+affine.ry*current.rx;
+ transform.rx=affine.rx*current.sx+affine.sy*current.rx;
+ transform.ry=affine.sx*current.ry+affine.ry*current.sy;
+ transform.sy=affine.rx*current.ry+affine.sy*current.sy;
+ transform.tx=affine.tx*current.sx+affine.ty*current.ry+
current.tx;
- transform.ty=current.rx*affine.tx+current.sy*affine.ty+
+ transform.ty=affine.tx*current.rx+affine.ty*current.sy+
current.ty;
}
- MVGPrintf(svg_info->file,"affine %g %g %g %g %g %g\n",
- transform.sx,transform.rx,transform.ry,transform.sy,
- transform.tx,transform.ty);
+ (void) FormatLocaleFile(svg_info->file,
+ "affine %g %g %g %g %g %g\n",transform.sx,transform.rx,
+ transform.ry,transform.sy,transform.tx,transform.ty);
for (j=0; tokens[j] != (char *) NULL; j++)
tokens[j]=DestroyString(tokens[j]);
tokens=(char **) RelinquishMagickMemory(tokens);
{
p=(const char *) value;
GetMagickToken(p,&p,token);
- svg_info->view_box.x=atof(token);
+ svg_info->view_box.x=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- svg_info->view_box.y=atof(token);
+ svg_info->view_box.y=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- svg_info->view_box.width=atof(token);
+ svg_info->view_box.width=StringToDouble(token,
+ (char **) NULL);
if (svg_info->bounds.width == 0)
svg_info->bounds.width=svg_info->view_box.width;
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
- svg_info->view_box.height=atof(token);
+ svg_info->view_box.height=StringToDouble(token,
+ (char **) NULL);
if (svg_info->bounds.height == 0)
svg_info->bounds.height=svg_info->view_box.height;
break;
if (LocaleCompare((const char *) name,"svg") == 0)
{
if (svg_info->document->encoding != (const xmlChar *) NULL)
- MVGPrintf(svg_info->file,"encoding \"%s\"\n",
+ (void) FormatLocaleFile(svg_info->file,"encoding \"%s\"\n",
(const char *) svg_info->document->encoding);
if (attributes != (const xmlChar **) NULL)
{
double
sx,
- sy;
+ sy,
+ tx,
+ ty;
if ((svg_info->view_box.width == 0.0) ||
(svg_info->view_box.height == 0.0))
svg_info->view_box=svg_info->bounds;
- svg_info->width=(unsigned long) (svg_info->bounds.width+0.5);
- svg_info->height=(unsigned long) (svg_info->bounds.height+0.5);
- MVGPrintf(svg_info->file,"viewbox 0 0 %lu %lu\n",svg_info->width,
- svg_info->height);
+ svg_info->width=(size_t) floor(svg_info->bounds.width+0.5);
+ svg_info->height=(size_t) floor(svg_info->bounds.height+0.5);
+ (void) FormatLocaleFile(svg_info->file,"viewbox 0 0 %.20g %.20g\n",
+ (double) svg_info->width,(double) svg_info->height);
sx=(double) svg_info->width/svg_info->view_box.width;
sy=(double) svg_info->height/svg_info->view_box.height;
- MVGPrintf(svg_info->file,"affine %g 0 0 %g 0.0 0.0\n",sx,sy);
+ tx=svg_info->view_box.x != 0.0 ? (double) -sx*svg_info->view_box.x :
+ 0.0;
+ ty=svg_info->view_box.y != 0.0 ? (double) -sy*svg_info->view_box.y :
+ 0.0;
+ (void) FormatLocaleFile(svg_info->file,"affine %g 0 0 %g %g %g\n",
+ sx,sy,tx,ty);
}
}
(void) LogMagickEvent(CoderEvent,GetMagickModule()," )");
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.endElement(%s)",name);
svg_info=(SVGInfo *) context;
+ if (strchr((char *) name,':') != (char *) NULL)
+ {
+ /*
+ Skip over namespace.
+ */
+ for ( ; *name != ':'; name++) ;
+ name++;
+ }
switch (*name)
{
case 'C':
{
if (LocaleCompare((const char *) name,"circle") == 0)
{
- MVGPrintf(svg_info->file,"circle %g,%g %g,%g\n",svg_info->element.cx,
- svg_info->element.cy,svg_info->element.cx,svg_info->element.cy+
- svg_info->element.minor);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"circle %g,%g %g,%g\n",
+ svg_info->element.cx,svg_info->element.cy,svg_info->element.cx,
+ svg_info->element.cy+svg_info->element.minor);
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"clipPath") == 0)
{
- MVGPrintf(svg_info->file,"pop clip-path\n");
+ (void) FormatLocaleFile(svg_info->file,"pop clip-path\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"defs") == 0)
{
- MVGPrintf(svg_info->file,"pop defs\n");
+ (void) FormatLocaleFile(svg_info->file,"pop defs\n");
break;
}
if (LocaleCompare((const char *) name,"desc") == 0)
angle;
angle=svg_info->element.angle;
- MVGPrintf(svg_info->file,"ellipse %g,%g %g,%g 0,360\n",
+ (void) FormatLocaleFile(svg_info->file,"ellipse %g,%g %g,%g 0,360\n",
svg_info->element.cx,svg_info->element.cy,
angle == 0.0 ? svg_info->element.major : svg_info->element.minor,
angle == 0.0 ? svg_info->element.minor : svg_info->element.major);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"g") == 0)
{
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"image") == 0)
{
- MVGPrintf(svg_info->file,"image Over %g,%g %g,%g '%s'\n",
- svg_info->bounds.x,svg_info->bounds.y,svg_info->bounds.width,
- svg_info->bounds.height,svg_info->url);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,
+ "image Over %g,%g %g,%g '%s'\n",svg_info->bounds.x,
+ svg_info->bounds.y,svg_info->bounds.width,svg_info->bounds.height,
+ svg_info->url);
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"line") == 0)
{
- MVGPrintf(svg_info->file,"line %g,%g %g,%g\n",svg_info->segment.x1,
- svg_info->segment.y1,svg_info->segment.x2,svg_info->segment.y2);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"line %g,%g %g,%g\n",
+ svg_info->segment.x1,svg_info->segment.y1,svg_info->segment.x2,
+ svg_info->segment.y2);
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"linearGradient") == 0)
{
- MVGPrintf(svg_info->file,"pop gradient\n");
+ (void) FormatLocaleFile(svg_info->file,"pop gradient\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"pattern") == 0)
{
- MVGPrintf(svg_info->file,"pop pattern\n");
+ (void) FormatLocaleFile(svg_info->file,"pop pattern\n");
break;
}
if (LocaleCompare((const char *) name,"path") == 0)
{
- MVGPrintf(svg_info->file,"path '%s'\n",svg_info->vertices);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"path '%s'\n",
+ svg_info->vertices);
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"polygon") == 0)
{
- MVGPrintf(svg_info->file,"polygon %s\n",svg_info->vertices);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"polygon %s\n",
+ svg_info->vertices);
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"polyline") == 0)
{
- MVGPrintf(svg_info->file,"polyline %s\n",svg_info->vertices);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"polyline %s\n",
+ svg_info->vertices);
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"radialGradient") == 0)
{
- MVGPrintf(svg_info->file,"pop gradient\n");
+ (void) FormatLocaleFile(svg_info->file,"pop gradient\n");
break;
}
if (LocaleCompare((const char *) name,"rect") == 0)
{
if ((svg_info->radius.x == 0.0) && (svg_info->radius.y == 0.0))
{
- MVGPrintf(svg_info->file,"rectangle %g,%g %g,%g\n",
+ (void) FormatLocaleFile(svg_info->file,"rectangle %g,%g %g,%g\n",
svg_info->bounds.x,svg_info->bounds.y,
svg_info->bounds.x+svg_info->bounds.width,
svg_info->bounds.y+svg_info->bounds.height);
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (svg_info->radius.x == 0.0)
svg_info->radius.x=svg_info->radius.y;
if (svg_info->radius.y == 0.0)
svg_info->radius.y=svg_info->radius.x;
- MVGPrintf(svg_info->file,"roundRectangle %g,%g %g,%g %g,%g\n",
+ (void) FormatLocaleFile(svg_info->file,
+ "roundRectangle %g,%g %g,%g %g,%g\n",
svg_info->bounds.x,svg_info->bounds.y,svg_info->bounds.x+
svg_info->bounds.width,svg_info->bounds.y+svg_info->bounds.height,
svg_info->radius.x,svg_info->radius.y);
svg_info->radius.x=0.0;
svg_info->radius.y=0.0;
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
break;
{
if (LocaleCompare((const char *) name,"stop") == 0)
{
- MVGPrintf(svg_info->file,"stop-color '%s' %s\n",svg_info->stop_color,
- svg_info->offset);
+ (void) FormatLocaleFile(svg_info->file,"stop-color '%s' %s\n",
+ svg_info->stop_color,svg_info->offset);
break;
}
if (LocaleCompare((const char *) name,"svg") == 0)
{
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
break;
*text;
text=EscapeString(svg_info->text,'\'');
- StripString(text);
- MVGPrintf(svg_info->file,"text %g,%g '%s'\n",svg_info->bounds.x-
- svg_info->center.x,svg_info->bounds.y-svg_info->center.y,text);
+ (void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
+ svg_info->bounds.x,svg_info->bounds.y,text);
text=DestroyString(text);
*svg_info->text='\0';
}
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"tspan") == 0)
*text;
text=EscapeString(svg_info->text,'\'');
- StripString(text);
- MVGPrintf(svg_info->file,"text %g,%g '%s'\n",svg_info->bounds.x,
- svg_info->bounds.y,text);
+ (void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
+ svg_info->bounds.x,svg_info->bounds.y,text);
text=DestroyString(text);
draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL);
draw_info->pointsize=svg_info->pointsize;
draw_info->text=AcquireString(svg_info->text);
(void) ConcatenateString(&draw_info->text," ");
- GetTypeMetrics(svg_info->image,draw_info,&metrics);
+ (void) GetTypeMetrics(svg_info->image,draw_info,&metrics,
+ svg_info->exception);
svg_info->bounds.x+=metrics.width;
draw_info=DestroyDrawInfo(draw_info);
*svg_info->text='\0';
}
- MVGPrintf(svg_info->file,"pop graphic-context\n");
+ (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"title") == 0)
static void SVGCharacters(void *context,const xmlChar *c,int length)
{
+ char
+ *text;
+
register char
*p;
- register long
+ register ssize_t
i;
SVGInfo
Receiving some characters from the parser.
*/
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " SAX.characters(%s,%lu)",c,(unsigned long) length);
+ " SAX.characters(%s,%.20g)",c,(double) length);
svg_info=(SVGInfo *) context;
- if (svg_info->text != (char *) NULL)
- svg_info->text=(char *) ResizeQuantumMemory(svg_info->text,
- strlen(svg_info->text)+length+MaxTextExtent,sizeof(*svg_info->text));
- else
- {
- svg_info->text=(char *) AcquireQuantumMemory(length+MaxTextExtent,
- sizeof(*svg_info->text));
- if (svg_info->text != (char *) NULL)
- *svg_info->text='\0';
- }
- if (svg_info->text == (char *) NULL)
+ text=(char *) AcquireQuantumMemory(length+1,sizeof(*text));
+ if (text == (char *) NULL)
return;
- p=svg_info->text+strlen(svg_info->text);
- for (i=0; i < (long) length; i++)
+ p=text;
+ for (i=0; i < (ssize_t) length; i++)
*p++=c[i];
*p='\0';
+ StripString(text);
+ if (svg_info->text == (char *) NULL)
+ svg_info->text=text;
+ else
+ {
+ (void) ConcatenateString(&svg_info->text,text);
+ text=DestroyString(text);
+ }
}
static void SVGReference(void *context,const xmlChar *name)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.ignorableWhitespace(%.30s, %d)",c,length);
svg_info=(SVGInfo *) context;
+ (void) svg_info;
}
static void SVGProcessingInstructions(void *context,const xmlChar *target,
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" SAX.processingInstruction(%s, %s)",target,data);
svg_info=(SVGInfo *) context;
+ (void) svg_info;
}
static void SVGComment(void *context,const xmlChar *value)
parser->inputTab=parser_context.inputTab;
}
-#if defined(MAGICKCORE_RSVG_DELEGATE)
-#if !defined(MAGICKCORE_CAIRO_DELEGATE)
-static void SVGSetImageSize(int *width,int *height,gpointer context)
-{
- Image
- *image;
-
- image=(Image *) context;
- *width=(int) (*width*image->x_resolution/72.0);
- *height=(int) (*height*image->y_resolution/72.0);
-}
-#endif
-#endif
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
+/*
+ Static declarations.
+*/
+static char
+ SVGDensityGeometry[] = "90.0x90.0";
+\f
+
static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
status,
unique_file;
- long
+ ssize_t
n;
SVGInfo
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
+ if ((image->resolution.x == 0.0) || (image->resolution.y == 0.0))
+ {
+ GeometryInfo
+ geometry_info;
+
+ int
+ flags;
+
+ flags=ParseGeometry(SVGDensityGeometry,&geometry_info);
+ image->resolution.x=geometry_info.rho;
+ image->resolution.y=geometry_info.sigma;
+ if ((flags & SigmaValue) == 0)
+ image->resolution.y=image->resolution.x;
+ }
if (LocaleCompare(image_info->magick,"MSVG") != 0)
{
+ const DelegateInfo
+ *delegate_info;
+
+ delegate_info=GetDelegateInfo("svg:decode",(char *) NULL,exception);
+ if (delegate_info != (const DelegateInfo *) NULL)
+ {
+ char
+ background[MaxTextExtent],
+ command[MaxTextExtent],
+ density[MaxTextExtent],
+ filename[MaxTextExtent],
+ opacity[MaxTextExtent],
+ unique[MaxTextExtent];
+
+ int
+ status;
+
+ /*
+ Our best hope for compliance to the SVG standard.
+ */
+ (void) AcquireUniqueFilename(filename);
+ (void) AcquireUniqueFilename(unique);
+ (void) FormatLocaleString(density,MaxTextExtent,"%.20g,%.20g",
+ image->resolution.x,image->resolution.y);
+ (void) FormatLocaleString(background,MaxTextExtent,
+ "rgb(%.20g%%,%.20g%%,%.20g%%)",
+ 100.0*QuantumScale*image->background_color.red,
+ 100.0*QuantumScale*image->background_color.green,
+ 100.0*QuantumScale*image->background_color.blue);
+ (void) FormatLocaleString(opacity,MaxTextExtent,"%.20g",
+ QuantumScale*image->background_color.alpha);
+ (void) FormatLocaleString(command,MaxTextExtent,
+ GetDelegateCommands(delegate_info),image->filename,filename,density,
+ background,opacity,unique);
+ status=SystemCommand(MagickFalse,image_info->verbose,command,
+ exception);
+ (void) RelinquishUniqueFileResource(unique);
+ if (status == 0)
+ {
+ ImageInfo
+ *read_info;
+
+ read_info=CloneImageInfo(image_info);
+ (void) CopyMagickString(read_info->filename,filename,
+ MaxTextExtent);
+ image=ReadImage(read_info,exception);
+ read_info=DestroyImageInfo(read_info);
+ (void) RelinquishUniqueFileResource(filename);
+ if (image != (Image *) NULL)
+ return(image);
+ }
+ (void) RelinquishUniqueFileResource(filename);
+ }
+ {
#if defined(MAGICKCORE_RSVG_DELEGATE)
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- cairo_surface_t
- *cairo_surface;
+ cairo_surface_t
+ *cairo_surface;
- cairo_t
- *cairo_info;
+ cairo_t
+ *cairo_image;
- register unsigned char
- *p;
+ MemoryInfo
+ *pixel_info;
+
+ register unsigned char
+ *p;
- RsvgDimensionData
- dimension_info;
+ RsvgDimensionData
+ dimension_info;
- unsigned char
- *pixels;
+ unsigned char
+ *pixels;
#else
- GdkPixbuf
- *pixel_info;
+ GdkPixbuf
+ *pixel_buffer;
- register const guchar
- *p;
+ register const guchar
+ *p;
#endif
- GError
- *error;
+ GError
+ *error;
- long
- y;
+ ssize_t
+ y;
- PixelPacket
- fill_color;
+ PixelInfo
+ fill_color;
- register long
- x;
+ register ssize_t
+ x;
- register PixelPacket
- *q;
+ register Quantum
+ *q;
- RsvgHandle
- *svg_handle;
+ RsvgHandle
+ *svg_handle;
- svg_handle=rsvg_handle_new();
- if (svg_handle == (RsvgHandle *) NULL)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- rsvg_handle_set_base_uri(svg_handle,image_info->filename);
-#if !defined(MAGICKCORE_CAIRO_DELEGATE)
- rsvg_handle_set_size_callback(svg_handle,SVGSetImageSize,image,NULL);
-#endif
- if ((image->x_resolution != 72.0) && (image->y_resolution != 72.0))
- rsvg_handle_set_dpi_x_y(svg_handle,image->x_resolution,
- image->y_resolution);
- while ((n=ReadBlob(image,MaxTextExtent,message)) != 0)
- {
+ svg_handle=rsvg_handle_new();
+ if (svg_handle == (RsvgHandle *) NULL)
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ rsvg_handle_set_base_uri(svg_handle,image_info->filename);
+ if ((image->resolution.x != 90.0) && (image->resolution.y != 90.0))
+ rsvg_handle_set_dpi_x_y(svg_handle,image->resolution.x,
+ image->resolution.y);
+ while ((n=ReadBlob(image,MaxTextExtent,message)) != 0)
+ {
+ error=(GError *) NULL;
+ (void) rsvg_handle_write(svg_handle,message,n,&error);
+ if (error != (GError *) NULL)
+ g_error_free(error);
+ }
error=(GError *) NULL;
- (void) rsvg_handle_write(svg_handle,message,n,&error);
+ rsvg_handle_close(svg_handle,&error);
if (error != (GError *) NULL)
g_error_free(error);
- }
- error=(GError *) NULL;
- rsvg_handle_close(svg_handle,&error);
- if (error != (GError *) NULL)
- g_error_free(error);
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- rsvg_handle_get_dimensions(svg_handle,&dimension_info);
- image->columns=dimension_info.width;
- image->rows=dimension_info.height;
- pixels=(unsigned char *) NULL;
+ rsvg_handle_get_dimensions(svg_handle,&dimension_info);
+ image->columns=image->resolution.x*dimension_info.width/90.0;
+ image->rows=image->resolution.y*dimension_info.height/90.0;
+ pixel_info=(MemoryInfo *) NULL;
#else
- pixel_info=rsvg_handle_get_pixbuf(svg_handle);
- rsvg_handle_free(svg_handle);
- image->columns=gdk_pixbuf_get_width(pixel_info);
- image->rows=gdk_pixbuf_get_height(pixel_info);
+ pixel_buffer=rsvg_handle_get_pixbuf(svg_handle);
+ rsvg_handle_free(svg_handle);
+ image->columns=gdk_pixbuf_get_width(pixel_buffer);
+ image->rows=gdk_pixbuf_get_height(pixel_buffer);
#endif
- image->matte=MagickTrue;
- SetImageProperty(image,"svg:base-uri",
- rsvg_handle_get_base_uri(svg_handle));
- SetImageProperty(image,"svg:title",rsvg_handle_get_title(svg_handle));
- SetImageProperty(image,"svg:description",
- rsvg_handle_get_desc(svg_handle));
- if ((image->columns == 0) || (image->rows == 0))
- {
+ image->alpha_trait=BlendPixelTrait;
+ SetImageProperty(image,"svg:base-uri",
+ rsvg_handle_get_base_uri(svg_handle),exception);
+ if ((image->columns == 0) || (image->rows == 0))
+ {
#if !defined(MAGICKCORE_CAIRO_DELEGATE)
- g_object_unref(G_OBJECT(pixel_info));
+ g_object_unref(G_OBJECT(pixel_buffer));
#endif
- g_object_unref(svg_handle);
- ThrowReaderException(MissingDelegateError,
- "NoDecodeDelegateForThisImageFormat");
- }
- if (image_info->ping == MagickFalse)
- {
+ g_object_unref(svg_handle);
+ ThrowReaderException(MissingDelegateError,
+ "NoDecodeDelegateForThisImageFormat");
+ }
+ if (image_info->ping == MagickFalse)
+ {
+ size_t
+ stride;
+
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- pixels=(unsigned char *) AcquireQuantumMemory(image->columns,4*
- image->rows*sizeof(*pixels));
- if (pixels == (unsigned char *) NULL)
- {
- g_object_unref(svg_handle);
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- }
+ stride=4*image->columns;
+#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
+ stride=(size_t) cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,
+ image->columns);
#endif
- (void) SetImageBackgroundColor(image);
+ pixel_info=AcquireVirtualMemory(stride,image->rows*sizeof(*pixels));
+ if (pixel_info == (MemoryInfo *) NULL)
+ {
+ g_object_unref(svg_handle);
+ ThrowReaderException(ResourceLimitError,
+ "MemoryAllocationFailed");
+ }
+ pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
+#endif
+ (void) SetImageBackgroundColor(image,exception);
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- cairo_surface=cairo_image_surface_create_for_data(pixels,
- CAIRO_FORMAT_ARGB32,image->columns,image->rows,4*image->columns);
- if (cairo_surface == (cairo_surface_t *) NULL)
- {
- pixels=(unsigned char *) RelinquishMagickMemory(pixels);
- g_object_unref(svg_handle);
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- }
- cairo_info=cairo_create(cairo_surface);
- cairo_set_operator(cairo_info,CAIRO_OPERATOR_CLEAR);
- cairo_paint(cairo_info);
- cairo_set_operator(cairo_info,CAIRO_OPERATOR_OVER);
- rsvg_handle_render_cairo(svg_handle,cairo_info);
- cairo_destroy(cairo_info);
- cairo_surface_destroy(cairo_surface);
- g_object_unref(svg_handle);
- p=pixels;
+ cairo_surface=cairo_image_surface_create_for_data(pixels,
+ CAIRO_FORMAT_ARGB32,image->columns,image->rows,stride);
+ if (cairo_surface == (cairo_surface_t *) NULL)
+ {
+ pixel_info=RelinquishVirtualMemory(pixel_info);
+ g_object_unref(svg_handle);
+ ThrowReaderException(ResourceLimitError,
+ "MemoryAllocationFailed");
+ }
+ cairo_image=cairo_create(cairo_surface);
+ cairo_set_operator(cairo_image,CAIRO_OPERATOR_CLEAR);
+ cairo_paint(cairo_image);
+ cairo_set_operator(cairo_image,CAIRO_OPERATOR_OVER);
+ cairo_scale(cairo_image,image->resolution.x/90.0,
+ image->resolution.y/90.0);
+ rsvg_handle_render_cairo(svg_handle,cairo_image);
+ cairo_destroy(cairo_image);
+ cairo_surface_destroy(cairo_surface);
+ g_object_unref(svg_handle);
+ p=pixels;
#else
- p=gdk_pixbuf_get_pixels(pixel_info);
+ p=gdk_pixbuf_get_pixels(pixel_buffer);
#endif
- for (y=0; y < (long) image->rows; y++)
- {
- q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
- break;
- for (x=0; x < (long) image->columns; x++)
+ GetPixelInfo(image,&fill_color);
+ for (y=0; y < (ssize_t) image->rows; y++)
{
+ q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
+ if (q == (Quantum *) NULL)
+ break;
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- fill_color.blue=ScaleCharToQuantum(*p++);
- fill_color.green=ScaleCharToQuantum(*p++);
- fill_color.red=ScaleCharToQuantum(*p++);
+ fill_color.blue=ScaleCharToQuantum(*p++);
+ fill_color.green=ScaleCharToQuantum(*p++);
+ fill_color.red=ScaleCharToQuantum(*p++);
#else
- fill_color.red=ScaleCharToQuantum(*p++);
- fill_color.green=ScaleCharToQuantum(*p++);
- fill_color.blue=ScaleCharToQuantum(*p++);
+ fill_color.red=ScaleCharToQuantum(*p++);
+ fill_color.green=ScaleCharToQuantum(*p++);
+ fill_color.blue=ScaleCharToQuantum(*p++);
#endif
- fill_color.opacity=QuantumRange-ScaleCharToQuantum(*p++);
+ fill_color.alpha=ScaleCharToQuantum(*p++);
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- {
- double
- gamma;
-
- gamma=1.0-QuantumScale*fill_color.opacity;
- gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
- fill_color.blue*=gamma;
- fill_color.green*=gamma;
- fill_color.red*=gamma;
- }
+ {
+ double
+ gamma;
+
+ gamma=QuantumScale*fill_color.alpha;
+ gamma=PerceptibleReciprocal(gamma);
+ fill_color.blue*=gamma;
+ fill_color.green*=gamma;
+ fill_color.red*=gamma;
+ }
#endif
- MagickCompositeOver(&fill_color,fill_color.opacity,q,
- (MagickRealType) q->opacity,q);
- q++;
- }
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
- if (image->previous == (Image *) NULL)
- {
- status=SetImageProgress(image,LoadImageTag,y,image->rows);
- if (status == MagickFalse)
- break;
+ CompositePixelOver(image,&fill_color,fill_color.alpha,q,(double)
+ GetPixelAlpha(image,q),q);
+ q+=GetPixelChannels(image);
}
+ if (SyncAuthenticPixels(image,exception) == MagickFalse)
+ break;
+ if (image->previous == (Image *) NULL)
+ {
+ status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+ y,image->rows);
+ if (status == MagickFalse)
+ break;
+ }
+ }
}
- }
#if defined(MAGICKCORE_CAIRO_DELEGATE)
- if (pixels != (unsigned char *) NULL)
- pixels=(unsigned char *) RelinquishMagickMemory(pixels);
+ if (pixel_info != (MemoryInfo *) NULL)
+ pixel_info=RelinquishVirtualMemory(pixel_info);
#else
- g_object_unref(G_OBJECT(pixel_info));
+ g_object_unref(G_OBJECT(pixel_buffer));
#endif
- (void) CloseBlob(image);
- return(GetFirstImageInList(image));
+ (void) CloseBlob(image);
+ return(GetFirstImageInList(image));
#endif
+ }
}
/*
Open draw file.
/*
Parse SVG file.
*/
+ if (image == (Image *) NULL)
+ return((Image *) NULL);
svg_info=AcquireSVGInfo();
if (svg_info == (SVGInfo *) NULL)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ {
+ (void) fclose(file);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ }
svg_info->file=file;
svg_info->exception=exception;
svg_info->image=image;
(void) CloneString(&svg_info->size,image_info->size);
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"begin SAX");
- xmlInitParser();
(void) xmlSubstituteEntitiesDefault(1);
(void) ResetMagickMemory(&sax_modules,0,sizeof(sax_modules));
sax_modules.internalSubset=SVGInternalSubset;
xmlFreeParserCtxt(svg_info->parser);
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"end SAX");
- xmlCleanupParser();
(void) fclose(file);
(void) CloseBlob(image);
image->columns=svg_info->width;
SetImageInfoBlob(read_info,(void *) NULL,0);
if (read_info->density != (char *) NULL)
read_info->density=DestroyString(read_info->density);
- (void) FormatMagickString(read_info->filename,MaxTextExtent,"mvg:%s",
+ (void) FormatLocaleString(read_info->filename,MaxTextExtent,"mvg:%s",
filename);
image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image != (Image *) NULL)
{
if (svg_info->title != (char *) NULL)
- (void) SetImageProperty(image,"svg:title",svg_info->title);
+ (void) SetImageProperty(image,"svg:title",svg_info->title,exception);
if (svg_info->comment != (char *) NULL)
- (void) SetImageProperty(image,"svg:comment",svg_info->comment);
+ (void) SetImageProperty(image,"svg:comment",svg_info->comment,
+ exception);
}
svg_info=DestroySVGInfo(svg_info);
(void) RelinquishUniqueFileResource(filename);
%
% The format of the RegisterSVGImage method is:
%
-% unsigned long RegisterSVGImage(void)
+% size_t RegisterSVGImage(void)
%
*/
-ModuleExport unsigned long RegisterSVGImage(void)
+ModuleExport size_t RegisterSVGImage(void)
{
char
version[MaxTextExtent];
(void) CopyMagickString(version,"XML " LIBXML_DOTTED_VERSION,MaxTextExtent);
#endif
#if defined(MAGICKCORE_RSVG_DELEGATE)
- rsvg_init();
- (void) FormatMagickString(version,MaxTextExtent,"RSVG %d.%d.%d",
+#if !GLIB_CHECK_VERSION(2,35,0)
+ g_type_init();
+#endif
+#if defined(MAGICKCORE_XML_DELEGATE)
+ xmlInitParser();
+#endif
+ (void) FormatLocaleString(version,MaxTextExtent,"RSVG %d.%d.%d",
LIBRSVG_MAJOR_VERSION,LIBRSVG_MINOR_VERSION,LIBRSVG_MICRO_VERSION);
#endif
entry=SetMagickInfo("SVG");
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickFalse;
entry->description=ConstantString("Scalable Vector Graphics");
+ entry->mime_type=ConstantString("image/svg+xml");
if (*version != '\0')
entry->version=ConstantString(version);
entry->magick=(IsImageFormatHandler *) IsSVG;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickFalse;
entry->description=ConstantString("Compressed Scalable Vector Graphics");
+ entry->mime_type=ConstantString("image/svg+xml");
if (*version != '\0')
entry->version=ConstantString(version);
entry->magick=(IsImageFormatHandler *) IsSVG;
(void) UnregisterMagickInfo("SVGZ");
(void) UnregisterMagickInfo("SVG");
(void) UnregisterMagickInfo("MSVG");
-#if defined(MAGICKCORE_RSVG_DELEGATE)
- rsvg_term();
+#if defined(MAGICKCORE_XML_DELEGATE)
+ xmlCleanupParser();
#endif
}
\f
%
% The format of the WriteSVGImage method is:
%
-% MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteSVGImage(const ImageInfo *image_info,
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static void AffineToTransform(Image *image,AffineMatrix *affine)
(void) WriteBlobString(image,"\">\n");
return;
}
- (void) FormatMagickString(transform,MaxTextExtent,
+ (void) FormatLocaleString(transform,MaxTextExtent,
"\" transform=\"scale(%g,%g)\">\n",affine->sx,affine->sy);
(void) WriteBlobString(image,transform);
return;
theta;
theta=(180.0/MagickPI)*atan2(affine->rx,affine->sx);
- (void) FormatMagickString(transform,MaxTextExtent,
+ (void) FormatLocaleString(transform,MaxTextExtent,
"\" transform=\"rotate(%g)\">\n",theta);
(void) WriteBlobString(image,transform);
return;
(fabs(affine->ry) < MagickEpsilon) &&
(fabs(affine->sy-1.0) < MagickEpsilon))
{
- (void) FormatMagickString(transform,MaxTextExtent,
+ (void) FormatLocaleString(transform,MaxTextExtent,
"\" transform=\"translate(%g,%g)\">\n",affine->tx,affine->ty);
(void) WriteBlobString(image,transform);
return;
}
}
- (void) FormatMagickString(transform,MaxTextExtent,
- "\" transform=\"matrix(%g %g %g %g %g %g)\">\n",affine->sx,affine->rx,
- affine->ry,affine->sy,affine->tx,affine->ty);
+ (void) FormatLocaleString(transform,MaxTextExtent,
+ "\" transform=\"matrix(%g %g %g %g %g %g)\">\n",
+ affine->sx,affine->rx,affine->ry,affine->sy,affine->tx,affine->ty);
(void) WriteBlobString(image,transform);
}
char
*p;
- long
+ ssize_t
value;
value=strtol(point,&p,10);
+ (void) value;
return(p != point ? MagickTrue : MagickFalse);
}
-static MagickBooleanType TraceSVGImage(Image *image)
+static MagickBooleanType TraceSVGImage(Image *image,ExceptionInfo *exception)
{
- long
+ ssize_t
y;
- register const PixelPacket
+ register const Quantum
*p;
- register long
+ register ssize_t
x;
#if defined(MAGICKCORE_AUTOTRACE_DELEGATE)
ImageType
type;
- register long
+ register ssize_t
i;
- unsigned long
+ size_t
number_planes;
/*
*/
fitting_options=at_fitting_opts_new();
output_options=at_output_opts_new();
- type=GetImageType(image,&image->exception);
+ type=GetImageType(image,exception);
number_planes=3;
if ((type == BilevelType) || (type == GrayscaleType))
number_planes=1;
trace=at_bitmap_new(image->columns,image->rows,number_planes);
i=0;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- trace->bitmap[i++]=p->red;
+ trace->bitmap[i++]=GetPixelRed(image,p);
if (number_planes == 3)
{
- trace->bitmap[i++]=p->green;
- trace->bitmap[i++]=p->blue;
+ trace->bitmap[i++]=GetPixelGreen(image,p);
+ trace->bitmap[i++]=GetPixelBlue(image,p);
}
- p++;
+ p+=GetPixelChannels(image);
}
}
splines=at_splines_new_full(trace,fitting_options,NULL,NULL,NULL,NULL,NULL,
message[MaxTextExtent],
tuple[MaxTextExtent];
- MagickPixelPacket
+ PixelInfo
pixel;
- register const IndexPacket
- *indexes;
-
(void) WriteBlobString(image,"<?xml version=\"1.0\" standalone=\"no\"?>\n");
(void) WriteBlobString(image,
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\"\n");
(void) WriteBlobString(image,
" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n");
- (void) FormatMagickString(message,MaxTextExtent,
- "<svg width=\"%lu\" height=\"%lu\">\n",image->columns,image->rows);
+ (void) FormatLocaleString(message,MaxTextExtent,
+ "<svg width=\"%.20g\" height=\"%.20g\">\n",(double) image->columns,
+ (double) image->rows);
(void) WriteBlobString(image,message);
- GetMagickPixelPacket(image,&pixel);
- for (y=0; y < (long) image->rows; y++)
+ GetPixelInfo(image,&pixel);
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- SetMagickPixelPacket(image,p,indexes+x,&pixel);
- (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
- &image->exception);
- (void) FormatMagickString(message,MaxTextExtent,
- " <circle cx=\"%ld\" cy=\"%ld\" r=\"1\" fill=\"%s\"/>\n",x,y,tuple);
+ GetPixelInfoPixel(image,p,&pixel);
+ (void) QueryColorname(image,&pixel,SVGCompliance,tuple,exception);
+ (void) FormatLocaleString(message,MaxTextExtent,
+ " <circle cx=\"%.20g\" cy=\"%.20g\" r=\"1\" fill=\"%s\"/>\n",
+ (double) x,(double) y,tuple);
(void) WriteBlobString(image,message);
- p++;
+ p+=GetPixelChannels(image);
}
}
(void) WriteBlobString(image,"</svg>\n");
return(MagickTrue);
}
-static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
#define BezierQuantum 200
int
n;
- long
+ ssize_t
j;
MagickBooleanType
PrimitiveType
primitive_type;
- register long
+ register ssize_t
x;
- register long
+ register ssize_t
i;
size_t
SVGInfo
svg_info;
- unsigned long
+ size_t
number_points;
/*
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
value=GetImageArtifact(image,"SVG");
}
value=GetImageArtifact(image,"MVG");
if (value == (char *) NULL)
- return(TraceSVGImage(image));
+ return(TraceSVGImage(image,exception));
/*
Write SVG header.
*/
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\"\n");
(void) WriteBlobString(image,
" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n");
- (void) FormatMagickString(message,MaxTextExtent,
- "<svg width=\"%lu\" height=\"%lu\">\n",image->columns,image->rows);
+ (void) FormatLocaleString(message,MaxTextExtent,
+ "<svg width=\"%.20g\" height=\"%.20g\">\n",(double) image->columns,(double)
+ image->rows);
(void) WriteBlobString(image,message);
/*
Allocate primitive info memory.
if (LocaleCompare("affine",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.sx=atof(token);
+ affine.sx=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.rx=atof(token);
+ affine.rx=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.ry=atof(token);
+ affine.ry=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.sy=atof(token);
+ affine.sy=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.tx=atof(token);
+ affine.tx=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.ty=atof(token);
+ affine.ty=StringToDouble(token,(char **) NULL);
break;
}
if (LocaleCompare("angle",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.rx=atof(token);
- affine.ry=atof(token);
+ affine.rx=StringToDouble(token,(char **) NULL);
+ affine.ry=StringToDouble(token,(char **) NULL);
break;
}
if (LocaleCompare("arc",keyword) == 0)
if (LocaleCompare("clip-path",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"clip-path:url(#%s);",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("clip-rule",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"clip-rule:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("clip-units",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"clipPathUnits=%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("decorate",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"text-decoration:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("fill",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"fill:%s;",
+ (void) FormatLocaleString(message,MaxTextExtent,"fill:%s;",
token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("fill-rule",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"fill-rule:%s;",token);
(void) WriteBlobString(image,message);
break;
}
- if (LocaleCompare("fill-opacity",keyword) == 0)
+ if (LocaleCompare("fill-alpha",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
- "fill-opacity:%s;",token);
+ (void) FormatLocaleString(message,MaxTextExtent,
+ "fill-alpha:%s;",token);
(void) WriteBlobString(image,message);
break;
}
if (LocaleCompare("font-family",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"font-family:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("font-stretch",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"font-stretch:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("font-style",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"font-style:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("font-size",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"font-size:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("font-weight",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"font-weight:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("text-align",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"text-align %s ",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("text-anchor",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"text-anchor %s ",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("opacity",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"opacity %s ",
+ (void) FormatLocaleString(message,MaxTextExtent,"opacity %s ",
token);
(void) WriteBlobString(image,message);
break;
}
if (LocaleCompare("gradient",token) == 0)
{
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"</%sGradient>\n",type);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("clip-path",token) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"<clipPath id=\"%s\">\n",token);
(void) WriteBlobString(image,message);
break;
GetMagickToken(q,&q,token);
(void) CopyMagickString(type,token,MaxTextExtent);
GetMagickToken(q,&q,token);
- svg_info.segment.x1=atof(token);
- svg_info.element.cx=atof(token);
+ svg_info.segment.x1=StringToDouble(token,(char **) NULL);
+ svg_info.element.cx=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.segment.y1=atof(token);
- svg_info.element.cy=atof(token);
+ svg_info.segment.y1=StringToDouble(token,(char **) NULL);
+ svg_info.element.cy=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.segment.x2=atof(token);
- svg_info.element.major=atof(token);
+ svg_info.segment.x2=StringToDouble(token,(char **) NULL);
+ svg_info.element.major=StringToDouble(token,
+ (char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.segment.y2=atof(token);
- svg_info.element.minor=atof(token);
- (void) FormatMagickString(message,MaxTextExtent,
+ svg_info.segment.y2=StringToDouble(token,(char **) NULL);
+ svg_info.element.minor=StringToDouble(token,
+ (char **) NULL);
+ (void) FormatLocaleString(message,MaxTextExtent,
"<%sGradient id=\"%s\" x1=\"%g\" y1=\"%g\" x2=\"%g\" "
"y2=\"%g\">\n",type,name,svg_info.segment.x1,
svg_info.segment.y1,svg_info.segment.x2,svg_info.segment.y2);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.element.angle=atof(token);
- (void) FormatMagickString(message,MaxTextExtent,
+ svg_info.element.angle=StringToDouble(token,
+ (char **) NULL);
+ (void) FormatLocaleString(message,MaxTextExtent,
"<%sGradient id=\"%s\" cx=\"%g\" cy=\"%g\" r=\"%g\" "
- "fx=\"%g\" fy=\"%g\">\n",type,name,svg_info.element.cx,
- svg_info.element.cy,svg_info.element.angle,
- svg_info.element.major,svg_info.element.minor);
+ "fx=\"%g\" fy=\"%g\">\n",type,name,
+ svg_info.element.cx,svg_info.element.cy,
+ svg_info.element.angle,svg_info.element.major,
+ svg_info.element.minor);
}
(void) WriteBlobString(image,message);
break;
GetMagickToken(q,&q,token);
(void) CopyMagickString(name,token,MaxTextExtent);
GetMagickToken(q,&q,token);
- svg_info.bounds.x=atof(token);
+ svg_info.bounds.x=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.bounds.y=atof(token);
+ svg_info.bounds.y=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.bounds.width=atof(token);
+ svg_info.bounds.width=StringToDouble(token,
+ (char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- svg_info.bounds.height=atof(token);
- (void) FormatMagickString(message,MaxTextExtent,
+ svg_info.bounds.height=StringToDouble(token,
+ (char **) NULL);
+ (void) FormatLocaleString(message,MaxTextExtent,
"<pattern id=\"%s\" x=\"%g\" y=\"%g\" width=\"%g\" "
- "height=\"%g\">\n",name,svg_info.bounds.x,svg_info.bounds.y,
- svg_info.bounds.width,svg_info.bounds.height);
+ "height=\"%g\">\n",name,svg_info.bounds.x,
+ svg_info.bounds.y,svg_info.bounds.width,
+ svg_info.bounds.height);
(void) WriteBlobString(image,message);
break;
}
if (LocaleCompare("rotate",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"rotate(%s) ",
+ (void) FormatLocaleString(message,MaxTextExtent,"rotate(%s) ",
token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("scale",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.sx=atof(token);
+ affine.sx=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.sy=atof(token);
+ affine.sy=StringToDouble(token,(char **) NULL);
break;
}
if (LocaleCompare("skewX",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"skewX(%s) ",
+ (void) FormatLocaleString(message,MaxTextExtent,"skewX(%s) ",
token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("skewY",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"skewY(%s) ",
+ (void) FormatLocaleString(message,MaxTextExtent,"skewY(%s) ",
token);
(void) WriteBlobString(image,message);
break;
GetMagickToken(q,&q,token);
(void) CopyMagickString(color,token,MaxTextExtent);
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <stop offset=\"%s\" stop-color=\"%s\" />\n",token,color);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"stroke:%s;",
+ (void) FormatLocaleString(message,MaxTextExtent,"stroke:%s;",
token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-antialias",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-antialias:%s;",token);
(void) WriteBlobString(image,message);
break;
{
if (IsPoint(q))
{
- long
+ ssize_t
k;
p=q;
for (j=0; j < k; j++)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,"%s ",
+ (void) FormatLocaleString(message,MaxTextExtent,"%s ",
token);
(void) WriteBlobString(image,message);
}
break;
}
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-dasharray:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-dashoffset",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-dashoffset:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-linecap",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-linecap:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-linejoin",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-linejoin:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-miterlimit",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-miterlimit:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-opacity",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-opacity:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("stroke-width",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"stroke-width:%s;",token);
(void) WriteBlobString(image,message);
continue;
if (LocaleCompare("text-antialias",keyword) == 0)
{
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
"text-antialias:%s;",token);
(void) WriteBlobString(image,message);
break;
if (LocaleCompare("translate",keyword) == 0)
{
GetMagickToken(q,&q,token);
- affine.tx=atof(token);
+ affine.tx=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- affine.ty=atof(token);
+ affine.ty=StringToDouble(token,(char **) NULL);
break;
}
status=MagickFalse;
if (IsPoint(q) == MagickFalse)
break;
GetMagickToken(q,&q,token);
- point.x=atof(token);
+ point.x=StringToDouble(token,(char **) NULL);
GetMagickToken(q,&q,token);
if (*token == ',')
GetMagickToken(q,&q,token);
- point.y=atof(token);
+ point.y=StringToDouble(token,(char **) NULL);
GetMagickToken(q,(const char **) NULL,token);
if (*token == ',')
GetMagickToken(q,&q,token);
primitive_info[i].coordinates=0;
primitive_info[i].method=FloodfillMethod;
i++;
- if (i < (long) (number_points-6*BezierQuantum-360))
+ if (i < (ssize_t) (number_points-6*BezierQuantum-360))
continue;
number_points+=6*BezierQuantum+360;
primitive_info=(PrimitiveInfo *) ResizeQuantumMemory(primitive_info,
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;
}
status=MagickFalse;
break;
}
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <line x1=\"%g\" y1=\"%g\" x2=\"%g\" y2=\"%g\"/>\n",
primitive_info[j].point.x,primitive_info[j].point.y,
primitive_info[j+1].point.x,primitive_info[j+1].point.y);
status=MagickFalse;
break;
}
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <rect x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"/>\n",
primitive_info[j].point.x,primitive_info[j].point.y,
primitive_info[j+1].point.x-primitive_info[j].point.x,
status=MagickFalse;
break;
}
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <rect x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" rx=\"%g\" "
- "ry=\"%g\"/>\n",primitive_info[j].point.x,primitive_info[j].point.y,
- primitive_info[j+1].point.x-primitive_info[j].point.x,
- primitive_info[j+1].point.y-primitive_info[j].point.y,
- primitive_info[j+2].point.x,primitive_info[j+2].point.y);
+ "ry=\"%g\"/>\n",primitive_info[j].point.x,
+ primitive_info[j].point.y,primitive_info[j+1].point.x-
+ primitive_info[j].point.x,primitive_info[j+1].point.y-
+ primitive_info[j].point.y,primitive_info[j+2].point.x,
+ primitive_info[j+2].point.y);
(void) WriteBlobString(image,message);
break;
}
status=MagickFalse;
break;
}
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <ellipse cx=\"%g\" cy=\"%g\" rx=\"%g\" ry=\"%g\"/>\n",
primitive_info[j].point.x,primitive_info[j].point.y,
primitive_info[j+1].point.x,primitive_info[j+1].point.y);
}
alpha=primitive_info[j+1].point.x-primitive_info[j].point.x;
beta=primitive_info[j+1].point.y-primitive_info[j].point.y;
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <circle cx=\"%g\" cy=\"%g\" r=\"%g\"/>\n",
primitive_info[j].point.x,primitive_info[j].point.y,
hypot(alpha,beta));
length=strlen(message);
for ( ; j < i; j++)
{
- (void) FormatMagickString(message,MaxTextExtent,"%g,%g ",
+ (void) FormatLocaleString(message,MaxTextExtent,"%g,%g ",
primitive_info[j].point.x,primitive_info[j].point.y);
length+=strlen(message);
if (length >= 80)
length=strlen(message);
for ( ; j < i; j++)
{
- (void) FormatMagickString(message,MaxTextExtent,"%g,%g ",
+ (void) FormatLocaleString(message,MaxTextExtent,"%g,%g ",
primitive_info[j].point.x,primitive_info[j].point.y);
length+=strlen(message);
if (length >= 80)
for (p=token; *p != '\0'; p++)
if (isalpha((int) *p))
number_attributes++;
- if (i > (long) (number_points-6*BezierQuantum*number_attributes-1))
+ if (i > (ssize_t) (number_points-6*BezierQuantum*number_attributes-1))
{
number_points+=6*BezierQuantum*number_attributes;
primitive_info=(PrimitiveInfo *) ResizeQuantumMemory(primitive_info,
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;
break;
}
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <text x=\"%g\" y=\"%g\">",primitive_info[j].point.x,
primitive_info[j].point.y);
(void) WriteBlobString(image,message);
break;
}
GetMagickToken(q,&q,token);
- (void) FormatMagickString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MaxTextExtent,
" <image x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" "
"xlink:href=\"%s\"/>\n",primitive_info[j].point.x,
primitive_info[j].point.y,primitive_info[j+1].point.x,