% March 2000 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 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 %
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
for (p=comment; comment != (char *) NULL; p++)
{
c=ReadBlobByte(image);
- if ((c == EOF) || (c == (int) '}'))
- break;
+ if (c == (int) '\\')
+ c=ReadBlobByte(image);
+ else
+ if ((c == EOF) || (c == (int) '}'))
+ break;
if ((size_t) (p-comment+1) >= length)
{
*p='\0';
if (comment == (char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
*p='\0';
- (void) SetImageProperty(image,"comment",comment);
+ (void) SetImageProperty(image,"comment",comment,exception);
comment=DestroyString(comment);
c=ReadBlobByte(image);
}
"MemoryAllocationFailed");
*p++=(char) c;
c=ReadBlobByte(image);
+ if (c == '\\')
+ {
+ c=ReadBlobByte(image);
+ if (c == (int) '}')
+ {
+ *p++=(char) c;
+ c=ReadBlobByte(image);
+ }
+ }
if (*options != '{')
if (isspace((int) ((unsigned char) c)) != 0)
break;
{
if (LocaleCompare(keyword,"background-color") == 0)
{
- (void) QueryColorDatabase(options,&image->background_color,
- exception);
+ (void) QueryColorCompliance(options,AllCompliance,
+ &image->background_color,exception);
break;
}
if (LocaleCompare(keyword,"blue-primary") == 0)
}
if (LocaleCompare(keyword,"border-color") == 0)
{
- (void) QueryColorDatabase(options,&image->border_color,
- exception);
+ (void) QueryColorCompliance(options,AllCompliance,
+ &image->border_color,exception);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'c':
image->columns=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'd':
image->dispose=(DisposeType) dispose;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'e':
}
if (LocaleCompare(keyword,"error") == 0)
{
- image->error.mean_error_per_pixel=InterpretLocaleValue(
- options,(char **) NULL);
+ image->error.mean_error_per_pixel=StringToDouble(options,
+ (char **) NULL);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'g':
{
if (LocaleCompare(keyword,"gamma") == 0)
{
- image->gamma=InterpretLocaleValue(options,(char **) NULL);
+ image->gamma=StringToDouble(options,(char **) NULL);
break;
}
if (LocaleCompare(keyword,"green-primary") == 0)
image->chromaticity.green_primary.x;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'i':
image->iterations=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'm':
}
if (LocaleCompare(keyword,"matte-color") == 0)
{
- (void) QueryColorDatabase(options,&image->matte_color,
- exception);
+ (void) QueryColorCompliance(options,AllCompliance,
+ &image->matte_color,exception);
break;
}
if (LocaleCompare(keyword,"maximum-error") == 0)
{
- image->error.normalized_maximum_error=
- InterpretLocaleValue(options,(char **) NULL);
+ image->error.normalized_maximum_error=StringToDouble(
+ options,(char **) NULL);
break;
}
if (LocaleCompare(keyword,"mean-error") == 0)
{
- image->error.normalized_mean_error=InterpretLocaleValue(
- options,(char **) NULL);
+ image->error.normalized_mean_error=StringToDouble(options,
+ (char **) NULL);
break;
}
if (LocaleCompare(keyword,"montage") == 0)
(void) CloneString(&image->montage,options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'o':
image->orientation=(OrientationType) orientation;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'p':
if (profile == (StringInfo *) NULL)
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
- (void) SetImageProfile(image,keyword+8,profile);
+ (void) SetImageProfile(image,keyword+8,profile,exception);
profile=DestroyStringInfo(profile);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'q':
quantum_depth=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'r':
if (LocaleCompare(keyword,"resolution") == 0)
{
flags=ParseGeometry(options,&geometry_info);
- image->x_resolution=geometry_info.rho;
- image->y_resolution=geometry_info.sigma;
+ image->resolution.x=geometry_info.rho;
+ image->resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
- image->y_resolution=image->x_resolution;
+ image->resolution.y=image->resolution.x;
break;
}
if (LocaleCompare(keyword,"rows") == 0)
image->rows=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 's':
image->scene=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 't':
image->type=(ImageType) type;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'u':
ssize_t
units;
- units=ParseCommandOption(MagickResolutionOptions,MagickFalse,
- options);
+ units=ParseCommandOption(MagickResolutionOptions,
+ MagickFalse,options);
if (units < 0)
break;
image->units=(ResolutionType) units;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'w':
image->chromaticity.white_point.x;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
default:
{
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
}
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
CommandOptionToMnemonic(MagickResolutionOptions,image->units));
(void) WriteBlobString(image,buffer);
}
- if ((image->x_resolution != 0) || (image->y_resolution != 0))
+ if ((image->resolution.x != 0) || (image->resolution.y != 0))
{
(void) FormatLocaleString(buffer,MaxTextExtent,
- "resolution=%gx%g\n",image->x_resolution,image->y_resolution);
+ "resolution=%gx%g\n",image->resolution.x,image->resolution.y);
(void) WriteBlobString(image,buffer);
}
if ((image->page.width != 0) || (image->page.height != 0))
{
(void) FormatLocaleString(buffer,MaxTextExtent,"%s=",property);
(void) WriteBlobString(image,buffer);
- value=GetImageProperty(image,property);
+ value=GetImageProperty(image,property,exception);
if (value != (const char *) NULL)
{
for (i=0; i < (ssize_t) strlen(value); i++)
if (isspace((int) ((unsigned char) value[i])) != 0)
break;
- if (i <= (ssize_t) strlen(value))
- (void) WriteBlobByte(image,'{');
- (void) WriteBlob(image,strlen(value),(unsigned char *) value);
- if (i <= (ssize_t) strlen(value))
- (void) WriteBlobByte(image,'}');
+ if (i == (ssize_t) strlen(value))
+ (void) WriteBlob(image,strlen(value),(const unsigned char *) value);
+ else
+ {
+ (void) WriteBlobByte(image,'{');
+ for (i=0; i < (ssize_t) strlen(value); i++)
+ {
+ if (value[i] == (int) '}')
+ (void) WriteBlobByte(image,'\\');
+ (void) WriteBlobByte(image,value[i]);
+ }
+ (void) WriteBlobByte(image,'}');
+ }
}
(void) WriteBlobByte(image,'\n');
property=GetNextImageProperty(image);