% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2013 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 %
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/color.h"
-#include "magick/color-private.h"
-#include "magick/colorspace.h"
-#include "magick/compress.h"
-#include "magick/constitute.h"
-#include "magick/delegate.h"
-#include "magick/delegate-private.h"
-#include "magick/draw.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/geometry.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/option.h"
-#include "magick/profile.h"
-#include "magick/property.h"
-#include "magick/quantum-private.h"
-#include "magick/resource_.h"
-#include "magick/resize.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/transform.h"
-#include "magick/utility.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/attribute.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/color.h"
+#include "MagickCore/color-private.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
+#include "MagickCore/compress.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/delegate.h"
+#include "MagickCore/delegate-private.h"
+#include "MagickCore/draw.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/geometry.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/option.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/profile.h"
+#include "MagickCore/property.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
+#include "MagickCore/resize.h"
+#include "MagickCore/signature.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/token.h"
+#include "MagickCore/transform.h"
+#include "MagickCore/utility.h"
+#include "MagickCore/module.h"
\f
/*
Define declarations.
Forward declarations.
*/
static MagickBooleanType
- WritePDFImage(const ImageInfo *,Image *);
+ WritePDFImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
code=0;
argv=StringToArgv(command,&argc);
+ if (argv == (char **) NULL)
+ return(MagickFalse);
status=(ghost_info->init_with_args)(interpreter,argc-1,argv+1);
if (status == 0)
status=(ghost_info->run_string)(interpreter,"systemdict /start get exec\n",
static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
+#define CMYKProcessColor "CMYKProcessColor"
#define CropBox "CropBox"
+#define DefaultCMYK "DefaultCMYK"
#define DeviceCMYK "DeviceCMYK"
#define MediaBox "MediaBox"
#define RenderPostscriptText "Rendering Postscript... "
bounds,
hires_bounds;
- ssize_t
- count;
-
size_t
scene,
spotcolor;
+ ssize_t
+ count;
+
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
/*
Open image file.
*/
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
*/
delta.x=DefaultResolution;
delta.y=DefaultResolution;
- if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
+ if ((image->resolution.x == 0.0) || (image->resolution.y == 0.0))
{
flags=ParseGeometry(PSDensityGeometry,&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->resolution.y=image->resolution.x;
+ }
+ if (image_info->density != (char *) NULL)
+ {
+ flags=ParseGeometry(image_info->density,&geometry_info);
+ 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;
}
+ (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
+ if (image_info->page != (char *) NULL)
+ (void) ParseAbsoluteGeometry(image_info->page,&page);
+ page.width=(size_t) ceil((double) (page.width*image->resolution.x/delta.x)-
+ 0.5);
+ page.height=(size_t) ceil((double) (page.height*image->resolution.y/delta.y)-
+ 0.5);
/*
Determine page geometry from the PDF media box.
*/
cmyk=image_info->colorspace == CMYKColorspace ? MagickTrue : MagickFalse;
- cropbox=MagickFalse;
- option=GetImageOption(image_info,"pdf:use-cropbox");
- if (option != (const char *) NULL)
- cropbox=IsMagickTrue(option);
- trimbox=MagickFalse;
- option=GetImageOption(image_info,"pdf:use-trimbox");
- if (option != (const char *) NULL)
- trimbox=IsMagickTrue(option);
+ cropbox=IsStringTrue(GetImageOption(image_info,"pdf:use-cropbox"));
+ trimbox=IsStringTrue(GetImageOption(image_info,"pdf:use-trimbox"));
count=0;
spotcolor=0;
(void) ResetMagickMemory(&bounding_box,0,sizeof(bounding_box));
(void) ResetMagickMemory(&bounds,0,sizeof(bounds));
(void) ResetMagickMemory(&hires_bounds,0,sizeof(hires_bounds));
- (void) ResetMagickMemory(&page,0,sizeof(page));
(void) ResetMagickMemory(command,0,sizeof(command));
- hires_bounds.x2=0.0;
- hires_bounds.y2=0.0;
angle=0.0;
p=command;
for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
/*
Is this a CMYK document?
*/
+ if (LocaleNCompare(DefaultCMYK,command,strlen(DefaultCMYK)) == 0)
+ cmyk=MagickTrue;
if (LocaleNCompare(DeviceCMYK,command,strlen(DeviceCMYK)) == 0)
cmyk=MagickTrue;
+ if (LocaleNCompare(CMYKProcessColor,command,strlen(CMYKProcessColor)) == 0)
+ cmyk=MagickTrue;
if (LocaleNCompare(SpotColor,command,strlen(SpotColor)) == 0)
{
char
/*
Note spot names.
*/
- (void) FormatMagickString(property,MaxTextExtent,"pdf:SpotColor-%.20g",
+ (void) FormatLocaleString(property,MaxTextExtent,"pdf:SpotColor-%.20g",
(double) spotcolor++);
i=0;
for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
name[i]='\0';
value=AcquireString(name);
(void) SubstituteString(&value,"#20"," ");
- (void) SetImageProperty(image,property,value);
+ (void) SetImageProperty(image,property,value,exception);
value=DestroyString(value);
continue;
}
if (LocaleNCompare(PDFVersion,command,strlen(PDFVersion)) == 0)
- (void) SetImageProperty(image,"pdf:Version",command);
+ (void) SetImageProperty(image,"pdf:Version",command,exception);
+ if (image_info->page != (char *) NULL)
+ continue;
count=0;
if (cropbox != MagickFalse)
{
}
if (count != 4)
continue;
- if (((bounds.x2 > hires_bounds.x2) && (bounds.y2 > hires_bounds.y2)) ||
- ((hires_bounds.x2 == 0.0) && (hires_bounds.y2 == 0.0)))
- {
- /*
- Set PDF render geometry.
- */
- (void) FormatMagickString(geometry,MaxTextExtent,
- "%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1,
- bounds.x1,bounds.y1);
- (void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry);
- page.width=(size_t) floor(bounds.x2-bounds.x1+0.5);
- page.height=(size_t) floor(bounds.y2-bounds.y1+0.5);
- hires_bounds=bounds;
- }
+ if ((fabs(bounds.x2-bounds.x1) <= fabs(hires_bounds.x2-hires_bounds.x1)) ||
+ (fabs(bounds.y2-bounds.y1) <= fabs(hires_bounds.y2-hires_bounds.y1)))
+ continue;
+ hires_bounds=bounds;
}
+ if ((fabs(hires_bounds.x2-hires_bounds.x1) >= MagickEpsilon) &&
+ (fabs(hires_bounds.y2-hires_bounds.y1) >= MagickEpsilon))
+ {
+ /*
+ Set PDF render geometry.
+ */
+ (void) FormatLocaleString(geometry,MaxTextExtent,"%gx%g%+.15g%+.15g",
+ hires_bounds.x2-bounds.x1,hires_bounds.y2-hires_bounds.y1,
+ hires_bounds.x1,hires_bounds.y1);
+ (void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry,exception);
+ page.width=(size_t) ceil((double) ((hires_bounds.x2-hires_bounds.x1)*
+ image->resolution.x/delta.x)-0.5);
+ page.height=(size_t) ceil((double) ((hires_bounds.y2-hires_bounds.y1)*
+ image->resolution.y/delta.y)-0.5);
+ }
(void) CloseBlob(image);
if ((fabs(angle) == 90.0) || (fabs(angle) == 270.0))
{
page.width=page.height;
page.height=swap;
}
- if (image_info->colorspace == RGBColorspace)
+ if (IssRGBCompatibleColorspace(image_info->colorspace) != MagickFalse)
cmyk=MagickFalse;
/*
Create Ghostscript control file.
return((Image *) NULL);
}
*options='\0';
- if (image_info->density != (char *) NULL)
- {
- flags=ParseGeometry(image_info->density,&geometry_info);
- image->x_resolution=geometry_info.rho;
- image->y_resolution=geometry_info.sigma;
- if ((flags & SigmaValue) == 0)
- image->y_resolution=image->x_resolution;
- }
- (void) FormatMagickString(density,MaxTextExtent,"%gx%g",image->x_resolution,
- image->y_resolution);
+ (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",image->resolution.x,
+ image->resolution.y);
if (image_info->page != (char *) NULL)
- {
- (void) ParseAbsoluteGeometry(image_info->page,&page);
- page.width=(size_t) floor((double) (page.width*image->x_resolution/
- delta.x)+0.5);
- page.height=(size_t) floor((double) (page.height*image->y_resolution/
- delta.y)+0.5);
- (void) FormatMagickString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
- page.width,(double) page.height);
- }
+ (void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
+ page.width,(double) page.height);
if (cmyk != MagickFalse)
(void) ConcatenateMagickString(options,"-dUseCIEColor ",MaxTextExtent);
if (cropbox != MagickFalse)
char
pages[MaxTextExtent];
- (void) FormatMagickString(pages,MaxTextExtent,"-dFirstPage=%.20g "
+ (void) FormatLocaleString(pages,MaxTextExtent,"-dFirstPage=%.20g "
"-dLastPage=%.20g",(double) read_info->scene+1,(double)
(read_info->scene+read_info->number_scenes));
(void) ConcatenateMagickString(options,pages,MaxTextExtent);
if (read_info->scenes != (char *) NULL)
*read_info->scenes='\0';
}
- if (read_info->authenticate != (char *) NULL)
- (void) FormatMagickString(options+strlen(options),MaxTextExtent,
- " -sPDFPassword=%s",read_info->authenticate);
+ option=GetImageOption(read_info,"authenticate");
+ if (option != (const char *) NULL)
+ (void) FormatLocaleString(options+strlen(options),MaxTextExtent,
+ " -sPCLPassword=%s",option);
(void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
(void) AcquireUniqueFilename(filename);
- (void) ConcatenateMagickString(filename,"-%08d",MaxTextExtent);
- (void) FormatMagickString(command,MaxTextExtent,
+ (void) ConcatenateMagickString(filename,"%d",MaxTextExtent);
+ (void) FormatLocaleString(command,MaxTextExtent,
GetDelegateCommands(delegate_info),
read_info->antialias != MagickFalse ? 4 : 1,
read_info->antialias != MagickFalse ? 4 : 1,density,options,filename,
for (i=1; ; i++)
{
(void) InterpretImageFilename(image_info,image,filename,(int) i,
- read_info->filename);
+ read_info->filename,exception);
if (IsPDFRendered(read_info->filename) == MagickFalse)
break;
(void) RelinquishUniqueFileResource(read_info->filename);
for (i=1; ; i++)
{
(void) InterpretImageFilename(image_info,image,filename,(int) i,
- read_info->filename);
+ read_info->filename,exception);
if (IsPDFRendered(read_info->filename) == MagickFalse)
break;
+ read_info->blob=NULL;
+ read_info->length=0;
next=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
if (next == (Image *) NULL)
{
ThrowFileException(exception,DelegateError,"PostscriptDelegateFailed",
image_info->filename);
+ image=DestroyImage(image);
return((Image *) NULL);
}
if (LocaleCompare(pdf_image->magick,"BMP") == 0)
entry->adjoin=MagickFalse;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
- entry->thread_support=EncoderThreadSupport;
entry->description=ConstantString("Adobe Illustrator CS2");
entry->module=ConstantString("PDF");
(void) RegisterMagickInfo(entry);
entry->adjoin=MagickFalse;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
- entry->thread_support=EncoderThreadSupport;
entry->description=ConstantString("Encapsulated Portable Document Format");
entry->module=ConstantString("PDF");
(void) RegisterMagickInfo(entry);
entry->magick=(IsImageFormatHandler *) IsPDF;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
- entry->thread_support=EncoderThreadSupport;
entry->description=ConstantString("Portable Document Format");
entry->module=ConstantString("PDF");
(void) RegisterMagickInfo(entry);
entry->magick=(IsImageFormatHandler *) IsPDF;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
- entry->thread_support=EncoderThreadSupport;
entry->description=ConstantString("Portable Document Archive Format");
entry->module=ConstantString("PDF");
(void) RegisterMagickInfo(entry);
%
% The format of the WritePDFImage method is:
%
-% MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WritePDFImage(const ImageInfo *image_info,
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static inline size_t MagickMax(const size_t x,const size_t y)
register ssize_t
i;
- static char
- buffer[MaxTextExtent];
-
size_t
escapes;
+ static char
+ buffer[MaxTextExtent];
+
escapes=0;
p=buffer;
for (i=0; i < (ssize_t) MagickMin(strlen(text),(MaxTextExtent-escapes-1)); i++)
}
static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
- Image *image,Image *inject_image)
+ Image *image,Image *inject_image,ExceptionInfo *exception)
{
Image
*group4_image;
write_info=CloneImageInfo(image_info);
(void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
(void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
- group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+ group4_image=CloneImage(inject_image,0,0,MagickTrue,exception);
if (group4_image == (Image *) NULL)
return(MagickFalse);
group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
- &image->exception);
+ exception);
group4_image=DestroyImage(group4_image);
if (group4 == (unsigned char *) NULL)
return(MagickFalse);
return(status);
}
-static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
#define CFormat "/Filter [ /%s ]\n"
#define ObjectsPerImage 14
" <rdf:Description rdf:about=\"\"\n"
" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"
" <dc:format>application/pdf</dc:format>\n"
+ " <dc:title>\n"
+ " <rdf:Alt>\n"
+ " <rdf:li xml:lang=\"x-default\">%s</rdf:li>\n"
+ " </rdf:Alt>\n"
+ " </dc:title>\n"
" </rdf:Description>\n"
" <rdf:Description rdf:about=\"\"\n"
" xmlns:xapMM=\"http://ns.adobe.com/xap/1.0/mm/\">\n"
" </rdf:Description>\n"
" <rdf:Description rdf:about=\"\"\n"
" xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\">\n"
- " <pdfaid:part>1</pdfaid:part>\n"
+ " <pdfaid:part>2</pdfaid:part>\n"
" <pdfaid:conformance>B</pdfaid:conformance>\n"
" </rdf:Description>\n"
" </rdf:RDF>\n"
GeometryInfo
geometry_info;
- ssize_t
- count,
- y;
-
Image
*next,
*tile_image;
media_info,
page_info;
- register const IndexPacket
- *indexes;
-
- register const PixelPacket
+ register const Quantum
*p;
register unsigned char
x;
size_t
- length;
+ info_id,
+ length,
+ object,
+ pages_id,
+ root_id,
+ text_size,
+ version;
+
+ ssize_t
+ count,
+ y;
struct tm
local_time;
unsigned char
*pixels;
- size_t
- info_id,
- object,
- pages_id,
- root_id,
- text_size,
- version;
-
/*
Open output image file.
*/
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
/*
if (image_info->compression == JPEG2000Compression)
version=(size_t) MagickMax(version,5);
for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
- if (next->matte != MagickFalse)
+ if (next->alpha_trait == BlendPixelTrait)
version=(size_t) MagickMax(version,4);
if (LocaleCompare(image_info->magick,"PDFA") == 0)
version=(size_t) MagickMax(version,6);
- (void) FormatMagickString(buffer,MaxTextExtent,"%%PDF-1.%.20g \n",
- (double) version);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%%PDF-1.%.20g \n",(double)
+ version);
(void) WriteBlobString(image,buffer);
if (LocaleCompare(image_info->magick,"PDFA") == 0)
(void) WriteBlobString(image,"%âãÏÓ\n");
*/
xref[object++]=TellBlob(image);
root_id=object;
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
if (LocaleCompare(image_info->magick,"PDFA") != 0)
- (void) FormatMagickString(buffer,MaxTextExtent,"/Pages %.20g 0 R\n",
- (double) object+1);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Pages %.20g 0 R\n",(double)
+ object+1);
else
{
- (void) FormatMagickString(buffer,MaxTextExtent,"/Metadata %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Metadata %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Pages %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Pages %.20g 0 R\n",
(double) object+2);
}
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/Type /Catalog\n");
(void) WriteBlobString(image,">>\n");
(void) WriteBlobString(image,"endobj\n");
+ GetPathComponent(image->filename,BasePath,basename);
if (LocaleCompare(image_info->magick,"PDFA") == 0)
{
char
Write XMP object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",
- (double) object);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
(void) WriteBlobString(image,"/Subtype /XML\n");
*modify_date='\0';
- value=GetImageProperty(image,"date:modify");
+ value=GetImageProperty(image,"date:modify",exception);
if (value != (const char *) NULL)
(void) CopyMagickString(modify_date,value,MaxTextExtent);
*create_date='\0';
- value=GetImageProperty(image,"date:create");
+ value=GetImageProperty(image,"date:create",exception);
if (value != (const char *) NULL)
(void) CopyMagickString(create_date,value,MaxTextExtent);
(void) FormatMagickTime(time((time_t *) NULL),MaxTextExtent,timestamp);
- i=FormatMagickString(xmp_profile,MaxTextExtent,XMPProfile,
+ i=FormatLocaleString(xmp_profile,MaxTextExtent,XMPProfile,
XMPProfileMagick,modify_date,create_date,timestamp,
- GetMagickVersion(&version),GetMagickVersion(&version));
- (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g\n",
- (double) i);
+ GetMagickVersion(&version),EscapeParenthesis(basename),
+ GetMagickVersion(&version));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Length %.20g\n",(double)
+ i);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/Type /Metadata\n");
(void) WriteBlobString(image,">>\nstream\n");
(void) WriteBlobString(image,xmp_profile);
- (void) WriteBlobString(image,"endstream\n");
+ (void) WriteBlobString(image,"\nendstream\n");
(void) WriteBlobString(image,"endobj\n");
}
/*
*/
xref[object++]=TellBlob(image);
pages_id=object;
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
(void) WriteBlobString(image,"/Type /Pages\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Kids [ %.20g 0 R ",
- (double) object+1);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Kids [ %.20g 0 R ",(double)
+ object+1);
(void) WriteBlobString(image,buffer);
count=(ssize_t) (pages_id+ObjectsPerImage+1);
if (image_info->adjoin != MagickFalse)
kid_image=image;
for ( ; GetNextImageInList(kid_image) != (Image *) NULL; count+=ObjectsPerImage)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 R ",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 R ",(double)
count);
(void) WriteBlobString(image,buffer);
kid_image=GetNextImageInList(kid_image);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) WriteBlobString(image,"]\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Count %.20g\n",
- (double) ((count-pages_id)/ObjectsPerImage));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Count %.20g\n",(double)
+ ((count-pages_id)/ObjectsPerImage));
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
(void) WriteBlobString(image,"endobj\n");
case FaxCompression:
case Group4Compression:
{
- if ((IsMonochromeImage(image,&image->exception) == MagickFalse) ||
- (image->matte != MagickFalse))
+ if ((IsImageMonochrome(image,exception) == MagickFalse) ||
+ (image->alpha_trait == BlendPixelTrait))
compression=RLECompression;
break;
}
case JPEGCompression:
{
compression=RLECompression;
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (JPEG)",
image->filename);
break;
case JPEG2000Compression:
{
compression=RLECompression;
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (JP2)",
image->filename);
break;
case ZipCompression:
{
compression=RLECompression;
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (ZLIB)",
image->filename);
break;
}
if (compression == JPEG2000Compression)
{
- if (image->colorspace != RGBColorspace)
- (void) TransformImageColorspace(image,RGBColorspace);
+ if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
}
/*
Scale relative to dots-per-inch.
*/
delta.x=DefaultResolution;
delta.y=DefaultResolution;
- resolution.x=image->x_resolution;
- resolution.y=image->y_resolution;
+ resolution.x=image->resolution.x;
+ resolution.y=image->resolution.y;
if ((resolution.x == 0.0) || (resolution.y == 0.0))
{
flags=ParseGeometry(PSDensityGeometry,&geometry_info);
resolution.y=(double) ((size_t) (100.0*2.54*resolution.y+0.5)/100.0);
}
SetGeometry(image,&geometry);
- (void) FormatMagickString(page_geometry,MaxTextExtent,"%.20gx%.20g",
- (double) image->columns,(double) image->rows);
+ (void) FormatLocaleString(page_geometry,MaxTextExtent,"%.20gx%.20g",(double)
+ image->columns,(double) image->rows);
if (image_info->page != (char *) NULL)
(void) CopyMagickString(page_geometry,image_info->page,MaxTextExtent);
else
if ((image->page.width != 0) && (image->page.height != 0))
- (void) FormatMagickString(page_geometry,MaxTextExtent,
- "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,
- (double) image->page.height,(double) image->page.x,(double)
- image->page.y);
+ (void) FormatLocaleString(page_geometry,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,(double)
+ image->page.height,(double) image->page.x,(double) image->page.y);
else
if ((image->gravity != UndefinedGravity) &&
(LocaleCompare(image_info->magick,"PDF") == 0))
scale.y=(double) (geometry.height*delta.y)/resolution.y;
geometry.height=(size_t) floor(scale.y+0.5);
(void) ParseAbsoluteGeometry(page_geometry,&media_info);
- (void) ParseGravityGeometry(image,page_geometry,&page_info,
- &image->exception);
+ (void) ParseGravityGeometry(image,page_geometry,&page_info,exception);
if (image->gravity != UndefinedGravity)
{
geometry.x=(-page_info.x);
if (image_info->pointsize != 0.0)
pointsize=image_info->pointsize;
text_size=0;
- value=GetImageProperty(image,"label");
+ value=GetImageProperty(image,"label",exception);
if (value != (const char *) NULL)
text_size=(size_t) (MultilineCensus(value)*pointsize+12);
(void) text_size;
Write Page object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
(void) WriteBlobString(image,"/Type /Page\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Parent %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Parent %.20g 0 R\n",
(double) pages_id);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/Resources <<\n");
labels=(char **) NULL;
- value=GetImageProperty(image,"label");
+ value=GetImageProperty(image,"label",exception);
if (value != (const char *) NULL)
labels=StringToList(value);
if (labels != (char **) NULL)
{
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
"/Font << /F%.20g %.20g 0 R >>\n",(double) image->scene,(double)
object+4);
(void) WriteBlobString(image,buffer);
}
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
"/XObject << /Im%.20g %.20g 0 R >>\n",(double) image->scene,(double)
object+5);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/ProcSet %.20g 0 R >>\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/ProcSet %.20g 0 R >>\n",
(double) object+3);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
"/MediaBox [0 0 %g %g]\n",72.0*media_info.width/resolution.x,
72.0*media_info.height/resolution.y);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
"/CropBox [0 0 %g %g]\n",72.0*media_info.width/resolution.x,
72.0*media_info.height/resolution.y);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Contents %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Contents %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Thumb %.20g 0 R\n",
- (double) object+8);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Thumb %.20g 0 R\n",(double)
+ object+8);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
(void) WriteBlobString(image,"endobj\n");
Write Contents object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
for (i=0; labels[i] != (char *) NULL; i++)
{
(void) WriteBlobString(image,"BT\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/F%.20g %g Tf\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/F%.20g %g Tf\n",
(double) image->scene,pointsize);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g Td\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g %.20g Td\n",
(double) geometry.x,(double) (geometry.y+geometry.height+i*pointsize+
12));
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"(%s) Tj\n",labels[i]);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"(%s) Tj\n",labels[i]);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"ET\n");
labels[i]=DestroyString(labels[i]);
}
- (void) FormatMagickString(buffer,MaxTextExtent,"%g 0 0 %g %.20g %.20g cm\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%g 0 0 %g %.20g %.20g cm\n",
scale.x,scale.y,(double) geometry.x,(double) geometry.y);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Im%.20g Do\n",
- (double) image->scene);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Im%.20g Do\n",(double)
+ image->scene);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"Q\n");
offset=TellBlob(image)-offset;
- (void) WriteBlobString(image,"endstream\n");
+ (void) WriteBlobString(image,"\nendstream\n");
(void) WriteBlobString(image,"endobj\n");
/*
Write Length object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"endobj\n");
/*
Write Procset object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",
- (double) object);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ object);
(void) WriteBlobString(image,buffer);
if ((image->storage_class == DirectClass) || (image->colors > 256))
(void) CopyMagickString(buffer,"[ /PDF /Text /ImageC",MaxTextExtent);
Write Font object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",
- (double) object);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
if (labels != (char **) NULL)
{
(void) WriteBlobString(image,"/Type /Font\n");
(void) WriteBlobString(image,"/Subtype /Type1\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Name /F%.20g\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Name /F%.20g\n",
(double) image->scene);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/BaseFont /Helvetica\n");
Write XObject object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
(void) WriteBlobString(image,"/Type /XObject\n");
(void) WriteBlobString(image,"/Subtype /Image\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Name /Im%.20g\n",
- (double) image->scene);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Name /Im%.20g\n",(double)
+ image->scene);
(void) WriteBlobString(image,buffer);
switch (compression)
{
case NoCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"ASCII85Decode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"ASCII85Decode");
break;
}
case JPEGCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"DCTDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"DCTDecode");
if (image->colorspace != CMYKColorspace)
break;
(void) WriteBlobString(image,buffer);
}
case JPEG2000Compression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"JPXDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"JPXDecode");
if (image->colorspace != CMYKColorspace)
break;
(void) WriteBlobString(image,buffer);
}
case LZWCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"LZWDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"LZWDecode");
break;
}
case ZipCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"FlateDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"FlateDecode");
break;
}
case FaxCompression:
(void) CopyMagickString(buffer,"/Filter [ /CCITTFaxDecode ]\n",
MaxTextExtent);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/DecodeParms [ << "
"/K %s /BlackIs1 false /Columns %.20g /Rows %.20g >> ]\n",CCITTParam,
(double) image->columns,(double) image->rows);
break;
}
default:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,
"RunLengthDecode");
break;
}
}
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
image->columns);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Height %.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Height %.20g\n",(double)
image->rows);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/ColorSpace %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/ColorSpace %.20g 0 R\n",
(double) object+2);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
(compression == FaxCompression) || (compression == Group4Compression) ?
1 : 8);
(void) WriteBlobString(image,buffer);
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"/SMask %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/SMask %.20g 0 R\n",
(double) object+7);
(void) WriteBlobString(image,buffer);
}
- (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
if ((compression == FaxCompression) || (compression == Group4Compression) ||
((image_info->type != TrueColorType) &&
- (IsGrayImage(image,&image->exception) != MagickFalse)))
+ (IsImageGray(image,exception) != MagickFalse)))
{
switch (compression)
{
{
if (LocaleCompare(CCITTParam,"0") == 0)
{
- (void) HuffmanEncodeImage(image_info,image,image);
+ (void) HuffmanEncodeImage(image_info,image,image,exception);
break;
}
- (void) Huffman2DEncodeImage(image_info,image,image);
+ (void) Huffman2DEncodeImage(image_info,image,image,exception);
break;
}
case JPEGCompression:
{
- status=InjectImageBlob(image_info,image,image,"jpeg",
- &image->exception);
+ status=InjectImageBlob(image_info,image,image,"jpeg",exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case JPEG2000Compression:
{
- status=InjectImageBlob(image_info,image,image,"jp2",
- &image->exception);
+ status=InjectImageBlob(image_info,image,image,"jp2",exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case RLECompression:
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar(PixelIntensityToQuantum(p));
- p++;
+ *q++=ScaleQuantumToChar(GetPixelIntensity(image,p));
+ p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
{
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
Ascii85Initialize(image);
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- Ascii85Encode(image,
- ScaleQuantumToChar(PixelIntensityToQuantum(p)));
- p++;
+ Ascii85Encode(image,ScaleQuantumToChar(
+ GetPixelIntensity(image,p)));
+ p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
{
{
case JPEGCompression:
{
- status=InjectImageBlob(image_info,image,image,"jpeg",
- &image->exception);
+ status=InjectImageBlob(image_info,image,image,"jpeg",exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case JPEG2000Compression:
{
- status=InjectImageBlob(image_info,image,image,"jp2",
- &image->exception);
+ status=InjectImageBlob(image_info,image,image,"jp2",exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case RLECompression:
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
- *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
- *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
+ *q++=ScaleQuantumToChar(GetPixelRed(image,p));
+ *q++=ScaleQuantumToChar(GetPixelGreen(image,p));
+ *q++=ScaleQuantumToChar(GetPixelBlue(image,p));
if (image->colorspace == CMYKColorspace)
- *q++=ScaleQuantumToChar(indexes[x]);
- p++;
+ *q++=ScaleQuantumToChar(GetPixelBlack(image,p));
+ p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
{
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
Ascii85Initialize(image);
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
- Ascii85Encode(image,ScaleQuantumToChar(
- GetRedPixelComponent(p)));
- Ascii85Encode(image,ScaleQuantumToChar(
- GetGreenPixelComponent(p)));
- Ascii85Encode(image,ScaleQuantumToChar(
- GetBluePixelComponent(p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetPixelRed(image,p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetPixelGreen(image,p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetPixelBlue(image,p)));
if (image->colorspace == CMYKColorspace)
- Ascii85Encode(image,ScaleQuantumToChar(indexes[x]));
- p++;
+ Ascii85Encode(image,ScaleQuantumToChar(
+ GetPixelBlack(image,p)));
+ p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
{
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ {
+ *q++=(unsigned char) GetPixelIndex(image,p);
+ p+=GetPixelChannels(image);
+ }
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
Ascii85Initialize(image);
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- Ascii85Encode(image,(unsigned char) indexes[x]);
+ {
+ Ascii85Encode(image,(unsigned char) GetPixelIndex(image,p));
+ p+=GetPixelChannels(image);
+ }
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,
Write Length object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",
- (double) offset);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"endobj\n");
/*
Write Colorspace object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
if (image->colorspace == CMYKColorspace)
if ((compression == FaxCompression) ||
(compression == Group4Compression) ||
((image_info->type != TrueColorType) &&
- (IsGrayImage(image,&image->exception) != MagickFalse)))
+ (IsImageGray(image,exception) != MagickFalse)))
(void) CopyMagickString(buffer,"/DeviceGray\n",MaxTextExtent);
else
if ((image->storage_class == DirectClass) || (image->colors > 256) ||
(compression == JPEG2000Compression))
(void) CopyMagickString(buffer,"/DeviceRGB\n",MaxTextExtent);
else
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
"[ /Indexed /DeviceRGB %.20g %.20g 0 R ]\n",(double) image->colors-
1,(double) object+3);
(void) WriteBlobString(image,buffer);
SetGeometry(image,&geometry);
(void) ParseMetaGeometry("106x106+0+0>",&geometry.x,&geometry.y,
&geometry.width,&geometry.height);
- tile_image=ThumbnailImage(image,geometry.width,geometry.height,
- &image->exception);
+ tile_image=ThumbnailImage(image,geometry.width,geometry.height,exception);
if (tile_image == (Image *) NULL)
- ThrowWriterException(ResourceLimitError,image->exception.reason);
+ return(MagickFalse);
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
{
case NoCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"ASCII85Decode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"ASCII85Decode");
break;
}
case JPEGCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"DCTDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"DCTDecode");
if (image->colorspace != CMYKColorspace)
break;
(void) WriteBlobString(image,buffer);
}
case JPEG2000Compression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"JPXDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"JPXDecode");
if (image->colorspace != CMYKColorspace)
break;
(void) WriteBlobString(image,buffer);
}
case LZWCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"LZWDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"LZWDecode");
break;
}
case ZipCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"FlateDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"FlateDecode");
break;
}
case FaxCompression:
(void) CopyMagickString(buffer,"/Filter [ /CCITTFaxDecode ]\n",
MaxTextExtent);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/DecodeParms [ << "
"/K %s /BlackIs1 false /Columns %.20g /Rows %.20g >> ]\n",CCITTParam,
(double) tile_image->columns,(double) tile_image->rows);
break;
}
default:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,
"RunLengthDecode");
break;
}
}
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
tile_image->columns);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Height %.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Height %.20g\n",(double)
tile_image->rows);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/ColorSpace %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/ColorSpace %.20g 0 R\n",
(double) object-1);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
(compression == FaxCompression) || (compression == Group4Compression) ?
1 : 8);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
if ((compression == FaxCompression) ||
(compression == Group4Compression) ||
((image_info->type != TrueColorType) &&
- (IsGrayImage(tile_image,&image->exception) != MagickFalse)))
+ (IsImageGray(tile_image,exception) != MagickFalse)))
{
switch (compression)
{
{
if (LocaleCompare(CCITTParam,"0") == 0)
{
- (void) HuffmanEncodeImage(image_info,image,tile_image);
+ (void) HuffmanEncodeImage(image_info,image,tile_image,
+ exception);
break;
}
- (void) Huffman2DEncodeImage(image_info,image,tile_image);
+ (void) Huffman2DEncodeImage(image_info,image,tile_image,exception);
break;
}
case JPEGCompression:
{
status=InjectImageBlob(image_info,image,tile_image,"jpeg",
- &image->exception);
+ exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,tile_image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case JPEG2000Compression:
{
- status=InjectImageBlob(image_info,image,tile_image,"jp2",
- &image->exception);
+ status=InjectImageBlob(image_info,image,tile_image,"jp2",exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,tile_image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case RLECompression:
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
- &tile_image->exception);
- if (p == (const PixelPacket *) NULL)
+ exception);
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
- *q++=ScaleQuantumToChar(PixelIntensityToQuantum(p));
- p++;
+ *q++=ScaleQuantumToChar(GetPixelIntensity(tile_image,p));
+ p+=GetPixelChannels(tile_image);
}
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
- &tile_image->exception);
- if (p == (const PixelPacket *) NULL)
+ exception);
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
Ascii85Encode(image,
- ScaleQuantumToChar(PixelIntensityToQuantum(p)));
- p++;
+ ScaleQuantumToChar(GetPixelIntensity(tile_image,p)));
+ p+=GetPixelChannels(tile_image);
}
}
Ascii85Flush(image);
case JPEGCompression:
{
status=InjectImageBlob(image_info,image,tile_image,"jpeg",
- &image->exception);
+ exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,tile_image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case JPEG2000Compression:
{
- status=InjectImageBlob(image_info,image,tile_image,"jp2",
- &image->exception);
+ status=InjectImageBlob(image_info,image,tile_image,"jp2",exception);
if (status == MagickFalse)
- ThrowWriterException(CoderError,tile_image->exception.reason);
+ {
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
break;
}
case RLECompression:
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
- &tile_image->exception);
- if (p == (const PixelPacket *) NULL)
+ exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(tile_image);
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
- *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
- *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
+ *q++=ScaleQuantumToChar(GetPixelRed(tile_image,p));
+ *q++=ScaleQuantumToChar(GetPixelGreen(tile_image,p));
+ *q++=ScaleQuantumToChar(GetPixelBlue(tile_image,p));
if (image->colorspace == CMYKColorspace)
- *q++=ScaleQuantumToChar(indexes[x]);
- p++;
+ *q++=ScaleQuantumToChar(GetPixelBlack(tile_image,p));
+ p+=GetPixelChannels(tile_image);
}
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
- &tile_image->exception);
- if (p == (const PixelPacket *) NULL)
+ exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(tile_image);
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
Ascii85Encode(image,ScaleQuantumToChar(
- GetRedPixelComponent(p)));
+ GetPixelRed(tile_image,p)));
Ascii85Encode(image,ScaleQuantumToChar(
- GetGreenPixelComponent(p)));
+ GetPixelGreen(tile_image,p)));
Ascii85Encode(image,ScaleQuantumToChar(
- GetBluePixelComponent(p)));
+ GetPixelBlue(tile_image,p)));
if (image->colorspace == CMYKColorspace)
- Ascii85Encode(image,ScaleQuantumToChar(indexes[x]));
- p++;
+ Ascii85Encode(image,ScaleQuantumToChar(
+ GetPixelBlack(tile_image,p)));
+ p+=GetPixelChannels(tile_image);
}
}
Ascii85Flush(image);
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
- &tile_image->exception);
- if (p == (const PixelPacket *) NULL)
+ exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(tile_image);
for (x=0; x < (ssize_t) tile_image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ {
+ *q++=(unsigned char) GetPixelIndex(tile_image,p);
+ p+=GetPixelChannels(tile_image);
+ }
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
- &tile_image->exception);
- if (p == (const PixelPacket *) NULL)
+ exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(tile_image);
for (x=0; x < (ssize_t) tile_image->columns; x++)
- Ascii85Encode(image,(unsigned char) indexes[x]);
+ {
+ Ascii85Encode(image,(unsigned char)
+ GetPixelIndex(tile_image,p));
+ p+=GetPixelChannels(image);
+ }
}
Ascii85Flush(image);
break;
Write Length object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"endobj\n");
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
- if ((image->storage_class != DirectClass) && (image->colors <= 256) &&
- (compression != FaxCompression) && (compression != Group4Compression))
+ (void) WriteBlobString(image,"<<\n");
+ if ((image->storage_class == DirectClass) || (image->colors > 256) ||
+ (compression == FaxCompression) || (compression == Group4Compression))
+ (void) WriteBlobString(image,">>\n");
+ else
{
/*
Write Colormap object.
*/
- (void) WriteBlobString(image,"<<\n");
if (compression == NoCompression)
(void) WriteBlobString(image,"/Filter [ /ASCII85Decode ]\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
Write Length object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g\n",(double)
offset);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"endobj\n");
Write softmask object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
- if (image->matte == MagickFalse)
+ if (image->alpha_trait != BlendPixelTrait)
(void) WriteBlobString(image,">>\n");
else
{
(void) WriteBlobString(image,"/Type /XObject\n");
(void) WriteBlobString(image,"/Subtype /Image\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Name /Ma%.20g\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Name /Ma%.20g\n",
(double) image->scene);
(void) WriteBlobString(image,buffer);
switch (compression)
{
case NoCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,
"ASCII85Decode");
break;
}
case LZWCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,"LZWDecode");
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,"LZWDecode");
break;
}
case ZipCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,
"FlateDecode");
break;
}
default:
{
- (void) FormatMagickString(buffer,MaxTextExtent,CFormat,
+ (void) FormatLocaleString(buffer,MaxTextExtent,CFormat,
"RunLengthDecode");
break;
}
}
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Width %.20g\n",
- (double) image->columns);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
+ image->columns);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Height %.20g\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Height %.20g\n",
(double) image->rows);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/ColorSpace /DeviceGray\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
(compression == FaxCompression) || (compression == Group4Compression)
? 1 : 8);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
(double) object+1);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar((Quantum) (GetAlphaPixelComponent(p)));
- p++;
+ *q++=ScaleQuantumToChar(GetPixelAlpha(image,p));
+ p+=GetPixelChannels(image);
}
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
- status=ZLIBEncodeImage(image,length,pixels);
+ status=ZLIBEncodeImage(image,length,pixels,exception);
else
#endif
if (compression == LZWCompression)
- status=LZWEncodeImage(image,length,pixels);
+ status=LZWEncodeImage(image,length,pixels,exception);
else
- status=PackbitsEncodeImage(image,length,pixels);
+ status=PackbitsEncodeImage(image,length,pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
Ascii85Initialize(image);
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- Ascii85Encode(image,ScaleQuantumToChar((Quantum) (QuantumRange-
- GetOpacityPixelComponent(p))));
- p++;
+ Ascii85Encode(image,ScaleQuantumToChar(GetPixelAlpha(image,p)));
+ p+=GetPixelChannels(image);
}
}
Ascii85Flush(image);
Write Length object.
*/
xref[object++]=TellBlob(image);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"endobj\n");
if (GetNextImageInList(image) == (Image *) NULL)
*/
xref[object++]=TellBlob(image);
info_id=object;
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
object);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<<\n");
- GetPathComponent(image->filename,BasePath,basename);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Title (%s)\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Title (%s)\n",
EscapeParenthesis(basename));
(void) WriteBlobString(image,buffer);
seconds=time((time_t *) NULL);
#else
(void) memcpy(&local_time,localtime(&seconds),sizeof(local_time));
#endif
- (void) FormatMagickString(date,MaxTextExtent,"D:%04d%02d%02d%02d%02d%02d",
+ (void) FormatLocaleString(date,MaxTextExtent,"D:%04d%02d%02d%02d%02d%02d",
local_time.tm_year+1900,local_time.tm_mon+1,local_time.tm_mday,
local_time.tm_hour,local_time.tm_min,local_time.tm_sec);
- (void) FormatMagickString(buffer,MaxTextExtent,"/CreationDate (%s)\n",date);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/CreationDate (%s)\n",date);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/ModDate (%s)\n",date);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/ModDate (%s)\n",date);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Producer (%s)\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Producer (%s)\n",
EscapeParenthesis(GetMagickVersion((size_t *) NULL)));
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
/*
Write Xref object.
*/
- offset=TellBlob(image)-xref[0]+10;
+ offset=TellBlob(image)-xref[0]+
+ (LocaleCompare(image_info->magick,"PDFA") == 0 ? 6 : 0)+10;
(void) WriteBlobString(image,"xref\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"0 %.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"0 %.20g\n",(double)
object+1);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"0000000000 65535 f \n");
for (i=0; i < (ssize_t) object; i++)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"%010lu 00000 n \n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%010lu 00000 n \n",
(unsigned long) xref[i]);
(void) WriteBlobString(image,buffer);
}
(void) WriteBlobString(image,"trailer\n");
(void) WriteBlobString(image,"<<\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"/Size %.20g\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Size %.20g\n",(double)
object+1);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Info %.20g 0 R\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Info %.20g 0 R\n",(double)
info_id);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"/Root %.20g 0 R\n",(double)
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/Root %.20g 0 R\n",(double)
root_id);
(void) WriteBlobString(image,buffer);
+ (void) SignatureImage(image,exception);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"/ID [<%s> <%s>]\n",
+ GetImageProperty(image,"signature",exception),
+ GetImageProperty(image,"signature",exception));
+ (void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,">>\n");
(void) WriteBlobString(image,"startxref\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"%%EOF\n");
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);