#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
*/
typedef struct _MSLGroupInfo
{
- unsigned long
+ size_t
numImages; /* how many images are in this group */
} MSLGroupInfo;
ExceptionInfo
*exception;
- long
+ ssize_t
n,
number_groups;
static void MSLPushImage(MSLInfo *msl_info,Image *image)
{
- long
+ ssize_t
n;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
int
flags;
- long
+ ssize_t
option,
j,
n,
RectangleInfo
geometry;
- register long
+ register ssize_t
i;
- unsigned long
+ size_t
height,
width;
}
}
}
- (void) FormatMagickString(text,MaxTextExtent,"%lux%lu%+ld%+ld",
- geometry.width,geometry.height,geometry.x,geometry.y);
+ (void) FormatMagickString(text,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
+ geometry.height,(double) geometry.x,(double) geometry.y);
CloneString(&draw_info->geometry,text);
- draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
- draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
- draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
- draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
- draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
- current.tx;
- draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
- current.ty;
+ draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
+ draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
+ draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
+ draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
+ draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
+ affine.tx;
+ draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
+ affine.ty;
(void) AnnotateImage(msl_info->image[n],draw_info);
draw_info=DestroyDrawInfo(draw_info);
break;
{
if (LocaleCompare(keyword,"opacity") == 0)
{
- long
+ ssize_t
opacity,
y;
- register long
+ register ssize_t
x;
register PixelPacket
if (composite_image->matte != MagickTrue)
(void) SetImageOpacity(composite_image,OpaqueOpacity);
composite_view=AcquireCacheView(composite_image);
- for (y=0; y < (long) composite_image->rows ; y++)
+ for (y=0; y < (ssize_t) composite_image->rows ; y++)
{
- q=GetCacheViewAuthenticPixels(composite_view,0,y,(long)
+ q=GetCacheViewAuthenticPixels(composite_view,0,y,(ssize_t)
composite_image->columns,1,&exception);
- for (x=0; x < (long) composite_image->columns; x++)
+ for (x=0; x < (ssize_t) composite_image->columns; x++)
{
if (q->opacity == OpaqueOpacity)
- q->opacity=RoundToQuantum(opacity);
+ q->opacity=ClampToQuantum(opacity);
q++;
}
if (SyncCacheViewAuthenticPixels(composite_view,&exception) == MagickFalse)
image=msl_info->image[n];
height=composite_image->rows;
width=composite_image->columns;
- for (y=0; y < (long) image->rows; y+=height)
- for (x=0; x < (long) image->columns; x+=width)
+ for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) height)
+ for (x=0; x < (ssize_t) image->columns; x+=(ssize_t) width)
{
if (rotate_image != (Image *) NULL)
(void) CompositeImage(image,compose,rotate_image,
}
image=msl_info->image[n];
(void) FormatMagickString(composite_geometry,MaxTextExtent,
- "%lux%lu%+ld%+ld",composite_image->columns,composite_image->rows,
- geometry.x,geometry.y);
+ "%.20gx%.20g%+.20g%+.20g",(double) composite_image->columns,
+ (double) composite_image->rows,(double) geometry.x,(double)
+ geometry.y);
flags=ParseGravityGeometry(image,composite_geometry,&geometry,
&exception);
if (rotate_image == (Image *) NULL)
/*
Rotate image.
*/
- geometry.x-=(long) (rotate_image->columns-
+ geometry.x-=(ssize_t) (rotate_image->columns-
composite_image->columns)/2;
- geometry.y-=(long) (rotate_image->rows-composite_image->rows)/2;
+ geometry.y-=(ssize_t) (rotate_image->rows-composite_image->rows)/2;
CompositeImageChannel(image,channel,compose,rotate_image,
geometry.x,geometry.y);
rotate_image=DestroyImage(rotate_image);
}
if (LocaleCompare((const char *) tag,"cycle-colormap") == 0)
{
- long
+ ssize_t
display;
/*
}
}
}
- (void) FormatMagickString(text,MaxTextExtent,"%lux%lu%+ld%+ld",
- geometry.width,geometry.height,geometry.x,geometry.y);
+ (void) FormatMagickString(text,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
+ geometry.height,(double) geometry.x,(double) geometry.y);
CloneString(&draw_info->geometry,text);
- draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
- draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
- draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
- draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
- draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
- current.tx;
- draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
- current.ty;
+ draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
+ draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
+ draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
+ draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
+ draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
+ affine.tx;
+ draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
+ affine.ty;
(void) DrawImage(msl_info->image[n],draw_info);
draw_info=DestroyDrawInfo(draw_info);
break;
}
}
}
- frame_info.x=(long) frame_info.width;
- frame_info.y=(long) frame_info.height;
+ frame_info.x=(ssize_t) frame_info.width;
+ frame_info.y=(ssize_t) frame_info.height;
frame_info.width=msl_info->image[n]->columns+2*frame_info.x;
frame_info.height=msl_info->image[n]->rows+2*frame_info.y;
frame_image=FrameImage(msl_info->image[n],&frame_info,
{
if (LocaleCompare(keyword,"height") == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%ld",
- msl_info->image[n]->rows);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",
+ (double) msl_info->image[n]->rows);
(void) SetImageProperty(msl_info->attributes[n],key,value);
break;
}
{
if (LocaleCompare(keyword,"width") == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%ld",
- msl_info->image[n]->columns);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",
+ (double) msl_info->image[n]->columns);
(void) SetImageProperty(msl_info->attributes[n],key,value);
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 (profile != (StringInfo *) NULL)
{
(void) ProfileImage(msl_info->image[n],name,
- GetStringInfoDatum(profile),(unsigned long)
+ GetStringInfoDatum(profile),(size_t)
GetStringInfoLength(profile),MagickFalse);
profile=DestroyStringInfo(profile);
}
profile=GetImageProfile(profile_image,name);
if (profile != (StringInfo *) NULL)
(void) ProfileImage(msl_info->image[n],name,
- GetStringInfoDatum(profile),(unsigned long)
+ GetStringInfoDatum(profile),(size_t)
GetStringInfoLength(profile),MagickFalse);
name=GetNextImageProfile(profile_image);
}
}
}
}
- (void) FormatMagickString(text,MaxTextExtent,"%lux%lu%+ld%+ld",
- geometry.width,geometry.height,geometry.x,geometry.y);
+ (void) FormatMagickString(text,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
+ geometry.height,(double) geometry.x,(double) geometry.y);
CloneString(&draw_info->geometry,text);
- draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
- draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
- draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
- draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
- draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
- current.tx;
- draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
- current.ty;
+ draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
+ draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
+ draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
+ draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
+ draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
+ affine.tx;
+ draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
+ affine.ty;
status=GetTypeMetrics(msl_info->attributes[n],draw_info,&metrics);
if (status != MagickFalse)
{
*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,"geometry") == 0)
{
- long
+ ssize_t
flags;
flags=ParseGeometry(value,&geometry_info);
factor=1.0;
if (msl_info->image[n]->units == PixelsPerCentimeterResolution)
factor=2.54;
- width=(unsigned long) (x_resolution*msl_info->image[n]->columns/
+ width=(size_t) (x_resolution*msl_info->image[n]->columns/
(factor*(msl_info->image[n]->x_resolution == 0.0 ? DefaultResolution :
msl_info->image[n]->x_resolution))+0.5);
- height=(unsigned long) (y_resolution*msl_info->image[n]->rows/
+ height=(size_t) (y_resolution*msl_info->image[n]->rows/
(factor*(msl_info->image[n]->y_resolution == 0.0 ? DefaultResolution :
msl_info->image[n]->y_resolution))+0.5);
resample_image=ResizeImage(msl_info->image[n],width,height,
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
- long
+ ssize_t
colorspace;
colorspace=(ColorspaceType) ParseMagickOption(
{
if (LocaleCompare(keyword, "opacity") == 0)
{
- long opac = OpaqueOpacity,
- len = (long) strlen( value );
+ ssize_t opac = OpaqueOpacity,
+ len = (ssize_t) strlen( value );
if (value[len-1] == '%') {
char tmp[100];
if (image_option != (const char *) NULL)
flags=ParseAbsoluteGeometry(image_option,&geometry);
flags=ParseAbsoluteGeometry(value,&geometry);
- (void) FormatMagickString(page,MaxTextExtent,"%lux%lu",
- geometry.width,geometry.height);
+ (void) FormatMagickString(page,MaxTextExtent,"%.20gx%.20g",
+ (double) geometry.width,(double) geometry.height);
if (((flags & XValue) != 0) || ((flags & YValue) != 0))
- (void) FormatMagickString(page,MaxTextExtent,"%lux%lu%+ld%+ld",
- geometry.width,geometry.height,geometry.x,geometry.y);
+ (void) FormatMagickString(page,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,
+ (double) geometry.height,(double) geometry.x,(double)
+ geometry.y);
(void) SetImageOption(msl_info->image_info[n],keyword,page);
msl_info->image_info[n]->page=GetPageGeometry(page);
break;
}
}
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,(ssize_t) ceil(geometry_info.xi-0.5),(ssize_t)
+ 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]);
*q,
*swap;
- long
+ ssize_t
index,
swap_index;
if (LocaleCompare(keyword,"indexes") == 0)
{
flags=ParseGeometry(value,&geometry_info);
- index=(long) geometry_info.rho;
+ index=(ssize_t) geometry_info.rho;
if ((flags & SigmaValue) == 0)
- swap_index=(long) geometry_info.sigma;
+ swap_index=(ssize_t) geometry_info.sigma;
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
*/
{
BilevelImageChannel(msl_info->image[n],
- (ChannelType) ((long) (AllChannels &~ (long) OpacityChannel)),
+ (ChannelType) ((ssize_t) (AllChannels &~ (ssize_t) OpacityChannel)),
threshold);
break;
}
static void MSLEndElement(void *context,const xmlChar *tag)
{
- long
+ ssize_t
n;
MSLInfo
{
if (msl_info->group_info[msl_info->number_groups-1].numImages > 0 )
{
- long i = (long)
+ ssize_t i = (ssize_t)
(msl_info->group_info[msl_info->number_groups-1].numImages);
while ( i-- )
{
register char
*p;
- register long
+ register ssize_t
i;
/*
int
status;
- long
+ ssize_t
n;
MSLInfo
msl_info.draw_info=(DrawInfo **) AcquireMagickMemory(
sizeof(*msl_info.draw_info));
/* top of the stack is the MSL file itself */
- msl_info.image=(Image **) AcquireAlignedMemory(1,sizeof(*msl_info.image));
+ msl_info.image=(Image **) AcquireMagickMemory(sizeof(*msl_info.image));
msl_info.attributes=(Image **) AcquireMagickMemory(
sizeof(*msl_info.attributes));
msl_info.group_info=(MSLGroupInfo *) AcquireMagickMemory(
msl_image->filename);
while (ReadBlobString(msl_image,message) != (char *) NULL)
{
- n=(long) strlen(message);
+ n=(ssize_t) strlen(message);
if (n == 0)
continue;
status=xmlParseChunk(msl_info.parser,message,(int) n,MagickFalse);
%
% The format of the RegisterMSLImage method is:
%
-% unsigned long RegisterMSLImage(void)
+% size_t RegisterMSLImage(void)
%
*/
-ModuleExport unsigned long RegisterMSLImage(void)
+ModuleExport size_t RegisterMSLImage(void)
{
MagickInfo
*entry;
return(MagickImageCoderSignature);
}
\f
+#if defined(MAGICKCORE_XML_DELEGATE)
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
int
flags;
- long
+ ssize_t
n;
assert(msl_info != (MSLInfo *) NULL);
{
if (LocaleCompare(keyword,"adjoin") == 0)
{
- long
+ ssize_t
adjoin;
adjoin=ParseMagickOption(MagickBooleanOptions,MagickFalse,value);
}
if (LocaleCompare(keyword,"alpha") == 0)
{
- long
+ ssize_t
alpha;
alpha=ParseMagickOption(MagickAlphaOptions,MagickFalse,value);
}
if (LocaleCompare(keyword,"antialias") == 0)
{
- long
+ ssize_t
antialias;
antialias=ParseMagickOption(MagickBooleanOptions,MagickFalse,value);
{
if (LocaleCompare(keyword,"gravity") == 0)
{
- long
+ ssize_t
gravity;
gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,value);
}
return(MagickTrue);
}
+#endif
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%