#include "magick/image.h"
#include "magick/layer.h"
#include "magick/list.h"
+#include "magick/magick.h"
#include "magick/memory_.h"
#include "magick/monitor.h"
#include "magick/montage.h"
*/
static char
- *TracePSClippath(const unsigned char *,size_t,const unsigned long,
- const unsigned long),
- *TraceSVGClippath(const unsigned char *,size_t,const unsigned long,
- const unsigned long);
+ *TracePSClippath(const unsigned char *,size_t,const size_t,
+ const size_t),
+ *TraceSVGClippath(const unsigned char *,size_t,const size_t,
+ const size_t);
static MagickBooleanType GetIPTCProperty(const Image *image,const char *key)
{
dataset,
record;
- register long
+ register ssize_t
i;
size_t
if (count != 2)
return(MagickFalse);
attribute=(char *) NULL;
- for (i=0; i < (long) GetStringInfoLength(profile); i+=(long) length)
+ for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=(ssize_t) length)
{
length=1;
- if ((long) GetStringInfoDatum(profile)[i] != 0x1c)
+ if ((ssize_t) GetStringInfoDatum(profile)[i] != 0x1c)
continue;
length=(size_t) (GetStringInfoDatum(profile)[i+3] << 8);
length|=GetStringInfoDatum(profile)[i+4];
return(MagickTrue);
}
-static inline long MagickMax(const long x,const long y)
+static inline ssize_t MagickMax(const ssize_t x,const ssize_t y)
{
if (x > y)
return(x);
return(c);
}
-static inline unsigned long ReadPropertyMSBLong(const unsigned char **p,
+static inline size_t ReadPropertyMSBLong(const unsigned char **p,
size_t *length)
{
int
c;
- register long
+ register ssize_t
i;
unsigned char
buffer[4];
- unsigned long
+ size_t
value;
if (*length < 4)
(*length)--;
buffer[i]=(unsigned char) c;
}
- value=(unsigned long) (buffer[0] << 24);
+ value=(size_t) (buffer[0] << 24);
value|=buffer[1] << 16;
value|=buffer[2] << 8;
value|=buffer[3];
int
c;
- register long
+ register ssize_t
i;
unsigned char
*info;
long
- id,
start,
- stop,
- sub_number;
+ stop;
MagickBooleanType
status;
- register long
+ register ssize_t
i;
ssize_t
- count;
+ count,
+ id,
+ sub_number;
size_t
length;
*name='\0';
sub_number=1;
if (*name == '#')
- sub_number=StringToLong(&name[1]);
+ sub_number=(ssize_t) StringToLong(&name[1]);
sub_number=MagickMax(sub_number,1L);
resource=(char *) NULL;
status=MagickFalse;
continue;
if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')
continue;
- id=(long) ReadPropertyMSBShort(&info,&length);
- if (id < start)
+ id=(ssize_t) ReadPropertyMSBShort(&info,&length);
+ if (id < (ssize_t) start)
continue;
- if (id > stop)
+ if (id > (ssize_t) stop)
continue;
if (resource != (char *) NULL)
resource=DestroyString(resource);
sizeof(*resource));
if (resource != (char *) NULL)
{
- for (i=0; i < (long) count; i++)
+ for (i=0; i < (ssize_t) count; i++)
resource[i]=(char) ReadPropertyByte(&info,&length);
resource[count]='\0';
}
return((unsigned short) (value & 0xffff));
}
-static inline unsigned long ReadPropertyLong(const EndianType endian,
+static inline size_t ReadPropertyLong(const EndianType endian,
const unsigned char *buffer)
{
- unsigned long
+ size_t
value;
if (endian == MSBEndian)
{
- value=(unsigned long) ((buffer[0] << 24) | (buffer[1] << 16) |
+ value=(size_t) ((buffer[0] << 24) | (buffer[1] << 16) |
(buffer[2] << 8) | buffer[3]);
- return((unsigned long) (value & 0xffffffff));
+ return((size_t) (value & 0xffffffff));
}
- value=(unsigned long) ((buffer[3] << 24) | (buffer[2] << 16) |
+ value=(size_t) ((buffer[3] << 24) | (buffer[2] << 16) |
(buffer[1] << 8 ) | (buffer[0]));
- return((unsigned long) (value & 0xffffffff));
+ return((size_t) (value & 0xffffffff));
}
static MagickBooleanType GetEXIFProperty(const Image *image,
#define EXIFMultipleValues(size, format, arg) \
{ \
- long \
+ ssize_t \
component; \
\
size_t \
#define EXIFMultipleFractions(size, format, arg1, arg2) \
{ \
- long \
+ ssize_t \
component; \
\
size_t \
const unsigned char
*directory;
- unsigned long
+ size_t
entry,
offset;
} DirectoryInfo;
typedef struct _TagInfo
{
- unsigned long
+ size_t
tag;
const char
EndianType
endian;
- long
+ ssize_t
all,
id,
level,
tag_value;
- register long
+ register ssize_t
i;
size_t
static int
tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
- unsigned long
+ size_t
entry,
number_entries,
tag_offset,
n/=4;
do
{
- for (i=(long) n-1L; i >= 0; i--)
+ for (i=(ssize_t) n-1L; i >= 0; i--)
{
c=(*property++);
tag<<=4;
break;
if (LocaleCompare(EXIFTag[i].description,property) == 0)
{
- tag=(unsigned long) EXIFTag[i].tag;
+ tag=(size_t) EXIFTag[i].tag;
break;
}
}
}
if (length < 16)
return(MagickFalse);
- id=(long) ReadPropertyShort(LSBEndian,exif);
+ id=(ssize_t) ReadPropertyShort(LSBEndian,exif);
endian=LSBEndian;
if (id == 0x4949)
endian=LSBEndian;
number_entries=ReadPropertyShort(endian,directory);
for ( ; entry < number_entries; entry++)
{
- long
+ ssize_t
components;
register unsigned char
size_t
number_bytes;
- unsigned long
+ size_t
format;
q=(unsigned char *) (directory+2+(12*entry));
- tag_value=(long) ReadPropertyShort(endian,q)+tag_offset;
- format=(unsigned long) ReadPropertyShort(endian,q+2);
+ tag_value=(ssize_t) (ReadPropertyShort(endian,q)+tag_offset);
+ format=(size_t) ReadPropertyShort(endian,q+2);
if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes)))
break;
- components=(long) ReadPropertyLong(endian,q+4);
+ components=(ssize_t) ReadPropertyLong(endian,q+4);
number_bytes=(size_t) components*tag_bytes[format];
if (number_bytes <= 4)
p=q+8;
continue;
p=(unsigned char *) (exif+offset);
}
- if ((all != 0) || (tag == (unsigned long) tag_value))
+ if ((all != 0) || (tag == (size_t) tag_value))
{
char
buffer[MaxTextExtent],
case EXIF_FMT_BYTE:
case EXIF_FMT_UNDEFINED:
{
- EXIFMultipleValues(1,"%lu",(unsigned long)
+ EXIFMultipleValues(1,"%.20g",(double)
(*(unsigned char *) p1));
break;
}
case EXIF_FMT_SBYTE:
{
- EXIFMultipleValues(1,"%ld",(long) (*(signed char *) p1));
+ EXIFMultipleValues(1,"%.20g",(double) (*(signed char *) p1));
break;
}
case EXIF_FMT_SSHORT:
}
case EXIF_FMT_ULONG:
{
- EXIFMultipleValues(4,"%lu",ReadPropertyLong(endian,p1));
+ EXIFMultipleValues(4,"%.20g",(double)
+ ReadPropertyLong(endian,p1));
break;
}
case EXIF_FMT_SLONG:
{
- EXIFMultipleValues(4,"%ld",ReadPropertyLong(endian,p1));
+ EXIFMultipleValues(4,"%.20g",(double)
+ ReadPropertyLong(endian,p1));
break;
}
case EXIF_FMT_URATIONAL:
{
- EXIFMultipleFractions(8,"%ld/%ld",ReadPropertyLong(endian,p1),
+ EXIFMultipleFractions(8,"%.20g/%.20g",(double)
+ ReadPropertyLong(endian,p1),(double)
ReadPropertyLong(endian,p1+4));
break;
}
case EXIF_FMT_SRATIONAL:
{
- EXIFMultipleFractions(8,"%ld/%ld",ReadPropertyLong(endian,p1),
+ EXIFMultipleFractions(8,"%.20g/%.20g",(double)
+ ReadPropertyLong(endian,p1),(double)
ReadPropertyLong(endian,p1+4));
break;
}
sizeof(*value));
if (value != (char *) NULL)
{
- register long
+ register ssize_t
i;
- for (i=0; i < (long) number_bytes; i++)
+ for (i=0; i < (ssize_t) number_bytes; i++)
{
value[i]='.';
if ((isprint((int) p[i]) != 0) || (p[i] == '\0'))
const char
*description;
- register long
+ register ssize_t
i;
description="unknown";
{
if (EXIFTag[i].tag == 0)
break;
- if ((long) EXIFTag[i].tag == tag_value)
+ if ((ssize_t) EXIFTag[i].tag == tag_value)
{
description=EXIFTag[i].description;
break;
{
if (tag_value < 0x10000)
(void) FormatMagickString(key,MaxTextExtent,"#%04lx",
- tag_value);
+ (unsigned long) tag_value);
else
if (tag_value < 0x20000)
(void) FormatMagickString(key,MaxTextExtent,"@%04lx",
- tag_value & 0xffff);
+ (unsigned long) (tag_value & 0xffff));
else
(void) FormatMagickString(key,MaxTextExtent,"unknown");
break;
offset=(size_t) ReadPropertyLong(endian,p);
if ((offset < length) && (level < (MaxDirectoryStack-2)))
{
- unsigned long
+ size_t
tag_offset1;
tag_offset1=(tag_value == TAG_GPS_OFFSET) ? 0x10000UL : 0UL;
}
static char *TracePSClippath(const unsigned char *blob,size_t length,
- const unsigned long magick_unused(columns),
- const unsigned long magick_unused(rows))
+ const size_t magick_unused(columns),
+ const size_t magick_unused(rows))
{
char
*path,
*message;
- long
+ ssize_t
knot_count,
selector,
y;
last[3],
point[3];
- register long
+ register ssize_t
i,
x;
in_subpath=MagickFalse;
while (length > 0)
{
- selector=(long) ReadPropertyMSBShort(&blob,&length);
+ selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
switch (selector)
{
case 0:
/*
Expected subpath length record.
*/
- knot_count=(long) ReadPropertyMSBShort(&blob,&length);
+ knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
blob+=22;
length-=22;
break;
*/
for (i=0; i < 3; i++)
{
- unsigned long
+ size_t
xx,
yy;
yy=ReadPropertyMSBLong(&blob,&length);
xx=ReadPropertyMSBLong(&blob,&length);
- x=(long) xx;
+ x=(ssize_t) xx;
if (xx > 2147483647)
- x=xx-4294967295-1;
- y=(long) yy;
+ x=(ssize_t) xx-4294967295-1;
+ y=(ssize_t) yy;
if (yy > 2147483647)
- y=yy-4294967295-1;
+ y=(ssize_t) yy-4294967295-1;
point[i].x=(double) x/4096/4096;
point[i].y=1.0-(double) y/4096/4096;
}
*/
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(point[0].x == point[1].x) && (point[0].y == point[1].y))
- (void) FormatMagickString(message,MaxTextExtent," %g %g l\n",
- point[1].x,point[1].y);
+ (void) FormatMagickString(message,MaxTextExtent,
+ " %g %g l\n",point[1].x,point[1].y);
else
if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
(void) FormatMagickString(message,MaxTextExtent,
- " %g %g %g %g v\n",point[0].x,point[0].y,point[1].x,
- point[1].y);
+ " %g %g %g %g v\n",point[0].x,point[0].y,
+ point[1].x,point[1].y);
else
if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
(void) FormatMagickString(message,MaxTextExtent,
- " %g %g %g %g y\n",last[2].x,last[2].y,point[1].x,
- point[1].y);
+ " %g %g %g %g y\n",last[2].x,last[2].y,
+ point[1].x,point[1].y);
else
(void) FormatMagickString(message,MaxTextExtent,
- " %g %g %g %g %g %g c\n",last[2].x,last[2].y,point[0].x,
- point[0].y,point[1].x,point[1].y);
+ " %g %g %g %g %g %g c\n",last[2].x,
+ last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
for (i=0; i < 3; i++)
last[i]=point[i];
}
*/
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(first[0].x == first[1].x) && (first[0].y == first[1].y))
- (void) FormatMagickString(message,MaxTextExtent," %g %g l z\n",
- first[1].x,first[1].y);
+ (void) FormatMagickString(message,MaxTextExtent,
+ " %g %g l z\n",first[1].x,first[1].y);
else
if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
(void) FormatMagickString(message,MaxTextExtent,
- " %g %g %g %g v z\n",first[0].x,first[0].y,first[1].x,
- first[1].y);
+ " %g %g %g %g v z\n",first[0].x,first[0].y,
+ first[1].x,first[1].y);
else
if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
(void) FormatMagickString(message,MaxTextExtent,
- " %g %g %g %g y z\n",last[2].x,last[2].y,first[1].x,
- first[1].y);
+ " %g %g %g %g y z\n",last[2].x,last[2].y,
+ first[1].x,first[1].y);
else
(void) FormatMagickString(message,MaxTextExtent,
- " %g %g %g %g %g %g c z\n",last[2].x,last[2].y,first[0].x,
- first[0].y,first[1].x,first[1].y);
+ " %g %g %g %g %g %g c z\n",last[2].x,
+ last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
(void) ConcatenateString(&path,message);
in_subpath=MagickFalse;
}
}
static char *TraceSVGClippath(const unsigned char *blob,size_t length,
- const unsigned long columns,const unsigned long rows)
+ const size_t columns,const size_t rows)
{
char
*path,
*message;
- long
+ ssize_t
knot_count,
selector,
x,
last[3],
point[3];
- register long
+ register ssize_t
i;
path=AcquireString((char *) NULL);
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
(void) ConcatenateString(&path,message);
(void) FormatMagickString(message,MaxTextExtent,
- "<svg width=\"%lu\" height=\"%lu\">\n",columns,rows);
+ "<svg width=\"%.20g\" height=\"%.20g\">\n",(double) columns,(double) rows);
(void) ConcatenateString(&path,message);
(void) FormatMagickString(message,MaxTextExtent,"<g>\n");
(void) ConcatenateString(&path,message);
in_subpath=MagickFalse;
while (length != 0)
{
- selector=(long) ReadPropertyMSBShort(&blob,&length);
+ selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
switch (selector)
{
case 0:
/*
Expected subpath length record.
*/
- knot_count=(long) ReadPropertyMSBShort(&blob,&length);
+ knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
blob+=22;
length-=22;
break;
*/
for (i=0; i < 3; i++)
{
- unsigned long
+ size_t
xx,
yy;
yy=ReadPropertyMSBLong(&blob,&length);
xx=ReadPropertyMSBLong(&blob,&length);
- x=(long) xx;
+ x=(ssize_t) xx;
if (xx > 2147483647)
- x=xx-4294967295-1;
- y=(long) yy;
+ x=(ssize_t) xx-4294967295-1;
+ y=(ssize_t) yy;
if (yy > 2147483647)
- y=yy-4294967295-1;
+ y=(ssize_t) yy-4294967295-1;
point[i].x=(double) x*columns/4096/4096;
point[i].y=(double) y*rows/4096/4096;
}
{
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(first[0].x == first[1].x) && (first[0].y == first[1].y))
- (void) FormatMagickString(message,MaxTextExtent,"L %g,%g Z\n",
- first[1].x,first[1].y);
+ (void) FormatMagickString(message,MaxTextExtent,
+ "L %g,%g Z\n",first[1].x,first[1].y);
else
{
(void) FormatMagickString(message,MaxTextExtent,
- "C %g,%g %g,%g %g,%g Z\n",last[2].x,last[2].y,
- first[0].x,first[0].y,first[1].x,first[1].y);
+ "C %g,%g %g,%g %g,%g Z\n",last[2].x,
+ last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
(void) ConcatenateString(&path,message);
}
in_subpath=MagickFalse;
image->properties);
return(p);
}
- if ((image->properties != (void *) NULL) &&
- (LocaleNCompare("fx:",property,3) != 0))
+ if (image->properties != (void *) NULL)
{
p=(const char *) GetValueFromSplayTree((SplayTreeInfo *)
image->properties,property);
char
value[MaxTextExtent];
- (void) FormatMagickString(value,MaxTextExtent,"%g",(double)
- alpha);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),(double) alpha);
(void) SetImageProperty((Image *) image,property,value);
}
p=(const char *) GetValueFromSplayTree((SplayTreeInfo *)
filename[MaxTextExtent];
*value='\0';
- switch (*(property))
+ switch (*property)
{
case 'b':
{
Image channels.
*/
(void) FormatMagickString(value,MaxTextExtent,"%s",
- MagickOptionToMnemonic(MagickColorspaceOptions,(long)
+ MagickOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
image->colorspace));
LocaleLower(value);
if (image->matte != MagickFalse)
if (IsGrayImage(image,&image->exception) != MagickFalse)
colorspace=GRAYColorspace;
(void) FormatMagickString(value,MaxTextExtent,"%s",
- MagickOptionToMnemonic(MagickColorspaceOptions,(long) colorspace));
+ MagickOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
+ colorspace));
break;
}
break;
{
if (LocaleNCompare("depth",property,5) == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",image->depth);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
+ image->depth);
break;
}
if (LocaleNCompare("directory",property,9) == 0)
if (LocaleNCompare("group",property,5) == 0)
{
(void) FormatMagickString(value,MaxTextExtent,"0x%lx",
- image_info->group);
+ (unsigned long) image_info->group);
break;
}
break;
{
if (LocaleNCompare("height",property,6) == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",
- image->magick_rows != 0 ? image->magick_rows : 256UL);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",
+ image->magick_rows != 0 ? (double) image->magick_rows : 256.0);
break;
}
break;
(void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
&skewness,&image->exception);
- (void) FormatMagickString(value,MaxTextExtent,"%g",kurtosis);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),kurtosis);
break;
}
break;
(void) GetImageChannelRange(image,image_info->channel,&minimum,
&maximum,&image->exception);
- (void) FormatMagickString(value,MaxTextExtent,"%g",maximum);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),maximum);
break;
}
if (LocaleNCompare("mean",property,4) == 0)
(void) GetImageChannelMean(image,image_info->channel,&mean,
&standard_deviation,&image->exception);
- (void) FormatMagickString(value,MaxTextExtent,"%g",mean);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),mean);
break;
}
if (LocaleNCompare("min",property,3) == 0)
(void) GetImageChannelRange(image,image_info->channel,&minimum,
&maximum,&image->exception);
- (void) FormatMagickString(value,MaxTextExtent,"%g",minimum);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),minimum);
break;
}
break;
register const Image
*p;
- unsigned long
+ size_t
page;
p=image;
for (page=1; GetPreviousImageInList(p) != (Image *) NULL; page++)
p=GetPreviousImageInList(p);
- (void) FormatMagickString(value,MaxTextExtent,"%lu",page);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
+ page);
break;
}
break;
format[MaxTextExtent];
(void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
- (void) FormatMagickString(value,MaxTextExtent,"%s",format);
+ (void) FormatMagickString(value,MaxTextExtent,"%sB",format);
break;
}
if (LocaleNCompare("scenes",property,6) == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",
- (unsigned long) GetImageListLength(image));
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
+ GetImageListLength(image));
break;
}
if (LocaleNCompare("scene",property,5) == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",image->scene);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
+ image->scene);
if (image_info->number_scenes != 0)
- (void) FormatMagickString(value,MaxTextExtent,"%lu",
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
image_info->scene);
break;
}
(void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
&skewness,&image->exception);
- (void) FormatMagickString(value,MaxTextExtent,"%g",skewness);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),skewness);
break;
}
if ((LocaleNCompare("standard-deviation",property,18) == 0) ||
(void) GetImageChannelMean(image,image_info->channel,&mean,
&standard_deviation,&image->exception);
- (void) FormatMagickString(value,MaxTextExtent,"%g",
- standard_deviation);
+ (void) FormatMagickString(value,MaxTextExtent,"%.*g",
+ GetMagickPrecision(),standard_deviation);
break;
}
break;
{
if (LocaleNCompare("width",property,5) == 0)
{
- (void) FormatMagickString(value,MaxTextExtent,"%lu",
- image->magick_columns != 0 ? image->magick_columns : 256UL);
+ (void) FormatMagickString(value,MaxTextExtent,"%.20g",(double)
+ (image->magick_columns != 0 ? image->magick_columns : 256));
break;
}
break;
register const char
*p;
- register long
+ register ssize_t
i;
size_t
char
format[MaxTextExtent];
- MagickSizeType
- length;
-
/*
File size.
*/
- length=GetBlobSize(image);
- (void) FormatMagickString(format,MaxTextExtent,"%lu",(unsigned long)
- length);
- if (length != (MagickSizeType) ((size_t) length))
- (void) FormatMagickSize(length,MagickFalse,format);
+ (void) FormatMagickString(format,MaxTextExtent,"%.20g",(double)
+ image->extent);
+ if (image->extent != (MagickSizeType) ((size_t) image->extent))
+ (void) FormatMagickSize(image->extent,MagickFalse,format);
q+=ConcatenateMagickString(q,format,extent);
+ q+=ConcatenateMagickString(q,"B",extent);
break;
}
case 'c':
/*
Image geometry.
*/
- q+=FormatMagickString(q,extent,"%lux%lu%+ld%+ld",image->page.width,
- image->page.height,image->page.x,image->page.y);
+ q+=FormatMagickString(q,extent,"%.20gx%.20g%+.20g%+.20g",(double)
+ image->page.width,(double) image->page.height,(double)
+ image->page.x,(double) image->page.y);
break;
}
case 'h':
/*
Image height.
*/
- q+=FormatMagickString(q,extent,"%lu",image->rows != 0 ? image->rows :
- image->magick_rows);
+ q+=FormatMagickString(q,extent,"%.20g",(double)
+ (image->rows != 0 ? image->rows : image->magick_rows));
break;
}
case 'i':
/*
Number of unique colors.
*/
- q+=FormatMagickString(q,extent,"%lu",GetNumberColors(image,
- (FILE *) NULL,&image->exception));
+ q+=FormatMagickString(q,extent,"%.20g",(double)
+ GetNumberColors(image,(FILE *) NULL,&image->exception));
break;
}
case 'l':
/*
Number of images in the list.
*/
- q+=FormatMagickString(q,extent,"%lu",(unsigned long)
+ q+=FormatMagickString(q,extent,"%.20g",(double)
GetImageListLength(image));
break;
}
register const Image
*p;
- unsigned long
+ size_t
page;
/*
p=image;
for (page=1; GetPreviousImageInList(p) != (Image *) NULL; page++)
p=GetPreviousImageInList(p);
- q+=FormatMagickString(q,extent,"%lu",page);
+ q+=FormatMagickString(q,extent,"%.20g",(double) page);
break;
}
case 'q':
/*
Image depth.
*/
- q+=FormatMagickString(q,extent,"%lu",image->depth);
+ q+=FormatMagickString(q,extent,"%.20g",(double) image->depth);
break;
}
case 'r':
if (IsGrayImage(image,&image->exception) != MagickFalse)
colorspace=GRAYColorspace;
q+=FormatMagickString(q,extent,"%s%s%s",MagickOptionToMnemonic(
- MagickClassOptions,(long) image->storage_class),
- MagickOptionToMnemonic(MagickColorspaceOptions,(long) colorspace),
+ MagickClassOptions,(ssize_t) image->storage_class),
+ MagickOptionToMnemonic(MagickColorspaceOptions,(ssize_t) colorspace),
image->matte != MagickFalse ? "Matte" : "");
break;
}
Image scene number.
*/
if (text_info->number_scenes == 0)
- q+=FormatMagickString(q,extent,"%lu",image->scene);
+ q+=FormatMagickString(q,extent,"%.20g",(double) image->scene);
else
- q+=FormatMagickString(q,extent,"%lu",text_info->scene);
+ q+=FormatMagickString(q,extent,"%.20g",(double) text_info->scene);
break;
}
case 'u':
/*
Image width.
*/
- q+=FormatMagickString(q,extent,"%lu",image->columns != 0 ?
- image->columns : image->magick_columns);
+ q+=FormatMagickString(q,extent,"%.20g",(double)
+ (image->columns != 0 ? image->columns : image->magick_columns));
break;
}
case 'x':
Image horizontal resolution.
*/
q+=FormatMagickString(q,extent,"%g %s",image->x_resolution,
- MagickOptionToMnemonic(MagickResolutionOptions,(long) image->units));
+ MagickOptionToMnemonic(MagickResolutionOptions,(ssize_t)
+ image->units));
break;
}
case 'y':
Image vertical resolution.
*/
q+=FormatMagickString(q,extent,"%g %s",image->y_resolution,
- MagickOptionToMnemonic(MagickResolutionOptions,(long) image->units));
+ MagickOptionToMnemonic(MagickResolutionOptions,(ssize_t)
+ image->units));
break;
}
case 'z':
/*
Image depth.
*/
- q+=FormatMagickString(q,extent,"%lu",image->depth);
+ q+=FormatMagickString(q,extent,"%.20g",(double) image->depth);
break;
}
case 'A':
Image alpha channel.
*/
q+=FormatMagickString(q,extent,"%s",MagickOptionToMnemonic(
- MagickBooleanOptions,(long) image->matte));
+ MagickBooleanOptions,(ssize_t) image->matte));
break;
}
case 'C':
Image compression method.
*/
q+=FormatMagickString(q,extent,"%s",MagickOptionToMnemonic(
- MagickCompressOptions,(long) image->compression));
+ MagickCompressOptions,(ssize_t) image->compression));
break;
}
case 'D':
Image dispose method.
*/
q+=FormatMagickString(q,extent,"%s",MagickOptionToMnemonic(
- MagickDisposeOptions,(long) image->dispose));
+ MagickDisposeOptions,(ssize_t) image->dispose));
break;
}
case 'G':
{
- q+=FormatMagickString(q,extent,"%lux%lu",image->magick_columns,
- image->magick_rows);
+ q+=FormatMagickString(q,extent,"%.20gx%.20g",(double)
+ image->magick_columns,(double) image->magick_rows);
break;
}
case 'H':
{
- q+=FormatMagickString(q,extent,"%ld",image->page.height);
+ q+=FormatMagickString(q,extent,"%.20g",(double)
+ image->page.height);
break;
}
case 'O':
{
- q+=FormatMagickString(q,extent,"%+ld%+ld",image->page.x,image->page.y);
+ q+=FormatMagickString(q,extent,"%+ld%+ld",(long) image->page.x,
+ (long) image->page.y);
break;
}
case 'P':
{
- q+=FormatMagickString(q,extent,"%lux%lu",image->page.width,
- image->page.height);
+ q+=FormatMagickString(q,extent,"%.20gx%.20g",(double) image->page.width,
+ (double) image->page.height);
break;
}
case 'Q':
{
- q+=FormatMagickString(q,extent,"%lu",image->quality);
+ q+=FormatMagickString(q,extent,"%.20g",(double) image->quality);
break;
}
case 'S':
if (text_info->number_scenes == 0)
q+=CopyMagickString(q,"2147483647",extent);
else
- q+=FormatMagickString(q,extent,"%lu",text_info->scene+
- text_info->number_scenes);
+ q+=FormatMagickString(q,extent,"%.20g",(double)
+ (text_info->scene+text_info->number_scenes));
break;
}
case 'T':
{
- q+=FormatMagickString(q,extent,"%lu",image->delay);
+ q+=FormatMagickString(q,extent,"%.20g",(double) image->delay);
break;
}
case 'W':
{
- q+=FormatMagickString(q,extent,"%ld",image->page.width);
+ q+=FormatMagickString(q,extent,"%.20g",(double) image->page.width);
break;
}
case 'X':
{
- q+=FormatMagickString(q,extent,"%+ld",image->page.x);
+ q+=FormatMagickString(q,extent,"%+.20g",(double) image->page.x);
break;
}
case 'Y':
{
- q+=FormatMagickString(q,extent,"%+ld",image->page.y);
+ q+=FormatMagickString(q,extent,"%+.20g",(double) image->page.y);
break;
}
case 'Z':
*key,
*value;
- long
+ ssize_t
depth;
/*
}
(void) CopyMagickString(q,value,extent);
q+=length;
+ break;
}
if (image_info == (ImageInfo *) NULL)
break;
}
(void) CopyMagickString(q,value,extent);
q+=length;
+ break;
}
break;
}
Image bounding box.
*/
page=GetImageBoundingBox(image,&image->exception);
- q+=FormatMagickString(q,MaxTextExtent,"%lux%lu%+ld%+ld",page.width,
- page.height,page.x,page.y);
+ q+=FormatMagickString(q,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
+ (double) page.width,(double) page.height,(double) page.x,(double)
+ page.y);
break;
}
case '#':
MagickExport MagickBooleanType SetImageProperty(Image *image,
const char *property,const char *value)
{
+ ExceptionInfo
+ *exception;
+
MagickBooleanType
status;
if ((value == (const char *) NULL) || (*value == '\0'))
return(DeleteImageProperty(image,property));
status=MagickTrue;
+ exception=(&image->exception);
switch (*property)
{
case 'B':
case 'b':
{
+ if (LocaleCompare(property,"background") == 0)
+ {
+ (void) QueryColorDatabase(value,&image->background_color,exception);
+ break;
+ }
if (LocaleCompare(property,"bias") == 0)
{
image->bias=SiPrefixToDouble(value,QuantumRange);
{
if (LocaleCompare(property,"colorspace") == 0)
{
- long
+ ssize_t
colorspace;
colorspace=ParseMagickOption(MagickColorspaceOptions,MagickFalse,
}
if (LocaleCompare(property,"compose") == 0)
{
- long
+ ssize_t
compose;
compose=ParseMagickOption(MagickComposeOptions,MagickFalse,value);
}
if (LocaleCompare(property,"compress") == 0)
{
- long
+ ssize_t
compression;
compression=ParseMagickOption(MagickCompressOptions,MagickFalse,
flags=ParseGeometry(value,&geometry_info);
if ((flags & GreaterValue) != 0)
{
- if (image->delay > (unsigned long) (geometry_info.rho+0.5))
- image->delay=(unsigned long) (geometry_info.rho+0.5);
+ if (image->delay > (size_t) floor(geometry_info.rho+0.5))
+ image->delay=(size_t) floor(geometry_info.rho+0.5);
}
else
if ((flags & LessValue) != 0)
{
- if (image->delay < (unsigned long) (geometry_info.rho+0.5))
- image->ticks_per_second=(long) (geometry_info.sigma+0.5);
+ if (image->delay < (size_t) floor(geometry_info.rho+0.5))
+ image->ticks_per_second=(ssize_t)
+ floor(geometry_info.sigma+0.5);
}
else
- image->delay=(unsigned long) (geometry_info.rho+0.5);
+ image->delay=(size_t) floor(geometry_info.rho+0.5);
if ((flags & SigmaValue) != 0)
- image->ticks_per_second=(long) (geometry_info.sigma+0.5);
+ image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
break;
}
+ if (LocaleCompare(property,"density") == 0)
+ {
+ GeometryInfo
+ geometry_info;
+
+ flags=ParseGeometry(value,&geometry_info);
+ image->x_resolution=geometry_info.rho;
+ image->y_resolution=geometry_info.sigma;
+ if ((flags & SigmaValue) == 0)
+ image->y_resolution=image->x_resolution;
+ }
if (LocaleCompare(property,"depth") == 0)
{
- image->depth=(unsigned long) StringToLong(value);
+ image->depth=StringToUnsignedLong(value);
break;
}
if (LocaleCompare(property,"dispose") == 0)
{
- long
+ ssize_t
dispose;
dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,value);
{
if (LocaleCompare(property,"gravity") == 0)
{
- long
+ ssize_t
gravity;
gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,value);
{
if (LocaleCompare(property,"intent") == 0)
{
- long
+ ssize_t
rendering_intent;
rendering_intent=ParseMagickOption(MagickIntentOptions,MagickFalse,
}
if (LocaleCompare(property,"interpolate") == 0)
{
- long
+ ssize_t
interpolate;
interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
{
if (LocaleCompare(property,"loop") == 0)
{
- image->iterations=(unsigned long) StringToLong(value);
+ image->iterations=StringToUnsignedLong(value);
break;
}
status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
geometry=DestroyString(geometry);
break;
}
+ if (LocaleCompare(property,"profile") == 0)
+ {
+ ImageInfo
+ *image_info;
+
+ StringInfo
+ *profile;
+
+ image_info=AcquireImageInfo();
+ (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
+ (void) SetImageInfo(image_info,1,exception);
+ profile=FileToStringInfo(image_info->filename,~0UL,exception);
+ if (profile != (StringInfo *) NULL)
+ status=SetImageProfile(image,image_info->magick,profile);
+ image_info=DestroyImageInfo(image_info);
+ break;
+ }
status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
ConstantString(property),ConstantString(value));
break;
{
if (LocaleCompare(property,"rendering-intent") == 0)
{
- long
+ ssize_t
rendering_intent;
rendering_intent=ParseMagickOption(MagickIntentOptions,MagickFalse,
ConstantString(property),ConstantString(value));
break;
}
+ case 'U':
+ case 'u':
+ {
+ if (LocaleCompare(property,"units") == 0)
+ {
+ ssize_t
+ units;
+
+ units=ParseMagickOption(MagickResolutionOptions,MagickFalse,value);
+ if (units < 0)
+ break;
+ image->units=(ResolutionType) units;
+ break;
+ }
+ status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
+ ConstantString(property),ConstantString(value));
+ break;
+ }
default:
{
status=AddValueToSplayTree((SplayTreeInfo *) image->properties,