% December 2001 %
% %
% %
-% 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 "magick/log.h"
#include "magick/magick.h"
#include "magick/memory_.h"
+#include "magick/module.h"
#include "magick/option.h"
#include "magick/paint.h"
#include "magick/profile.h"
#include "magick/quantum-private.h"
#include "magick/registry.h"
#include "magick/resize.h"
+#include "magick/resource_.h"
#include "magick/segment.h"
#include "magick/shear.h"
#include "magick/signature.h"
#include "magick/static.h"
#include "magick/string_.h"
-#include "magick/module.h"
+#include "magick/string-private.h"
#include "magick/transform.h"
#include "magick/threshold.h"
#include "magick/utility.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
{
if (LocaleCompare(keyword,"pointsize") == 0)
{
- draw_info->pointsize=atof(value);
+ draw_info->pointsize=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"rotate") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
}
if (LocaleCompare(keyword,"skewX") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.ry=tan(DegreesToRadians(fmod((double) angle,
360.0)));
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.rx=tan(DegreesToRadians(fmod((double) angle,
360.0)));
break;
}
if (LocaleCompare(keyword,"strokewidth") == 0)
{
- draw_info->stroke_width=atol(value);
+ draw_info->stroke_width=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
if (LocaleCompare(keyword,"weight") == 0)
{
- draw_info->weight=atol(value);
+ draw_info->weight=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"sigma") == 0)
{
- geometry_info.sigma=atol(value);
+ geometry_info.sigma=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=atol(value);
+ geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword, "radius") == 0)
{
- radius = atof( value );
+ radius = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"sigma") == 0)
{
- sigma = atol( value );
+ sigma = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=atol(value);
+ geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
if (LocaleCompare(keyword,"fuzz") == 0)
{
- msl_info->image[n]->fuzz=atof(value);
+ msl_info->image[n]->fuzz=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
(void) GetOneVirtualMagickPixel(msl_info->image[n],
geometry.x,geometry.y,&target,&exception);
break;
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
(void) GetOneVirtualMagickPixel(msl_info->image[n],
geometry.x,geometry.y,&target,&exception);
break;
CacheView
*composite_view;
- opacity=QuantumRange-atol(value);
+ opacity=QuantumRange-StringToLong(value);
if (compose != DissolveCompositeOp)
{
(void) SetImageOpacity(composite_image,(Quantum)
for (x=0; x < (long) composite_image->columns; x++)
{
if (q->opacity == OpaqueOpacity)
- q->opacity=RoundToQuantum(opacity);
+ q->opacity=ClampToQuantum(opacity);
q++;
}
if (SyncCacheViewAuthenticPixels(composite_view,&exception) == MagickFalse)
{
if (LocaleCompare(keyword,"rotate") == 0)
{
- rotate_image=RotateImage(composite_image,atof(value),
+ rotate_image=RotateImage(composite_image,StringToDouble(value),
&exception);
break;
}
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
(void) GetOneVirtualPixel(msl_info->image[n],geometry.x,
geometry.y,&target,&exception);
break;
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
(void) GetOneVirtualPixel(msl_info->image[n],geometry.x,
geometry.y,&target,&exception);
break;
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=atol(value);
+ geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"display") == 0)
{
- display=atol(value);
+ display=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
if (LocaleCompare(keyword,"pointsize") == 0)
{
- draw_info->pointsize=atof(value);
+ draw_info->pointsize=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"rotate") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
}
if (LocaleCompare(keyword,"skewX") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.ry=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.rx=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
}
if (LocaleCompare(keyword,"strokewidth") == 0)
{
- draw_info->stroke_width=atol(value);
+ draw_info->stroke_width=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
if (LocaleCompare(keyword,"weight") == 0)
{
- draw_info->weight=atol(value);
+ draw_info->weight=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"sigma") == 0)
{
- geometry_info.sigma=atol(value);
+ geometry_info.sigma=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"height") == 0)
{
- frame_info.height=atol(value);
+ frame_info.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"inner") == 0)
{
- frame_info.inner_bevel=atol(value);
+ frame_info.inner_bevel=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"outer") == 0)
{
- frame_info.outer_bevel=atol(value);
+ frame_info.outer_bevel=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- frame_info.width=atol(value);
+ frame_info.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"blue") == 0)
{
- pixel.blue=atof(value);
+ pixel.blue=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
if (LocaleCompare(keyword,"green") == 0)
{
- pixel.green=atof(value);
+ pixel.green=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"red") == 0)
{
- pixel.red=atof(value);
+ pixel.red=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"amount") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"black") == 0)
{
- levelBlack = atof( value );
+ levelBlack = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"gamma") == 0)
{
- levelGamma = atof( value );
+ levelGamma = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"white") == 0)
{
- levelWhite = atof( value );
+ levelWhite = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"fuzz") == 0)
{
- msl_info->image[n]->fuzz=atof(value);
+ msl_info->image[n]->fuzz=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"opacity") == 0)
{
- opacity=atof(value);
+ opacity=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
(void) GetOneVirtualMagickPixel(msl_info->image[n],
geometry.x,geometry.y,&target,&exception);
break;
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
(void) GetOneVirtualMagickPixel(msl_info->image[n],
geometry.x,geometry.y,&target,&exception);
break;
}
draw_info=CloneDrawInfo(msl_info->image_info[n],
msl_info->draw_info[n]);
- draw_info->fill.opacity=RoundToQuantum(opacity);
+ draw_info->fill.opacity=ClampToQuantum(opacity);
(void) FloodfillPaintImage(msl_info->image[n],OpacityChannel,
draw_info,&target,geometry.x,geometry.y,
paint_method == FloodfillMethod ? MagickFalse : MagickTrue);
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"blackness") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
if (LocaleCompare(keyword,"brightness") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"hue") == 0)
{
- geometry_info.xi=atof(value);
+ geometry_info.xi=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"lightness") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"saturation") == 0)
{
- geometry_info.sigma=atof(value);
+ geometry_info.sigma=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"whiteness") == 0)
{
- geometry_info.sigma=atof(value);
+ geometry_info.sigma=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
if (LocaleCompare(keyword,"fuzz") == 0)
{
- msl_info->image[n]->fuzz=atof(value);
+ msl_info->image[n]->fuzz=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
if (LocaleCompare((const char *) tag, "profile") == 0)
{
- ImageInfo
- *clone_info;
-
if (msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
{
if (LocaleCompare(keyword,"colors") == 0)
{
- quantize_info.number_colors=atol(value);
+ quantize_info.number_colors=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
if (LocaleCompare(keyword,"treedepth") == 0)
{
- quantize_info.tree_depth=atol(value);
+ quantize_info.tree_depth=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"pointsize") == 0)
{
- draw_info->pointsize=atof(value);
+ draw_info->pointsize=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"rotate") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
}
if (LocaleCompare(keyword,"skewX") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.ry=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
- angle=atof(value);
+ angle=StringToDouble(value);
affine.rx=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
}
if (LocaleCompare(keyword,"strokewidth") == 0)
{
- draw_info->stroke_width=atol(value);
+ draw_info->stroke_width=StringToLong(value);
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
if (LocaleCompare(keyword,"weight") == 0)
{
- draw_info->weight=atol(value);
+ draw_info->weight=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
*image;
image=msl_info->attributes[n];
- FormatImageProperty(image,"msl:font-metrics.pixels_per_em.x","%g",
- metrics.pixels_per_em.x);
- FormatImageProperty(image,"msl:font-metrics.pixels_per_em.y","%g",
- metrics.pixels_per_em.y);
+ FormatImageProperty(image,"msl:font-metrics.pixels_per_em.x",
+ "%g",metrics.pixels_per_em.x);
+ FormatImageProperty(image,"msl:font-metrics.pixels_per_em.y",
+ "%g",metrics.pixels_per_em.y);
FormatImageProperty(image,"msl:font-metrics.ascent","%g",
metrics.ascent);
FormatImageProperty(image,"msl:font-metrics.descent","%g",
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=atol(value);
+ geometry.height=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
AppendImageToList(&msl_info->image[n],image);
break;
}
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
- break;
- }
- case 'G':
- case 'g':
- {
- if (LocaleCompare(keyword,"gravity") == 0)
- {
- option=ParseMagickOption(MagickGravityOptions,MagickFalse,
- value);
- if (option < 0)
- ThrowMSLException(OptionError,"UnrecognizedGravityType",
- value);
- (void) SetImageOption(msl_info->image_info[n],keyword,
- value);
- break;
- }
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
- break;
- }
- case 'P':
- case 'p':
- {
- if (LocaleCompare(keyword,"pointsize") == 0)
- {
- msl_info->image_info[n]->pointsize=atof(value);
- break;
- }
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
- break;
- }
- case 'S':
- case 's':
- {
- if (LocaleCompare(keyword,"size") == 0)
- {
- msl_info->image_info[n]->size=AcquireString(value);
- break;
- }
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
+ (void) SetMSLAttributes(msl_info,keyword,value);
break;
}
default:
{
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
+ (void) SetMSLAttributes(msl_info,keyword,value);
break;
}
}
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"height") == 0)
{
- height = atol( value );
+ height = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"width") == 0)
{
- width = atol( value );
+ width = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"x") == 0)
{
- x = atol( value );
+ x = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"y") == 0)
{
- y = atol( value );
+ y = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"blur") == 0)
{
- msl_info->image[n]->blur=atof(value);
+ msl_info->image[n]->blur=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"x-resolution") == 0)
{
- x_resolution=atof(value);
+ x_resolution=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"y-resolution") == 0)
{
- y_resolution=atof(value);
+ y_resolution=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=(unsigned long) atol(value);
+ geometry.height=StringToUnsignedLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"support") == 0)
{
- blur=atof(value);
+ blur=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry.x=atol(value);
+ geometry.x=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry.y=atol(value);
+ geometry.y=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"x") == 0)
{
- x = atol( value );
+ x = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"y") == 0)
{
- y = atol( value );
+ y = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"degrees") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"degrees") == 0)
{
- degrees = atof( value );
+ degrees = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=(unsigned long) atol(value);
+ geometry.height=StringToUnsignedLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"height") == 0)
{
- geometry.height=(unsigned long) atol(value);
+ geometry.height=StringToUnsignedLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"width") == 0)
{
- geometry.width=atol(value);
+ geometry.width=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"cluster-threshold") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
if (LocaleCompare(keyword,"smoothing-threshold") == 0)
{
- geometry_info.sigma=atof(value);
+ geometry_info.sigma=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
if (value[len-1] == '%') {
char tmp[100];
(void) CopyMagickString(tmp,value,len);
- opac = atol( tmp );
+ opac = StringToLong( tmp );
opac = (int)(QuantumRange * ((float)opac/100));
} else
- opac = atol( value );
+ opac = StringToLong( value );
(void) SetImageOpacity( msl_info->image[n], (Quantum) opac );
break;
}
{
if (LocaleCompare(keyword,"azimuth") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"elevation") == 0)
{
- geometry_info.sigma=atof(value);
+ geometry_info.sigma=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"opacity") == 0)
{
- geometry_info.rho=atol(value);
+ geometry_info.rho=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"sigma") == 0)
{
- geometry_info.sigma=atol(value);
+ geometry_info.sigma=StringToLong(value);
break;
}
break;
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry_info.xi=atof(value);
+ geometry_info.xi=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry_info.psi=atol(value);
+ geometry_info.psi=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
}
shadow_image=ShadowImage(msl_info->image[n],geometry_info.rho,
- geometry_info.sigma,(long) (geometry_info.xi+0.5),(long)
- (geometry_info.psi+0.5),&msl_info->image[n]->exception);
+ geometry_info.sigma,(long) ceil(geometry_info.xi-0.5),(long)
+ ceil(geometry_info.psi-0.5),&msl_info->image[n]->exception);
if (shadow_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
{
if (LocaleCompare(keyword, "radius") == 0)
{
- radius = atof( value );
+ radius = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"sigma") == 0)
{
- sigma = atol( value );
+ sigma = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"height") == 0)
{
- height = atol( value );
+ height = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"width") == 0)
{
- width = atol( value );
+ width = StringToLong( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"x") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"y") == 0)
{
- geometry_info.sigma=atol(value);
+ geometry_info.sigma=StringToLong(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"threshold") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"radius") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"degrees") == 0)
{
- geometry_info.rho=atof(value);
+ geometry_info.rho=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
{
if (LocaleCompare(keyword,"threshold") == 0)
{
- threshold = atof( value );
+ threshold = StringToDouble( value );
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
MaxTextExtent);
break;
}
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
- }
- case 'Q':
- case 'q':
- {
- if (LocaleCompare(keyword,"quality") == 0)
- {
- msl_info->image_info[n]->quality=atol(value);
- msl_info->image[n]->quality=
- msl_info->image_info[n]->quality;
- break;
- }
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
+ (void) SetMSLAttributes(msl_info,keyword,value);
}
default:
{
- ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
+ (void) SetMSLAttributes(msl_info,keyword,value);
break;
}
}
static MagickBooleanType ProcessMSLScript(const ImageInfo *image_info,Image **image,
ExceptionInfo *exception)
{
- xmlSAXHandler
- SAXModules =
- {
- MSLInternalSubset,
- MSLIsStandalone,
- MSLHasInternalSubset,
- MSLHasExternalSubset,
- MSLResolveEntity,
- MSLGetEntity,
- MSLEntityDeclaration,
- MSLNotationDeclaration,
- MSLAttributeDeclaration,
- MSLElementDeclaration,
- MSLUnparsedEntityDeclaration,
- MSLSetDocumentLocator,
- MSLStartDocument,
- MSLEndDocument,
- MSLStartElement,
- MSLEndElement,
- MSLReference,
- MSLCharacters,
- MSLIgnorableWhitespace,
- MSLProcessingInstructions,
- MSLComment,
- MSLWarning,
- MSLError,
- MSLError,
- MSLGetParameterEntity,
- MSLCDataBlock,
- MSLExternalSubset
- };
-
char
message[MaxTextExtent];
MSLInfo
msl_info;
+ xmlSAXHandler
+ sax_modules;
+
xmlSAXHandlerPtr
- SAXHandler;
+ sax_handler;
/*
Open image file.
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image_info->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
+ image_info->filename);
assert(image != (Image **) NULL);
msl_image=AcquireImage(image_info);
status=OpenBlob(image_info,msl_image,ReadBinaryBlobMode,exception);
msl_info.draw_info=(DrawInfo **) AcquireMagickMemory(
sizeof(*msl_info.draw_info));
/* top of the stack is the MSL file itself */
- msl_info.image=(Image **) AcquireMagickMemory(sizeof(*msl_info.image));
+ msl_info.image=(Image **) AcquireAlignedMemory(1,sizeof(*msl_info.image));
msl_info.attributes=(Image **) AcquireMagickMemory(
sizeof(*msl_info.attributes));
msl_info.group_info=(MSLGroupInfo *) AcquireMagickMemory(
if (*image != (Image *) NULL)
MSLPushImage(&msl_info,*image);
(void) xmlSubstituteEntitiesDefault(1);
- SAXHandler=(&SAXModules);
- msl_info.parser=xmlCreatePushParserCtxt(SAXHandler,&msl_info,(char *) NULL,0,
+ (void) ResetMagickMemory(&sax_modules,0,sizeof(sax_modules));
+ sax_modules.internalSubset=MSLInternalSubset;
+ sax_modules.isStandalone=MSLIsStandalone;
+ sax_modules.hasInternalSubset=MSLHasInternalSubset;
+ sax_modules.hasExternalSubset=MSLHasExternalSubset;
+ sax_modules.resolveEntity=MSLResolveEntity;
+ sax_modules.getEntity=MSLGetEntity;
+ sax_modules.entityDecl=MSLEntityDeclaration;
+ sax_modules.notationDecl=MSLNotationDeclaration;
+ sax_modules.attributeDecl=MSLAttributeDeclaration;
+ sax_modules.elementDecl=MSLElementDeclaration;
+ sax_modules.unparsedEntityDecl=MSLUnparsedEntityDeclaration;
+ sax_modules.setDocumentLocator=MSLSetDocumentLocator;
+ sax_modules.startDocument=MSLStartDocument;
+ sax_modules.endDocument=MSLEndDocument;
+ sax_modules.startElement=MSLStartElement;
+ sax_modules.endElement=MSLEndElement;
+ sax_modules.reference=MSLReference;
+ sax_modules.characters=MSLCharacters;
+ sax_modules.ignorableWhitespace=MSLIgnorableWhitespace;
+ sax_modules.processingInstruction=MSLProcessingInstructions;
+ sax_modules.comment=MSLComment;
+ sax_modules.warning=MSLWarning;
+ sax_modules.error=MSLError;
+ sax_modules.fatalError=MSLError;
+ sax_modules.getParameterEntity=MSLGetParameterEntity;
+ sax_modules.cdataBlock=MSLCDataBlock;
+ sax_modules.externalSubset=MSLExternalSubset;
+ sax_handler=(&sax_modules);
+ msl_info.parser=xmlCreatePushParserCtxt(sax_handler,&msl_info,(char *) NULL,0,
msl_image->filename);
while (ReadBlobString(msl_image,message) != (char *) NULL)
{
msl_info.group_info);
if (*image == (Image *) NULL)
*image=(*msl_info.image);
- return((MagickBooleanType) ((*msl_info.image)->exception.severity == UndefinedException));
+ if ((*msl_info.image)->exception.severity != UndefinedException)
+ return(MagickFalse);
+ return(MagickTrue);
}
static Image *ReadMSLImage(const ImageInfo *image_info,ExceptionInfo *exception)
return(MagickImageCoderSignature);
}
\f
+#if defined(MAGICKCORE_XML_DELEGATE)
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
const char *value)
{
+ Image
+ *attributes;
+
DrawInfo
*draw_info;
ExceptionInfo
*exception;
+ GeometryInfo
+ geometry_info;
+
Image
*image;
ImageInfo
*image_info;
+ int
+ flags;
+
long
n;
return(MagickTrue);
exception=msl_info->exception;
n=msl_info->n;
+ attributes=msl_info->attributes[n];
image_info=msl_info->image_info[n];
draw_info=msl_info->draw_info[n];
image=msl_info->image[n];
alpha=ParseMagickOption(MagickAlphaOptions,MagickFalse,value);
if (alpha < 0)
ThrowMSLException(OptionError,"UnrecognizedType",value);
- (void) SetImageAlphaChannel(image,(AlphaChannelType) alpha);
+ if (image != (Image *) NULL)
+ (void) SetImageAlphaChannel(image,(AlphaChannelType) alpha);
+ break;
+ }
+ if (LocaleCompare(keyword,"antialias") == 0)
+ {
+ long
+ antialias;
+
+ antialias=ParseMagickOption(MagickBooleanOptions,MagickFalse,value);
+ if (antialias < 0)
+ ThrowMSLException(OptionError,"UnrecognizedGravityType",value);
+ image_info->antialias=(MagickBooleanType) antialias;
+ break;
+ }
+ if (LocaleCompare(keyword,"area-limit") == 0)
+ {
+ MagickSizeType
+ limit;
+
+ limit=MagickResourceInfinity;
+ if (LocaleCompare(value,"unlimited") != 0)
+ limit=(MagickSizeType) SiPrefixToDouble(value,100.0);
+ (void) SetMagickResourceLimit(AreaResource,limit);
+ break;
+ }
+ if (LocaleCompare(keyword,"attenuate") == 0)
+ {
+ (void) SetImageOption(image_info,keyword,value);
+ break;
+ }
+ if (LocaleCompare(keyword,"authenticate") == 0)
+ {
+ (void) CloneString(&image_info->density,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
exception);
break;
}
+ if (LocaleCompare(keyword,"bias") == 0)
+ {
+ if (image == (Image *) NULL)
+ break;
+ image->bias=SiPrefixToDouble(value,QuantumRange);
+ break;
+ }
+ if (LocaleCompare(keyword,"blue-primary") == 0)
+ {
+ if (image == (Image *) NULL)
+ break;
+ flags=ParseGeometry(value,&geometry_info);
+ image->chromaticity.blue_primary.x=geometry_info.rho;
+ image->chromaticity.blue_primary.y=geometry_info.sigma;
+ if ((flags & SigmaValue) == 0)
+ image->chromaticity.blue_primary.y=
+ image->chromaticity.blue_primary.x;
+ break;
+ }
if (LocaleCompare(keyword,"bordercolor") == 0)
{
(void) QueryColorDatabase(value,&image_info->border_color,
if (LocaleCompare(keyword,"fill") == 0)
{
(void) QueryColorDatabase(value,&draw_info->fill,exception);
+ (void) SetImageOption(image_info,keyword,value);
+ break;
+ }
+ if (LocaleCompare(keyword,"filename") == 0)
+ {
+ (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
+ break;
+ }
+ ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
+ break;
+ }
+ case 'G':
+ case 'g':
+ {
+ if (LocaleCompare(keyword,"gravity") == 0)
+ {
+ long
+ gravity;
+
+ gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,value);
+ if (gravity < 0)
+ ThrowMSLException(OptionError,"UnrecognizedGravityType",value);
+ (void) SetImageOption(image_info,keyword,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"id") == 0)
{
- (void) SetImageProperty(msl_info->attributes[n],keyword,NULL);
- (void) SetImageProperty(msl_info->attributes[n],keyword,value);
+ (void) SetImageProperty(attributes,keyword,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
{
if (LocaleCompare(keyword,"pointsize") == 0)
{
- draw_info->pointsize=atof(value);
+ image_info->pointsize=StringToDouble(value);
+ draw_info->pointsize=StringToDouble(value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
break;
}
+ case 'Q':
+ case 'q':
+ {
+ if (LocaleCompare(keyword,"quality") == 0)
+ {
+ image_info->quality=StringToLong(value);
+ if (image == (Image *) NULL)
+ break;
+ image->quality=StringToLong(value);
+ break;
+ }
+ break;
+ }
case 'S':
case 's':
{
if (LocaleCompare(keyword,"stroke") == 0)
{
(void) QueryColorDatabase(value,&draw_info->stroke,exception);
+ (void) SetImageOption(image_info,keyword,value);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
}
return(MagickTrue);
}
+#endif
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%