*/
#define QuantumToCharToQuantumEqQuantum(quantum) \
- ((ScaleCharToQuantum((unsigned char) ScaleQuantumToChar(quantum))) == quantum)
+ ((ScaleCharToQuantum((unsigned char) ScaleQuantumToChar(quantum))) == quantum)
MagickBooleanType
ok_to_reduce=MagickFalse;
else
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " Not OK to reduce PNG bit depth to 8 without loss of info");
+ " Not OK to reduce PNG bit depth to 8 without losing info");
}
}
%
% The format of the ReadPNGImage method is:
%
-% Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
+% Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
return box;
}
-static MngBox mng_read_box(MngBox previous_box,char delta_type,unsigned char *p)
+static MngBox mng_read_box(MngBox previous_box,char delta_type,
+ unsigned char *p)
{
MngBox
box;
if (profile == (StringInfo *) NULL)
{
(void) ThrowMagickException(error_info->exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+ ResourceLimitError,"MemoryAllocationFailed","`%s'",
+ image->filename);
return(-1);
}
p=GetStringInfoDatum(profile);
(int) image->alpha_trait, (int) image->rendering_intent,
(int) image->colorspace, image->gamma);
}
- intent=Magick_RenderingIntent_to_PNG_RenderingIntent(image->rendering_intent);
+ intent=
+ Magick_RenderingIntent_to_PNG_RenderingIntent(image->rendering_intent);
/* Set to an out-of-range color unless tRNS chunk is present */
transparent_color.red=65537;
char
msg[MagickPathExtent];
- (void) FormatLocaleString(msg,MagickPathExtent,"%d",(int) ping_color_type);
+ (void) FormatLocaleString(msg,MagickPathExtent,"%d",
+ (int) ping_color_type);
(void) SetImageProperty(image,"png:IHDR.color-type-orig",msg,exception);
- (void) FormatLocaleString(msg,MagickPathExtent,"%d",(int) ping_bit_depth);
+ (void) FormatLocaleString(msg,MagickPathExtent,"%d",
+ (int) ping_bit_depth);
(void) SetImageProperty(image,"png:IHDR.bit-depth-orig",msg,exception);
}
if (sRGB_info[icheck].len == 0)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " Got a %lu-byte ICC profile not recognized as sRGB",
+ " Got %lu-byte ICC profile not recognized as sRGB",
(unsigned long) length);
(void) SetImageProfile(image,"icc",profile,exception);
}
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " Reading PNG bKGD chunk, raw ping_background=(%d,%d,%d).\n"
- " bkgd_scale=%d. ping_background=(%d,%d,%d).",
+ " Reading PNG bKGD chunk, raw ping_background=(%d,%d,%d)\n"
+ " bkgd_scale=%d. ping_background=(%d,%d,%d)",
ping_background->red,ping_background->green,
ping_background->blue,
bkgd_scale,ping_background->red,
"%d, %d",(int) ping_width, (int) ping_height);
(void) SetImageProperty(image,"png:IHDR.width,height",msg,exception);
- (void) FormatLocaleString(msg,MagickPathExtent,"%d",(int) ping_file_depth);
+ (void) FormatLocaleString(msg,MagickPathExtent,"%d",
+ (int) ping_file_depth);
(void) SetImageProperty(image,"png:IHDR.bit_depth",msg,exception);
(void) FormatLocaleString(msg,MagickPathExtent,"%d (%s)",
(void) FormatLocaleString(msg,MagickPathExtent,"%d (Unknown method)",
(int) ping_interlace_method);
}
- (void) SetImageProperty(image,"png:IHDR.interlace_method",msg,exception);
+ (void) SetImageProperty(image,"png:IHDR.interlace_method",
+ msg,exception);
if (number_colors != 0)
{
/* oFFs chunk: */
if (png_get_valid(ping,ping_info,PNG_INFO_oFFs))
{
- (void) FormatLocaleString(msg,MagickPathExtent,"x_off=%.20g, y_off=%.20g",
+ (void) FormatLocaleString(msg,MagickPathExtent,
+ "x_off=%.20g, y_off=%.20g",
(double) image->page.x,(double) image->page.y);
(void) SetImageProperty(image,"png:oFFs",msg,
exception);
/* end of reading one PNG image */
}
-static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
+static Image *ReadPNGImage(const ImageInfo *image_info,
+ ExceptionInfo *exception)
{
Image
*image;
jng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |
(p[6] << 8) | p[7]);
if ((jng_width == 0) || (jng_height == 0))
- ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");
+ ThrowReaderException(CorruptImageError,
+ "NegativeOrZeroImageSize");
jng_color_type=p[8];
jng_image_sample_depth=p[9];
jng_image_compression_method=p[10];
AcquireMagickMemory(sizeof(ImageInfo));
if (alpha_image_info == (ImageInfo *) NULL)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ ThrowReaderException(ResourceLimitError,
+ "MemoryAllocationFailed");
GetImageInfo(alpha_image_info);
alpha_image=AcquireImage(alpha_image_info,exception);
%
*/
-static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
+static Image *ReadJNGImage(const ImageInfo *image_info,
+ ExceptionInfo *exception)
{
Image
*image;
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image_info->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
+ image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadJNGImage()");
}
#endif
-static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
+static Image *ReadMNGImage(const ImageInfo *image_info,
+ ExceptionInfo *exception)
{
char
page_geometry[MagickPathExtent];
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image_info->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
+ image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadMNGImage()");
first_mng_object=MagickTrue;
mng_type=0;
#if defined(MNG_INSERT_LAYERS)
- insert_layers=MagickFalse; /* should be False when converting or mogrifying */
+ insert_layers=MagickFalse; /* should be False during convert or mogrify */
#endif
default_frame_delay=0;
default_frame_timeout=0;
if (length != 0)
{
- chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk));
+ chunk=(unsigned char *) AcquireQuantumMemory(length,
+ sizeof(*chunk));
if (chunk == (unsigned char *) NULL)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ ThrowReaderException(ResourceLimitError,
+ "MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
chunk[i]=(unsigned char) ReadBlobByte(image);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Insert backgd layer, L=%.20g, R=%.20g T=%.20g, B=%.20g",
- (double) mng_info->clip.left,(double) mng_info->clip.right,
- (double) mng_info->clip.top,(double) mng_info->clip.bottom);
+ (double) mng_info->clip.left,
+ (double) mng_info->clip.right,
+ (double) mng_info->clip.top,
+ (double) mng_info->clip.bottom);
}
#endif
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " ENDL: LOOP level %.20g has %.20g remaining iters ",
+ " ENDL: LOOP level %.20g has %.20g remaining iters",
(double) loop_level,(double)
mng_info->loop_count[loop_level]);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " Magnify the rows to %.20g",(double) large_image->rows);
+ " Magnify the rows to %.20g",
+ (double) large_image->rows);
m=(ssize_t) mng_info->magn_mt;
yy=0;
length=(size_t) GetPixelChannels(image)*image->columns;
/* magnify the columns */
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " Magnify the columns to %.20g",(double) image->columns);
+ " Magnify the columns to %.20g",
+ (double) image->columns);
for (y=0; y < (ssize_t) image->rows; y++)
{
else if (magn_methx > 1 && x == (ssize_t) image->columns-2)
m=(ssize_t) mng_info->magn_mr;
- else if (magn_methx <= 1 && x == (ssize_t) image->columns-1)
+ else if (magn_methx <= 1 &&
+ x == (ssize_t) image->columns-1)
m=(ssize_t) mng_info->magn_mr;
else if (magn_methx > 1 && x == (ssize_t) image->columns-1)
if (i <= ((m+1) << 1))
{
SetPixelRed(image,GetPixelRed(image,pixels),q);
- SetPixelGreen(image,GetPixelGreen(image,pixels),q);
+ SetPixelGreen(image,GetPixelGreen(image,
+ pixels),q);
SetPixelBlue(image,GetPixelBlue(image,pixels),q);
- SetPixelAlpha(image,GetPixelAlpha(image,pixels),q);
+ SetPixelAlpha(image,GetPixelAlpha(image,
+ pixels),q);
}
else
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
- q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
+ q=GetAuthenticPixels(image,0,y,image->columns,1,
+ exception);
for (x=(ssize_t) image->columns-1; x >= 0; x--)
{
{
image=GetNextImageInList(image);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " scene %.20g delay=%.20g",(double) scene++,(double) image->delay);
+ " scene %.20g delay=%.20g",(double) scene++,
+ (double) image->delay);
}
}
scene;
if (logging != MagickFalse)
- (void) LogMagickEvent(CoderEvent,GetMagickModule()," Coalesce Images");
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " Coalesce Images");
scene=image->scene;
next_image=CoalesceImages(image,exception);
return(GetFirstImageInList(image));
}
#else /* PNG_LIBPNG_VER > 10011 */
-static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
+static Image *ReadPNGImage(const ImageInfo *image_info,
+ ExceptionInfo *exception)
{
printf("Your PNG library is too old: You have libpng-%s\n",
PNG_LIBPNG_VER_STRING);
return(Image *) NULL;
}
-static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
+static Image *ReadMNGImage(const ImageInfo *image_info,
+ ExceptionInfo *exception)
{
return(ReadPNGImage(image_info,exception));
}
#if defined(PNG_LIBPNG_VER_STRING)
(void) ConcatenateMagickString(version,"libpng ",MagickPathExtent);
- (void) ConcatenateMagickString(version,PNG_LIBPNG_VER_STRING,MagickPathExtent);
+ (void) ConcatenateMagickString(version,PNG_LIBPNG_VER_STRING,
+ MagickPathExtent);
if (LocaleCompare(PNG_LIBPNG_VER_STRING,png_get_header_ver(NULL)) != 0)
{
}
if (sRGB_info[icheck].len == 0)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " Got a %lu-byte ICC profile not recognized as sRGB",
+ " Got %lu-byte ICC profile not recognized as sRGB",
(unsigned long) length);
}
}
}
if (image->depth == 16 && mng_info->write_png_depth != 16)
- if (mng_info->write_png8 || LosslessReduceDepthOK(image,exception) != MagickFalse)
+ if (mng_info->write_png8 ||
+ LosslessReduceDepthOK(image,exception) != MagickFalse)
image->depth = 8;
#endif
quantum_info = (QuantumInfo *) NULL;
number_colors=0;
image_colors=(int) image->colors;
- image_matte=image->alpha_trait != UndefinedPixelTrait ? MagickTrue : MagickFalse;
+ image_matte=image->alpha_trait !=
+ UndefinedPixelTrait ? MagickTrue : MagickFalse;
if (mng_info->write_png_colortype < 5)
mng_info->IsPalette=image->storage_class == PseudoClass &&
if (ping_color_type == PNG_COLOR_TYPE_GRAY)
{
- if (image->alpha_trait == UndefinedPixelTrait && ping_have_non_bw == MagickFalse)
+ if (image->alpha_trait == UndefinedPixelTrait &&
+ ping_have_non_bw == MagickFalse)
ping_bit_depth=1;
}
for (i=0; i < (ssize_t) number_colors; i++)
{
palette[i].red=ScaleQuantumToChar(image->colormap[i].red);
- palette[i].green=ScaleQuantumToChar(image->colormap[i].green);
+ palette[i].green=
+ ScaleQuantumToChar(image->colormap[i].green);
palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);
}
{
if (logging != MagickFalse && y == 0)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA",pass);
+ " pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA",
+ pass);
p=GetVirtualPixels(image,0,y,image->columns,1, exception);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " png:color-type=%d was defined.\n",mng_info->write_png_colortype-1);
+ " png:color-type=%d was defined.\n",
+ mng_info->write_png_colortype-1);
}
/* Check for chunks to be excluded:
exception);
if (status == MagickFalse)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
-
+
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating PNG blob.");
- (void) CopyMagickString(jpeg_image_info->magick,"PNG",MagickPathExtent);
+ (void) CopyMagickString(jpeg_image_info->magick,"PNG",
+ MagickPathExtent);
(void) CopyMagickString(jpeg_image->magick,"PNG",MagickPathExtent);
jpeg_image_info->interlace=NoInterlace;
exception);
if (status == MagickFalse)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
-
- (void) CopyMagickString(jpeg_image_info->magick,"JPEG",MagickPathExtent);
+ (void) CopyMagickString(jpeg_image_info->magick,"JPEG",
+ MagickPathExtent);
(void) CopyMagickString(jpeg_image->magick,"JPEG",MagickPathExtent);
jpeg_image_info->interlace=NoInterlace;
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating blob.");
- blob=(unsigned char *) ImageToBlob(jpeg_image_info,jpeg_image,&length,
+ blob=(unsigned char *) ImageToBlob(jpeg_image_info,
+ jpeg_image,&length,
exception);
jng_alpha_sample_depth=8;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
-static MagickBooleanType WriteJNGImage(const ImageInfo *image_info,Image *image,
- ExceptionInfo *exception)
+static MagickBooleanType WriteJNGImage(const ImageInfo *image_info,
+ Image *image, ExceptionInfo *exception)
{
MagickBooleanType
have_mng_structure,
}
#endif
-static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image,
- ExceptionInfo *exception)
+static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,
+ Image *image, ExceptionInfo *exception)
{
const char
*option;
{
if (need_geom)
{
- if ((next_image->columns+next_image->page.x) > mng_info->page.width)
+ if ((next_image->columns+next_image->page.x) >
+ mng_info->page.width)
mng_info->page.width=next_image->columns+next_image->page.x;
if ((next_image->rows+next_image->page.y) > mng_info->page.height)
PNGLong(chunk+28,19L); /* simplicity=LC+JNG, no transparency */
else
- PNGLong(chunk+28,17L); /* simplicity=VLC+JNG, no transparency */
- }
- }
-
- else
- {
- if (need_matte)
- {
- if (need_defi || mng_info->need_fram || use_global_plte)
- PNGLong(chunk+28,11L); /* simplicity=LC */
-
- else
- PNGLong(chunk+28,9L); /* simplicity=VLC */
- }
-
- else
- {
- if (need_defi || mng_info->need_fram || use_global_plte)
- PNGLong(chunk+28,3L); /* simplicity=LC, no transparency */
-
- else
- PNGLong(chunk+28,1L); /* simplicity=VLC, no transparency */
- }
- }
- (void) WriteBlob(image,32,chunk);
- (void) WriteBlobMSBULong(image,crc32(0,chunk,32));
- option=GetImageOption(image_info,"mng:need-cacheoff");
- if (option != (const char *) NULL)
- {
- size_t
- length;
- /*
- Write "nEED CACHEOFF" to turn playback caching off for streaming MNG.
+ Write "nEED CACHEOFF" to turn playback caching off for
+ streaming MNG.
*/
PNGType(chunk,mng_nEED);
length=CopyMagickString((char *) chunk+4,"CACHEOFF",20);
}
#else /* PNG_LIBPNG_VER > 10011 */
-static MagickBooleanType WritePNGImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WritePNGImage(const ImageInfo *image_info,
+ Image *image)
{
(void) image;
printf("Your PNG library is too old: You have libpng-%s\n",
image_info->filename);
}
-static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,
+ Image *image)
{
return(WritePNGImage(image_info,image));
}