% Write Postscript Level II Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2015 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 %
entry=SetMagickInfo("EPS2");
entry->encoder=(EncodeImageHandler *) WritePS2Image;
- entry->adjoin=MagickFalse;
- entry->seekable_stream=MagickTrue;
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderSeekableStreamFlag;
entry->description=ConstantString("Level II Encapsulated PostScript");
+ entry->mime_type=ConstantString("application/postscript");
entry->module=ConstantString("PS2");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PS2");
entry->encoder=(EncodeImageHandler *) WritePS2Image;
- entry->seekable_stream=MagickTrue;
+ entry->flags|=CoderSeekableStreamFlag;
entry->description=ConstantString("Level II PostScript");
+ entry->mime_type=ConstantString("application/postscript");
entry->module=ConstantString("PS2");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
{
(void) FormatLocaleString(buffer,MaxTextExtent,
"%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
- ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
+ ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatLocaleString(buffer,MaxTextExtent,
"%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
"%%%%Pages: %.20g\n",(double) GetImageListLength(image));
(void) WriteBlobString(image,buffer);
}
+ if (image->colorspace == CMYKColorspace)
+ (void) WriteBlobString(image,
+ "%%DocumentProcessColors: Cyan Magenta Yellow Black\n");
(void) WriteBlobString(image,"%%EndComments\n");
(void) WriteBlobString(image,"\n%%BeginDefaults\n");
(void) WriteBlobString(image,"%%EndDefaults\n\n");
case RLECompression:
default:
{
+ MemoryInfo
+ *pixel_info;
+
register unsigned char
*q;
Allocate pixel array.
*/
length=(size_t) number_pixels;
- pixels=(unsigned char *) AcquireQuantumMemory(length,
- sizeof(*pixels));
- if (pixels == (unsigned char *) NULL)
+ pixel_info=AcquireVirtualMemory(length,sizeof(*pixels));
+ if (pixel_info == (MemoryInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+ pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
/*
- Dump Runlength encoded pixels.
+ Dump runlength encoded pixels.
*/
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetPixelIntensity(image,p));
+ *q++=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
p+=GetPixelChannels(image);
}
progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
status=LZWEncodeImage(image,length,pixels,exception);
else
status=PackbitsEncodeImage(image,length,pixels,exception);
- pixels=(unsigned char *) RelinquishMagickMemory(pixels);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
if (status == MagickFalse)
{
(void) CloseBlob(image);
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- Ascii85Encode(image,ScaleQuantumToChar(
- GetPixelIntensity(image,p)));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ GetPixelLuma(image,p))));
p+=GetPixelChannels(image);
}
progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType)
}
else
if ((image->storage_class == DirectClass) || (image->colors > 256) ||
- (compression == JPEGCompression) || (image->alpha_trait == BlendPixelTrait))
+ (compression == JPEGCompression) || (image->alpha_trait != UndefinedPixelTrait))
{
(void) FormatLocaleString(buffer,MaxTextExtent,"%.20g %.20g\n0\n%d\n",
(double) image->columns,(double) image->rows,(int)
case RLECompression:
default:
{
+ MemoryInfo
+ *pixel_info;
+
register unsigned char
*q;
Allocate pixel array.
*/
length=(size_t) number_pixels;
- pixels=(unsigned char *) AcquireQuantumMemory(length,
- 4*sizeof(*pixels));
- if (pixels == (unsigned char *) NULL)
+ pixel_info=AcquireVirtualMemory(length,4*sizeof(*pixels));
+ if (pixel_info == (MemoryInfo *) NULL)
ThrowWriterException(ResourceLimitError,
"MemoryAllocationFailed");
+ pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
/*
- Dump Packbit encoded pixels.
+ Dump runlength encoded pixels.
*/
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if ((image->alpha_trait == BlendPixelTrait) &&
+ if ((image->alpha_trait != UndefinedPixelTrait) &&
(GetPixelAlpha(image,p) == (Quantum) TransparentAlpha))
{
*q++=ScaleQuantumToChar(QuantumRange);
(void) CloseBlob(image);
return(MagickFalse);
}
- pixels=(unsigned char *) RelinquishMagickMemory(pixels);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
break;
}
case NoCompression:
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if ((image->alpha_trait == BlendPixelTrait) &&
+ if ((image->alpha_trait != UndefinedPixelTrait) &&
(GetPixelAlpha(image,p) == (Quantum) TransparentAlpha))
{
Ascii85Encode(image,ScaleQuantumToChar((Quantum)
case RLECompression:
default:
{
+ MemoryInfo
+ *pixel_info;
+
register unsigned char
*q;
Allocate pixel array.
*/
length=(size_t) number_pixels;
- pixels=(unsigned char *) AcquireQuantumMemory(length,
- sizeof(*pixels));
- if (pixels == (unsigned char *) NULL)
+ pixel_info=AcquireVirtualMemory(length,sizeof(*pixels));
+ if (pixel_info == (MemoryInfo *) NULL)
ThrowWriterException(ResourceLimitError,
"MemoryAllocationFailed");
+ pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
/*
- Dump Runlength encoded pixels.
+ Dump runlength encoded pixels.
*/
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
status=LZWEncodeImage(image,length,pixels,exception);
else
status=PackbitsEncodeImage(image,length,pixels,exception);
- pixels=(unsigned char *) RelinquishMagickMemory(pixels);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
if (status == MagickFalse)
{
(void) CloseBlob(image);
{
(void) FormatLocaleString(buffer,MaxTextExtent,
"%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
- ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
+ ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatLocaleString(buffer,MaxTextExtent,
"%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,