#endif
/* Macros for left-bit-replication to ensure that pixels
- * and PixelPackets all have the image->depth, and for use
+ * and PixelInfos all have the same image->depth, and for use
* in PNG8 quantization.
*/
magn_methx,
magn_methy;
- PixelPacket
+ PixelInfo
mng_global_bkgd;
/* Added at version 6.6.6-7 */
#if (MAGICKCORE_QUANTUM_DEPTH >= 16)
static MagickBooleanType
-LosslessReduceDepthOK(Image *image)
+LosslessReduceDepthOK(Image *image,ExceptionInfo *exception)
{
/* Reduce bit depth if it can be reduced losslessly from 16+ to 8.
*
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
{
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
-static MagickBooleanType ImageIsGray(Image *image)
+static MagickBooleanType ImageIsGray(Image *image,ExceptionInfo *exception)
{
register const Quantum
*p;
if (image->storage_class == PseudoClass)
{
for (i=0; i < (ssize_t) image->colors; i++)
- if (IsPixelPacketGray(image->colormap+i) == MagickFalse)
+ if (IsPixelInfoGray(image->colormap+i) == MagickFalse)
return(MagickFalse);
return(MagickTrue);
}
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
return(MagickFalse);
for (x=(ssize_t) image->columns-1; x >= 0; x--)
return((long) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]));
}
+typedef struct _PNGErrorInfo
+{
+ Image
+ *image;
+
+ ExceptionInfo
+ *exception;
+} PNGErrorInfo;
+
static void MagickPNGErrorHandler(png_struct *ping,png_const_charp message)
{
+ ExceptionInfo
+ *exception;
+
Image
*image;
- image=(Image *) png_get_error_ptr(ping);
+ PNGErrorInfo
+ *error_info;
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " libpng-%s error: %s", PNG_LIBPNG_VER_STRING,message);
+ error_info=(PNGErrorInfo *) png_get_error_ptr(ping);
+ image=error_info->image;
+ exception=error_info->exception;
- (void) ThrowMagickException(&image->exception,GetMagickModule(),CoderError,
- message,"`%s'",image->filename);
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " libpng-%s error: %s", PNG_LIBPNG_VER_STRING,message);
+
+ (void) ThrowMagickException(exception,GetMagickModule(),CoderError,message,
+ "`%s'",image->filename);
#if (PNG_LIBPNG_VER < 10500)
/* A warning about deprecated use of jmpbuf here is unavoidable if you
static void MagickPNGWarningHandler(png_struct *ping,png_const_charp message)
{
+ ExceptionInfo
+ *exception;
+
Image
*image;
+ PNGErrorInfo
+ *error_info;
+
if (LocaleCompare(message, "Missing PLTE before tRNS") == 0)
png_error(ping, message);
- image=(Image *) png_get_error_ptr(ping);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " libpng-%s warning: %s", PNG_LIBPNG_VER_STRING,message);
+ error_info=(PNGErrorInfo *) png_get_error_ptr(ping);
+ image=error_info->image;
+ exception=error_info->exception;
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " libpng-%s warning: %s", PNG_LIBPNG_VER_STRING,message);
- (void) ThrowMagickException(&image->exception,GetMagickModule(),CoderWarning,
+ (void) ThrowMagickException(exception,GetMagickModule(),CoderWarning,
message,"`%s'",image->filename);
}
static int
Magick_png_read_raw_profile(Image *image, const ImageInfo *image_info,
- png_textp text,int ii)
+ png_textp text,int ii,ExceptionInfo *exception)
{
register ssize_t
i;
/* allocate space */
if (length == 0)
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderWarning,"UnableToCopyProfile","`%s'","invalid profile length");
return(MagickFalse);
}
if (profile == (StringInfo *) NULL)
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
"unable to copy profile");
return(MagickFalse);
{
if (*sp == '\0')
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderWarning,"UnableToCopyProfile","`%s'","ran out of data");
profile=DestroyStringInfo(profile);
return(MagickFalse);
/*
We have already read "Raw profile type.
*/
- (void) SetImageProfile(image,&text[ii].key[17],profile);
+ (void) SetImageProfile(image,&text[ii].key[17],profile,exception);
profile=DestroyStringInfo(profile);
if (image_info->verbose)
double
file_gamma;
- PixelLongPacket
- transparent_color;
-
MagickBooleanType
logging,
status;
+ PixelInfo
+ transparent_color;
+
+ PNGErrorInfo
+ error_info;
+
png_bytep
ping_trans_alpha;
Allocate the PNG structures
*/
#ifdef PNG_USER_MEM_SUPPORTED
- ping=png_create_read_struct_2(PNG_LIBPNG_VER_STRING, image,
+ error_info.image=image;
+ error_info.exception=exception;
+ ping=png_create_read_struct_2(PNG_LIBPNG_VER_STRING,&error_info,
MagickPNGErrorHandler,MagickPNGWarningHandler, NULL,
(png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);
#else
- ping=png_create_read_struct(PNG_LIBPNG_VER_STRING,image,
+ ping=png_create_read_struct(PNG_LIBPNG_VER_STRING,&error_info,
MagickPNGErrorHandler,MagickPNGWarningHandler);
#endif
if (ping == (png_struct *) NULL)
if (image != (Image *) NULL)
{
- InheritException(exception,&image->exception);
+ InheritException(exception,exception);
image->columns=0;
}
profile=BlobToStringInfo(info,profile_length);
if (profile == (StringInfo *) NULL)
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
"unable to copy profile");
return((Image *) NULL);
}
SetStringInfoDatum(profile,(const unsigned char *) info);
- (void) SetImageProfile(image,"icc",profile);
+ (void) SetImageProfile(image,"icc",profile,exception);
profile=DestroyStringInfo(profile);
}
}
*/
(void) png_get_pHYs(ping,ping_info,&x_resolution,&y_resolution,
&unit_type);
- image->x_resolution=(double) x_resolution;
- image->y_resolution=(double) y_resolution;
+ image->resolution.x=(double) x_resolution;
+ image->resolution.y=(double) y_resolution;
if (unit_type == PNG_RESOLUTION_METER)
{
image->units=PixelsPerCentimeterResolution;
- image->x_resolution=(double) x_resolution/100.0;
- image->y_resolution=(double) y_resolution/100.0;
+ image->resolution.x=(double) x_resolution/100.0;
+ image->resolution.y=(double) y_resolution/100.0;
}
if (logging != MagickFalse)
{
if (mng_info->global_trns_length >
mng_info->global_plte_length)
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderError,
"global tRNS has more entries than global PLTE",
"`%s'",image_info->filename);
#endif
}
else
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"No global PLTE in file","`%s'",
image_info->filename);
}
" Raw tRNS graylevel is %d.",ping_trans_color->gray);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " scaled graylevel is %d.",transparent_color.alpha);
+ " scaled graylevel is %.20g.",transparent_color.alpha);
}
transparent_color.red=transparent_color.alpha;
transparent_color.green=transparent_color.alpha;
(void) FormatLocaleString(msg,MaxTextExtent,
"%d, %d",(int) ping_width, (int) ping_height);
- (void) SetImageProperty(image,"PNG:IHDR.width,height ",msg);
+ (void) SetImageProperty(image,"PNG:IHDR.width,height ",msg,exception);
(void) FormatLocaleString(msg,MaxTextExtent,"%d",(int) ping_bit_depth);
- (void) SetImageProperty(image,"PNG:IHDR.bit_depth ",msg);
+ (void) SetImageProperty(image,"PNG:IHDR.bit_depth ",msg,exception);
(void) FormatLocaleString(msg,MaxTextExtent,"%d",(int) ping_color_type);
- (void) SetImageProperty(image,"PNG:IHDR.color_type ",msg);
+ (void) SetImageProperty(image,"PNG:IHDR.color_type ",msg,exception);
(void) FormatLocaleString(msg,MaxTextExtent,"%d",
(int) ping_interlace_method);
- (void) SetImageProperty(image,"PNG:IHDR.interlace_method",msg);
+ (void) SetImageProperty(image,"PNG:IHDR.interlace_method",msg,exception);
}
/*
if (image != (Image *) NULL)
{
- InheritException(exception,&image->exception);
+ InheritException(exception,exception);
image->columns=0;
}
matte=image->matte;
image->matte=MagickFalse;
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
image->matte=matte;
}
png_destroy_read_struct(&ping,&ping_info,&end_info);
ping_pixels=(unsigned char *) RelinquishMagickMemory(ping_pixels);
image->colors=2;
- (void) SetImageBackgroundColor(image);
+ (void) SetImageBackgroundColor(image,exception);
#if defined(PNG_SETJMP_NOT_THREAD_SAFE)
UnlockSemaphoreInfo(ping_semaphore);
#endif
}
}
}
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
}
#if 1 /* Should have already been done above, but glennrp problem P10
if (memcmp(text[i].key, "Raw profile type ",17) == 0)
{
- (void) Magick_png_read_raw_profile(image,image_info,text,(int) i);
+ (void) Magick_png_read_raw_profile(image,image_info,text,(int) i,
+ exception);
num_raw_profiles++;
}
sizeof(*value));
if (value == (char *) NULL)
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
image->filename);
break;
if (!png_get_valid(ping,ping_info,PNG_INFO_pHYs) ||
(LocaleCompare(text[i].key,"density") != 0 &&
LocaleCompare(text[i].key,"units") != 0))
- (void) SetImageProperty(image,text[i].key,value);
+ (void) SetImageProperty(image,text[i].key,value,exception);
if (logging != MagickFalse)
{
mng_info->ob[object_id]->frozen)
{
if (mng_info->ob[object_id] == (MngBuffer *) NULL)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
image->filename);
if (mng_info->ob[object_id]->frozen)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"Cannot overwrite frozen MNG object buffer",
"`%s'",image->filename);
}
(mng_info->ob[object_id]->image);
mng_info->ob[object_id]->image=CloneImage(image,0,0,MagickTrue,
- &image->exception);
+ exception);
if (mng_info->ob[object_id]->image != (Image *) NULL)
mng_info->ob[object_id]->image->file=(FILE *) NULL;
else
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"Cloning image for object buffer failed",
"`%s'",image->filename);
/* libpng doesn't tell us whether they were tEXt, zTXt, or iTXt */
(void) FormatLocaleString(msg,MaxTextExtent,
"%d tEXt/zTXt/iTXt chunks were found", num_text_total);
- (void) SetImageProperty(image,"PNG:text ",msg);
+ (void) SetImageProperty(image,"PNG:text ",msg,
+ exception);
}
if (num_raw_profiles != 0)
{
(void) FormatLocaleString(msg,MaxTextExtent,
"%d were found", num_raw_profiles);
- (void) SetImageProperty(image,"PNG:text-encoded profiles",msg);
+ (void) SetImageProperty(image,"PNG:text-encoded profiles",msg,
+ exception);
}
if (png_get_valid(ping,ping_info,PNG_INFO_cHRM))
{
(void) FormatLocaleString(msg,MaxTextExtent,"%s",
"chunk was found (see Chromaticity, above)");
- (void) SetImageProperty(image,"PNG:cHRM ",msg);
+ (void) SetImageProperty(image,"PNG:cHRM ",msg,
+ exception);
}
if (png_get_valid(ping,ping_info,PNG_INFO_bKGD))
{
(void) FormatLocaleString(msg,MaxTextExtent,"%s",
"chunk was found (see Background color, above)");
- (void) SetImageProperty(image,"PNG:bKGD ",msg);
+ (void) SetImageProperty(image,"PNG:bKGD ",msg,
+ exception);
}
(void) FormatLocaleString(msg,MaxTextExtent,"%s",
"chunk was found");
if (png_get_valid(ping,ping_info,PNG_INFO_iCCP))
- (void) SetImageProperty(image,"PNG:iCCP ",msg);
+ (void) SetImageProperty(image,"PNG:iCCP ",msg,
+ exception);
if (png_get_valid(ping,ping_info,PNG_INFO_tRNS))
- (void) SetImageProperty(image,"PNG:tRNS ",msg);
+ (void) SetImageProperty(image,"PNG:tRNS ",msg,
+ exception);
#if defined(PNG_sRGB_SUPPORTED)
if (png_get_valid(ping,ping_info,PNG_INFO_sRGB))
(void) FormatLocaleString(msg,MaxTextExtent,
"intent=%d (See Rendering intent)",
(int) intent);
- (void) SetImageProperty(image,"PNG:sRGB ",msg);
+ (void) SetImageProperty(image,"PNG:sRGB ",msg,
+ exception);
}
#endif
(void) FormatLocaleString(msg,MaxTextExtent,
"gamma=%.8g (See Gamma, above)",
file_gamma);
- (void) SetImageProperty(image,"PNG:gAMA ",msg);
+ (void) SetImageProperty(image,"PNG:gAMA ",msg,
+ exception);
}
#if defined(PNG_pHYs_SUPPORTED)
(void) FormatLocaleString(msg,MaxTextExtent,
"x_res=%.10g, y_res=%.10g, units=%d",
(double) x_resolution,(double) y_resolution, unit_type);
- (void) SetImageProperty(image,"PNG:pHYs ",msg);
+ (void) SetImageProperty(image,"PNG:pHYs ",msg,
+ exception);
}
#endif
{
(void) FormatLocaleString(msg,MaxTextExtent,"x_off=%.20g, y_off=%.20g",
(double) image->page.x,(double) image->page.y);
- (void) SetImageProperty(image,"PNG:oFFs ",msg);
+ (void) SetImageProperty(image,"PNG:oFFs ",msg,
+ exception);
}
#endif
(void) FormatLocaleString(msg,MaxTextExtent,
"width=%.20g, height=%.20g",
(double) image->page.width,(double) image->page.height);
- (void) SetImageProperty(image,"PNG:vpAg ",msg);
+ (void) SetImageProperty(image,"PNG:vpAg ",msg,
+ exception);
}
}
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadPNGImage()");
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
mng_info=(MngInfo *) NULL;
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" AcquireNextImage()");
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
return((Image *) NULL);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
GetImageInfo(color_image_info);
- color_image=AcquireImage(color_image_info);
+ color_image=AcquireImage(color_image_info,exception);
if (color_image == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
GetImageInfo(alpha_image_info);
- alpha_image=AcquireImage(alpha_image_info);
+ alpha_image=AcquireImage(alpha_image_info,exception);
if (alpha_image == (Image *) NULL)
{
{
if (length > 8)
{
- image->x_resolution=(double) mng_get_long(p);
- image->y_resolution=(double) mng_get_long(&p[4]);
+ image->resolution.x=(double) mng_get_long(p);
+ image->resolution.y=(double) mng_get_long(&p[4]);
if ((int) p[8] == PNG_RESOLUTION_METER)
{
image->units=PixelsPerCentimeterResolution;
- image->x_resolution=image->x_resolution/100.0f;
- image->y_resolution=image->y_resolution/100.0f;
+ image->resolution.x=image->resolution.x/100.0f;
+ image->resolution.y=image->resolution.y/100.0f;
}
}
for (y=0; y < (ssize_t) image->rows; y++)
{
- s=GetVirtualPixels(jng_image,0,y,image->columns,1,&image->exception);
+ s=GetVirtualPixels(jng_image,0,y,image->columns,1,exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
for (x=(ssize_t) image->columns; x != 0; x--)
{
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,
- &image->exception);
+ exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (image->matte != MagickFalse)
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadJNGImage()");
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
mng_info=(MngInfo *) NULL;
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
previous_fb;
#if defined(MNG_INSERT_LAYERS)
- PixelPacket
+ PixelInfo
mng_background_color;
#endif
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadMNGImage()");
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
mng_info=(MngInfo *) NULL;
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
skip_to_iend=MagickTrue;
if (mng_info->jhdr_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"JNGCompressNotSupported","`%s'",image->filename);
mng_info->jhdr_warning++;
skip_to_iend=MagickTrue;
if (mng_info->dhdr_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"DeltaPNGNotSupported","`%s'",image->filename);
mng_info->dhdr_warning++;
if (GetAuthenticPixelQueue(image) != (Quantum *) NULL)
{
/* Allocate next image structure. */
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
return((Image *) NULL);
if (memcmp(type,mng_DEFI,4) == 0)
{
if (mng_type == 3)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"DEFI chunk found in MNG-VLC datastream","`%s'",
image->filename);
object_id=(p[0] << 8) | p[1];
if (mng_type == 2 && object_id != 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"Nonzero object_id in MNG-LC datastream","`%s'",
image->filename);
Instead ofsuing a warning we should allocate a larger
MngInfo structure and continue.
*/
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"object id too large","`%s'",image->filename);
object_id=MNG_MAX_OBJECTS;
}
if (mng_info->frozen[object_id])
{
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderError,
"DEFI cannot redefine a frozen MNG object","`%s'",
image->filename);
if (memcmp(type,mng_FRAM,4) == 0)
{
if (mng_type == 3)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"FRAM chunk found in MNG-VLC datastream","`%s'",
image->filename);
/* Allocate next image structure. */
if (GetAuthenticPixelQueue(image) != (Quantum *) NULL)
{
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image->background_color=mng_background_color;
image->matte=MagickFalse;
image->delay=0;
- (void) SetImageBackgroundColor(image);
+ (void) SetImageBackgroundColor(image,exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
if (memcmp(type,mng_CLON,4) == 0)
{
if (mng_info->clon_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"CLON is not implemented yet","`%s'",
image->filename);
if (magn_first || magn_last)
if (mng_info->magn_warning == 0)
{
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderError,
"MAGN is not implemented yet for nonzero objects",
"`%s'",image->filename);
if (magn_methx > 5 || magn_methy > 5)
if (mng_info->magn_warning == 0)
{
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderError,
"Unknown MAGN method in MNG datastream","`%s'",
image->filename);
if (memcmp(type,mng_PAST,4) == 0)
{
if (mng_info->past_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"PAST is not implemented yet","`%s'",
image->filename);
if (memcmp(type,mng_SHOW,4) == 0)
{
if (mng_info->show_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"SHOW is not implemented yet","`%s'",
image->filename);
if (memcmp(type,mng_pHYg,4) == 0)
{
if (mng_info->phyg_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"pHYg is not implemented.","`%s'",image->filename);
mng_info->phyg_warning++;
skip_to_iend=MagickTrue;
if (mng_info->basi_warning == 0)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"BASI is not implemented yet","`%s'",
image->filename);
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image->page.x=0;
image->page.y=0;
image->background_color=mng_background_color;
- (void) SetImageBackgroundColor(image);
+ (void) SetImageBackgroundColor(image,exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Inserted transparent background layer, W=%.20g, H=%.20g",
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image->page.y=mng_info->clip.top;
image->background_color=mng_background_color;
image->matte=MagickFalse;
- (void) SetImageBackgroundColor(image);
+ (void) SetImageBackgroundColor(image,exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Allocate magnified image");
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
#endif
if (image->matte != MagickFalse)
- (void) SetImageBackgroundColor(large_image);
+ (void) SetImageBackgroundColor(large_image,exception);
else
{
large_image->background_color.alpha=OpaqueAlpha;
- (void) SetImageBackgroundColor(large_image);
+ (void) SetImageBackgroundColor(large_image,exception);
if (magn_methx == 4)
magn_methx=2;
image->columns=1;
image->rows=1;
image->colors=2;
- (void) SetImageBackgroundColor(image);
+ (void) SetImageBackgroundColor(image,exception);
image->page.width=1;
image->page.height=1;
image->page.x=0;
#endif
#if (MAGICKCORE_QUANTUM_DEPTH > 8)
- if (LosslessReduceDepthOK(image) != MagickFalse)
+ if (LosslessReduceDepthOK(image,exception) != MagickFalse)
image->depth = 8;
#endif
- GetImageException(image,exception);
-
if (image_info->number_scenes != 0)
{
if (mng_info->scenes_found >
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
image->matte=MagickFalse;
if (image_info->ping == MagickFalse)
- (void) SetImageBackgroundColor(image);
+ (void) SetImageBackgroundColor(image,exception);
mng_info->image_found++;
}
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule()," No beginning");
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"Linked list is corrupted, beginning of list not found",
"`%s'",image_info->filename);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule()," Corrupt list");
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"Linked list is corrupted; next_image is NULL","`%s'",
image_info->filename);
}
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" First image null");
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"image->next for first image is NULL but shouldn't be.",
"`%s'",image_info->filename);
}
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" No visible images found.");
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"No visible images in file","`%s'",image_info->filename);
if (image != (Image *) NULL)
(void) LogMagickEvent(CoderEvent,GetMagickModule()," Coalesce Images");
scene=image->scene;
- next_image=CoalesceImages(image,&image->exception);
+ next_image=CoalesceImages(image,exception);
if (next_image == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
QuantumInfo
*quantum_info;
+ PNGErrorInfo
+ error_info;
+
register ssize_t
i,
x;
logging=LogMagickEvent(CoderEvent,GetMagickModule(),
" Enter WriteOnePNGImage()");
- image = CloneImage(IMimage,0,0,MagickFalse,&IMimage->exception);
+ image = CloneImage(IMimage,0,0,MagickFalse,exception);
image_info=(ImageInfo *) CloneImageInfo(IMimage_info);
if (image_info == (ImageInfo *) NULL)
ThrowWriterException(ResourceLimitError, "MemoryAllocationFailed");
if ((LocaleCompare(name,"ICC") == 0) ||
(LocaleCompare(name,"ICM") == 0))
{
- unsigned char
- *data;
+ int
+ icheck;
+ /* 0: not a known sRGB profile
+ * 1: HP-Microsoft sRGB v2
+ * 2: ICC sRGB v4 perceptual
+ * 3: ICC sRGB v2 perceptual no black-compensation
+ */
png_uint_32
- length;
+ check_crc[4] = {0, 0xf29e526dUL, 0xbbef7812UL, 0x427ebb21UL},
+ check_len[4] = {0, 3144, 60960, 3052};
- length=(png_uint_32) GetStringInfoLength(profile);
+ png_uint_32
+ length,
+ profile_crc;
- if (length == 3144)
- {
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " got a 3144-byte ICC profile (potentially sRGB)");
+ unsigned char
+ *data;
- data=GetStringInfoDatum(profile);
+ length=(png_uint_32) GetStringInfoLength(profile);
- if (data[52]=='s' && data[53]=='R' &&
- data[54]=='G' && data[55]=='B')
- {
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " It is the HP-Microsoft sRGB)");
- if (image->rendering_intent==UndefinedIntent);
- image->rendering_intent=PerceptualIntent;
- }
- else
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " It is not sRGB (%c%c%c%c)",data[52],
- data[53],data[54],data[55]);
-
- }
- else if (length == 3052)
+ for (icheck=3; icheck > 0; icheck--)
{
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " got a 3052-byte ICC profile (potentially sRGB)");
+ if (length == check_len[icheck])
+ {
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " Got a %lu-byte ICC profile (potentially sRGB)",
+ (unsigned long) length);
- data=GetStringInfoDatum(profile);
+ data=GetStringInfoDatum(profile);
+ profile_crc=crc32(0,data,length);
- if (data[336]=='s' && data[337]=='R' &&
- data[338]=='G' && data[339]=='B')
- {
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " It is the ICC no-black sRGB)");
- if (image->rendering_intent==UndefinedIntent);
- image->rendering_intent=PerceptualIntent;
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " with crc=%8x",(unsigned int) profile_crc);
+
+ if (profile_crc == check_crc[icheck])
+ {
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " It is sRGB.");
+ if (image->rendering_intent==UndefinedIntent)
+ image->rendering_intent=PerceptualIntent;
+ break;
+ }
}
- else
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " It is not sRGB (%c%c%c%c)",data[52],
- data[53],data[54],data[55]);
-
}
- else
+ if (icheck == 0)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " got a %lu-byte ICC profile",
+ " Got a %lu-byte ICC profile",
(unsigned long) length);
}
}
(mng_info->write_png_colortype != 0 &&
mng_info->write_png_colortype != 4)))
{
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
image->storage_class = DirectClass;
}
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Freeing bogus colormap");
- (void *) RelinquishMagickMemory(image->colormap);
+ (void) RelinquishMagickMemory(image->colormap);
image->colormap=NULL;
}
}
if (IsRGBColorspace(image->colorspace) == MagickFalse)
- (void) TransformImageColorspace(image,RGBColorspace);
+ (void) TransformImageColorspace(image,RGBColorspace,exception);
/*
Sometimes we get PseudoClass images whose RGB values don't match
the colors in the colormap. This code syncs the RGB values.
*/
if (image->depth <= 8 && image->taint && image->storage_class == PseudoClass)
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
#if (MAGICKCORE_QUANTUM_DEPTH == 8)
if (image->depth > 8)
register Quantum
*r;
- ExceptionInfo
- *exception;
-
- exception=(&image->exception);
-
if (image->depth > 8)
{
#if MAGICKCORE_QUANTUM_DEPTH > 16
for (y=0; y < (ssize_t) image->rows; y++)
{
- r=GetAuthenticPixels(image,0,y,image->columns,1,
- exception);
+ r=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (r == (Quantum *) NULL)
break;
#if (MAGICKCORE_QUANTUM_DEPTH > 8)
if (image->depth == 16 && mng_info->write_png_depth != 16)
- if (mng_info->write_png8 || LosslessReduceDepthOK(image) != MagickFalse)
+ if (mng_info->write_png8 || LosslessReduceDepthOK(image,exception) != MagickFalse)
image->depth = 8;
#endif
* we need to check for bogus non-opaque values, at least.
*/
- ExceptionInfo
- *exception;
-
int
n;
- PixelPacket
+ PixelInfo
opaque[260],
semitransparent[260],
transparent[260];
" Regenerate the colormap");
}
- exception=(&image->exception);
-
image_colors=0;
number_opaque = 0;
number_semitransparent = 0;
{
if (number_opaque == 0)
{
- GetPixelPacket(image, q, opaque);
+ GetPixelInfoPixel(image, q, opaque);
opaque[0].alpha=OpaqueAlpha;
number_opaque=1;
}
number_opaque < 259)
{
number_opaque++;
- GetPixelPacket(image, q, opaque+i);
+ GetPixelInfoPixel(image, q, opaque+i);
opaque[i].alpha=OpaqueAlpha;
}
}
{
if (number_transparent == 0)
{
- GetPixelPacket(image, q, transparent);
+ GetPixelInfoPixel(image, q, transparent);
ping_trans_color.red=(unsigned short)
GetPixelRed(image,q);
ping_trans_color.green=(unsigned short)
number_transparent < 259)
{
number_transparent++;
- GetPixelPacket(image,q,transparent+i);
+ GetPixelInfoPixel(image,q,transparent+i);
}
}
}
{
if (number_semitransparent == 0)
{
- GetPixelPacket(image,q,semitransparent);
+ GetPixelInfoPixel(image,q,semitransparent);
number_semitransparent = 1;
}
number_semitransparent < 259)
{
number_semitransparent++;
- GetPixelPacket(image, q, semitransparent+i);
+ GetPixelInfoPixel(image, q, semitransparent+i);
}
}
}
if (image_colors < 257)
{
- PixelPacket
+ PixelInfo
colormap[260];
/*
{
if (GetPixelAlpha(image,r) < OpaqueAlpha/2)
{
- SetPixelPacket(image,&image->background_color,r);
+ SetPixelInfoPixel(image,&image->background_color,r);
SetPixelAlpha(image,TransparentAlpha,r);
}
else
else if (image_colors == 0 || image_colors > 256 ||
image->colormap == NULL)
{
- ExceptionInfo
- *exception;
-
register const Quantum
*q;
- exception=(&image->exception);
-
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetVirtualPixels(image,0,y,image->columns,1, exception);
{
image_info=DestroyImageInfo(image_info);
image=DestroyImage(image);
- (void) ThrowMagickException(&IMimage->exception,
- GetMagickModule(),CoderError,
+ (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
"Cannot write PNG8 or color-type 3; colormap is NULL",
"`%s'",IMimage->filename);
#if defined(PNG_SETJMP_NOT_THREAD_SAFE)
Allocate the PNG structures
*/
#ifdef PNG_USER_MEM_SUPPORTED
- ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,image,
+ error_info.image=image;
+ error_info.exception=exception;
+ ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,&error_info,
MagickPNGErrorHandler,MagickPNGWarningHandler,(void *) NULL,
(png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);
#else
- ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,image,
+ ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,&error_info,
MagickPNGErrorHandler,MagickPNGWarningHandler);
#endif
#if defined(PNG_pHYs_SUPPORTED)
if (ping_exclude_pHYs == MagickFalse)
{
- if ((image->x_resolution != 0) && (image->y_resolution != 0) &&
+ if ((image->resolution.x != 0) && (image->resolution.y != 0) &&
(!mng_info->write_mng || !mng_info->equal_physs))
{
if (logging != MagickFalse)
{
ping_pHYs_unit_type=PNG_RESOLUTION_METER;
ping_pHYs_x_resolution=
- (png_uint_32) ((100.0*image->x_resolution+0.5)/2.54);
+ (png_uint_32) ((100.0*image->resolution.x+0.5)/2.54);
ping_pHYs_y_resolution=
- (png_uint_32) ((100.0*image->y_resolution+0.5)/2.54);
+ (png_uint_32) ((100.0*image->resolution.y+0.5)/2.54);
}
else if (image->units == PixelsPerCentimeterResolution)
{
ping_pHYs_unit_type=PNG_RESOLUTION_METER;
- ping_pHYs_x_resolution=(png_uint_32) (100.0*image->x_resolution+0.5);
- ping_pHYs_y_resolution=(png_uint_32) (100.0*image->y_resolution+0.5);
+ ping_pHYs_x_resolution=(png_uint_32) (100.0*image->resolution.x+0.5);
+ ping_pHYs_y_resolution=(png_uint_32) (100.0*image->resolution.y+0.5);
}
else
{
ping_pHYs_unit_type=PNG_RESOLUTION_UNKNOWN;
- ping_pHYs_x_resolution=(png_uint_32) image->x_resolution;
- ping_pHYs_y_resolution=(png_uint_32) image->y_resolution;
+ ping_pHYs_x_resolution=(png_uint_32) image->resolution.x;
+ ping_pHYs_y_resolution=(png_uint_32) image->resolution.y;
}
if (logging != MagickFalse)
if (image->colors == 0)
{
/* DO SOMETHING */
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderError,
"image has 0 colors", "`%s'","");
}
(ScaleQuantumToShort(image->colormap[0].blue) & mask);
ping_trans_color.gray=(png_uint_16)
- (ScaleQuantumToShort(GetPixelPacketIntensity(
+ (ScaleQuantumToShort(GetPixelInfoIntensity(
image->colormap)) & mask);
ping_trans_color.index=(png_byte) 0;
{
ping_background.gray=(png_uint_16)
- ((maxval/255.)*((GetPixelPacketIntensity(&image->background_color)))
+ ((maxval/255.)*((GetPixelInfoIntensity(&image->background_color)))
+.5);
if (logging != MagickFalse)
if (ping_exclude_iCCP == MagickFalse)
{
- png_set_iCCP(ping,ping_info,(const png_charp) name,0,
+ png_set_iCCP(ping,ping_info,(png_charp) name,0,
#if (PNG_LIBPNG_VER < 10500)
(png_charp) GetStringInfoDatum(profile),
#else
{
/* Add an opaque matte channel */
image->matte = MagickTrue;
- (void) SetImageOpacity(image,0);
+ (void) SetImageAlpha(image,OpaqueAlpha,exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
if (mng_info->need_blob != MagickFalse)
{
- if (OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception) ==
+ if (OpenBlob(image_info,image,WriteBinaryBlobMode,exception) ==
MagickFalse)
png_error(ping,"WriteBlob Failed");
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Writing row of pixels (0)");
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
if (mng_info->IsPalette)
{
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,GrayQuantum,ping_pixels,&image->exception);
+ quantum_info,GrayQuantum,ping_pixels,exception);
if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_PALETTE &&
mng_info->write_png_depth &&
mng_info->write_png_depth != old_bit_depth)
else
{
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,RedQuantum,ping_pixels,&image->exception);
+ quantum_info,RedQuantum,ping_pixels,exception);
}
if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE)
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
{
if (mng_info->IsPalette)
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,GrayQuantum,ping_pixels,&image->exception);
+ quantum_info,GrayQuantum,ping_pixels,exception);
else
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,RedQuantum,ping_pixels,&image->exception);
+ quantum_info,RedQuantum,ping_pixels,exception);
if (logging != MagickFalse && y == 0)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Writing GRAY_ALPHA PNG pixels (2)");
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,GrayAlphaQuantum,ping_pixels,&image->exception);
+ quantum_info,GrayAlphaQuantum,ping_pixels,exception);
}
if (logging != MagickFalse && y == 0)
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
{
if (image->storage_class == DirectClass)
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,RedQuantum,ping_pixels,&image->exception);
+ quantum_info,RedQuantum,ping_pixels,exception);
else
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,GrayQuantum,ping_pixels,&image->exception);
+ quantum_info,GrayQuantum,ping_pixels,exception);
}
else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
(void) ExportQuantumPixels(image,(CacheView *) NULL,
quantum_info,GrayAlphaQuantum,ping_pixels,
- &image->exception);
+ exception);
if (logging != MagickFalse && y == 0)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
else if (image_matte != MagickFalse)
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,RGBAQuantum,ping_pixels,&image->exception);
+ quantum_info,RGBAQuantum,ping_pixels,exception);
else
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,RGBQuantum,ping_pixels,&image->exception);
+ quantum_info,RGBQuantum,ping_pixels,exception);
if (logging != MagickFalse && y == 0)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA",pass);
p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
quantum_info->depth=image->depth;
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,GrayQuantum,ping_pixels,&image->exception);
+ quantum_info,GrayQuantum,ping_pixels,exception);
}
else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
(void) ExportQuantumPixels(image,(CacheView *) NULL,
quantum_info,GrayAlphaQuantum,ping_pixels,
- &image->exception);
+ exception);
}
else
{
(void) ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,IndexQuantum,ping_pixels,&image->exception);
+ quantum_info,IndexQuantum,ping_pixels,exception);
if (logging != MagickFalse && y <= 2)
{
png_textp
text;
- value=GetImageProperty(image,property);
+ value=GetImageProperty(image,property,exception);
/* Don't write any "png:" properties; those are just for "identify" */
if (LocaleNCompare(property,"png:",4) != 0 &&
}
if (mng_info->write_mng && !mng_info->need_fram &&
((int) image->dispose == 3))
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
CoderError,"Cannot convert GIF with disposal method 3 to MNG-LC",
"`%s'",image->filename);
s[0]=(char) ping_bit_depth;
s[1]='\0';
- (void) SetImageProperty(IMimage,"png:bit-depth-written",s);
+ (void) SetImageProperty(IMimage,"png:bit-depth-written",s,exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
else
(void) SetImageType(image,TrueColorType,exception);
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
}
if (mng_info->write_png32)
else
(void) SetImageType(image,TrueColorType,exception);
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
}
value=GetImageOption(image_info,"png:bit-depth");
mng_info->write_png_depth = 16;
else
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderWarning,
"ignoring invalid defined png:bit-depth",
"=%s",value);
mng_info->write_png_colortype = 7;
else
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderWarning,
"ignoring invalid defined png:color-type",
"=%s",value);
mng_info->write_png_compression_level = 10;
else
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderWarning,
"ignoring invalid defined png:compression-level",
"=%s",value);
#endif
else
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderWarning,
"ignoring invalid defined png:compression-strategy",
"=%s",value);
mng_info->write_png_compression_filter = 6;
else
- (void) ThrowMagickException(&image->exception,
+ (void) ThrowMagickException(exception,
GetMagickModule(),CoderWarning,
"ignoring invalid defined png:compression-filter",
"=%s",value);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating jpeg_image.");
- jpeg_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ jpeg_image=CloneImage(image,0,0,MagickTrue,exception);
if (jpeg_image == (Image *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) CopyMagickString(jpeg_image->magick,"JPEG",MaxTextExtent);
channel_mask=SetPixelChannelMask(jpeg_image,AlphaChannel);
- status=SeparateImage(jpeg_image);
+ status=SeparateImage(jpeg_image,exception);
(void) SetPixelChannelMap(jpeg_image,channel_mask);
jpeg_image->matte=MagickFalse;
/* Check if image is grayscale. */
if (image_info->type != TrueColorMatteType && image_info->type !=
- TrueColorType && ImageIsGray(image))
+ TrueColorType && ImageIsGray(image,exception))
jng_color_type-=2;
if (transparent)
/* Encode alpha as a grayscale PNG blob */
status=OpenBlob(jpeg_image_info,jpeg_image,WriteBinaryBlobMode,
- &image->exception);
+ exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating PNG blob.");
jpeg_image_info->interlace=NoInterlace;
blob=ImageToBlob(jpeg_image_info,jpeg_image,&length,
- &image->exception);
+ exception);
/* Retrieve sample depth used */
- value=GetImageProperty(jpeg_image,"png:bit-depth-written");
+ value=GetImageProperty(jpeg_image,"png:bit-depth-written",exception);
if (value != (char *) NULL)
jng_alpha_sample_depth= (unsigned int) value[0];
}
/* Encode alpha as a grayscale JPEG blob */
status=OpenBlob(jpeg_image_info,jpeg_image,WriteBinaryBlobMode,
- &image->exception);
+ exception);
(void) CopyMagickString(jpeg_image_info->magick,"JPEG",MaxTextExtent);
(void) CopyMagickString(jpeg_image->magick,"JPEG",MaxTextExtent);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating blob.");
blob=ImageToBlob(jpeg_image_info,jpeg_image,&length,
- &image->exception);
+ exception);
jng_alpha_sample_depth=8;
if (logging != MagickFalse)
}
}
- if (image->x_resolution && image->y_resolution && !mng_info->equal_physs)
+ if (image->resolution.x && image->resolution.y && !mng_info->equal_physs)
{
/*
Write JNG pHYs chunk
if (image->units == PixelsPerInchResolution)
{
PNGLong(chunk+4,(png_uint_32)
- (image->x_resolution*100.0/2.54+0.5));
+ (image->resolution.x*100.0/2.54+0.5));
PNGLong(chunk+8,(png_uint_32)
- (image->y_resolution*100.0/2.54+0.5));
+ (image->resolution.y*100.0/2.54+0.5));
chunk[12]=1;
}
if (image->units == PixelsPerCentimeterResolution)
{
PNGLong(chunk+4,(png_uint_32)
- (image->x_resolution*100.0+0.5));
+ (image->resolution.x*100.0+0.5));
PNGLong(chunk+8,(png_uint_32)
- (image->y_resolution*100.0+0.5));
+ (image->resolution.y*100.0+0.5));
chunk[12]=1;
}
else
{
- PNGLong(chunk+4,(png_uint_32) (image->x_resolution+0.5));
- PNGLong(chunk+8,(png_uint_32) (image->y_resolution+0.5));
+ PNGLong(chunk+4,(png_uint_32) (image->resolution.x+0.5));
+ PNGLong(chunk+8,(png_uint_32) (image->resolution.y+0.5));
chunk[12]=0;
}
}
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating jpeg_image.");
- jpeg_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ jpeg_image=CloneImage(image,0,0,MagickTrue,exception);
if (jpeg_image == (Image *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) CopyMagickString(jpeg_image->magick,"JPEG",MaxTextExtent);
jpeg_image->filename);
status=OpenBlob(jpeg_image_info,jpeg_image,WriteBinaryBlobMode,
- &image->exception);
+ exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating blob.");
- blob=ImageToBlob(jpeg_image_info,jpeg_image,&length,&image->exception);
+ blob=ImageToBlob(jpeg_image_info,jpeg_image,&length,exception);
if (logging != MagickFalse)
{
assert(image->signature == MagickSignature);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter WriteJNGImage()");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
assert(image->signature == MagickSignature);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter WriteMNGImage()");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
if (need_local_plte == 0)
{
- if (ImageIsGray(image) == MagickFalse)
+ if (ImageIsGray(image,exception) == MagickFalse)
all_images_are_gray=MagickFalse;
mng_info->equal_palettes=PalettesAreEqual(image,next_image);
if (use_global_plte == 0)
mng_info->equal_srgbs=MagickFalse;
if ((next_image->units != next_image->next->units) ||
- (next_image->x_resolution != next_image->next->x_resolution) ||
- (next_image->y_resolution != next_image->next->y_resolution))
+ (next_image->resolution.x != next_image->next->resolution.x) ||
+ (next_image->resolution.y != next_image->next->resolution.y))
mng_info->equal_physs=MagickFalse;
if (mng_info->equal_chrms)
if (mng_info->adjoin)
{
final_delay=10;
- (void) ThrowMagickException(&image->exception,
- GetMagickModule(),CoderWarning,
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ CoderWarning,
"input has zero delay between all frames; assuming",
" 10 cs `%s'","");
}
mng_info->have_write_global_chrm=MagickTrue;
}
}
- if (image->x_resolution && image->y_resolution && mng_info->equal_physs)
+ if (image->resolution.x && image->resolution.y && mng_info->equal_physs)
{
/*
Write MNG pHYs chunk
if (image->units == PixelsPerInchResolution)
{
PNGLong(chunk+4,(png_uint_32)
- (image->x_resolution*100.0/2.54+0.5));
+ (image->resolution.x*100.0/2.54+0.5));
PNGLong(chunk+8,(png_uint_32)
- (image->y_resolution*100.0/2.54+0.5));
+ (image->resolution.y*100.0/2.54+0.5));
chunk[12]=1;
}
if (image->units == PixelsPerCentimeterResolution)
{
PNGLong(chunk+4,(png_uint_32)
- (image->x_resolution*100.0+0.5));
+ (image->resolution.x*100.0+0.5));
PNGLong(chunk+8,(png_uint_32)
- (image->y_resolution*100.0+0.5));
+ (image->resolution.y*100.0+0.5));
chunk[12]=1;
}
else
{
- PNGLong(chunk+4,(png_uint_32) (image->x_resolution+0.5));
- PNGLong(chunk+8,(png_uint_32) (image->y_resolution+0.5));
+ PNGLong(chunk+4,(png_uint_32) (image->resolution.x+0.5));
+ PNGLong(chunk+8,(png_uint_32) (image->resolution.y+0.5));
chunk[12]=0;
}
}
for (i=0; i < (ssize_t) image->colors; i++)
{
- chunk[4+i*3]=ScaleQuantumToChar(image->colormap[i].red) & 0xff;
- chunk[5+i*3]=ScaleQuantumToChar(image->colormap[i].green) & 0xff;
- chunk[6+i*3]=ScaleQuantumToChar(image->colormap[i].blue) & 0xff;
+ chunk[4+i*3]=(unsigned char) (ScaleQuantumToChar(
+ image->colormap[i].red) & 0xff);
+ chunk[5+i*3]=(unsigned char) (ScaleQuantumToChar(
+ image->colormap[i].green) & 0xff);
+ chunk[6+i*3]=(unsigned char) (ScaleQuantumToChar(
+ image->colormap[i].blue) & 0xff);
}
(void) WriteBlob(image,data_length+4,chunk);