ExceptionInfo *exception)
{
static const char
- *const PostscriptProlog[]=
- {
- "/ByteStreamDecodeFilter",
- "{",
- " /z exch def",
- " /r exch def",
- " /c exch def",
- " z " PS3_NoCompression " eq { /ASCII85Decode filter } if",
- " z " PS3_FaxCompression " eq",
- " {",
- " <<",
- " /K " CCITTParam,
- " /Columns c",
- " /Rows r",
- " >>",
- " /CCITTFaxDecode filter",
- " } if",
- " z " PS3_JPEGCompression " eq { /DCTDecode filter } if",
- " z " PS3_LZWCompression " eq { /LZWDecode filter } if",
- " z " PS3_RLECompression " eq { /RunLengthDecode filter } if",
- " z " PS3_ZipCompression " eq { /FlateDecode filter } if",
- "} bind def",
- "",
- "/DirectClassImageDict",
- "{",
- " colorspace " PS3_RGBColorspace " eq",
- " {",
- " /DeviceRGB setcolorspace",
- " <<",
- " /ImageType 1",
- " /Width columns",
- " /Height rows",
- " /BitsPerComponent 8",
- " /DataSource pixel_stream",
- " /MultipleDataSources false",
- " /ImageMatrix [columns 0 0 rows neg 0 rows]",
- " /Decode [0 1 0 1 0 1]",
- " >>",
- " }",
- " {",
- " /DeviceCMYK setcolorspace",
- " <<",
- " /ImageType 1",
- " /Width columns",
- " /Height rows",
- " /BitsPerComponent 8",
- " /DataSource pixel_stream",
- " /MultipleDataSources false",
- " /ImageMatrix [columns 0 0 rows neg 0 rows]",
- " /Decode",
- " compression " PS3_JPEGCompression " eq",
- " { [1 0 1 0 1 0 1 0] }",
- " { [0 1 0 1 0 1 0 1] }",
- " ifelse",
- " >>",
- " }",
- " ifelse",
- "} bind def",
- "",
- "/PseudoClassImageDict",
- "{",
- " % Colors in colormap image.",
- " currentfile buffer readline pop",
- " token pop /colors exch def pop",
- " colors 0 eq",
- " {",
- " % Depth of grayscale image.",
- " currentfile buffer readline pop",
- " token pop /bits exch def pop",
- " /DeviceGray setcolorspace",
- " <<",
- " /ImageType 1",
- " /Width columns",
- " /Height rows",
- " /BitsPerComponent bits",
- " /Decode [0 1]",
- " /ImageMatrix [columns 0 0 rows neg 0 rows]",
- " /DataSource pixel_stream",
- " >>",
- " }",
- " {",
- " % RGB colormap.",
- " /colormap colors 3 mul string def",
- " compression " PS3_NoCompression " eq",
- " { currentfile /ASCII85Decode filter colormap readstring pop pop }",
- " { currentfile colormap readstring pop pop }",
- " ifelse",
- " [ /Indexed /DeviceRGB colors 1 sub colormap ] setcolorspace",
- " <<",
- " /ImageType 1",
- " /Width columns",
- " /Height rows",
- " /BitsPerComponent 8",
- " /Decode [0 255]",
- " /ImageMatrix [columns 0 0 rows neg 0 rows]",
- " /DataSource pixel_stream",
- " >>",
- " }",
- " ifelse",
- "} bind def",
- "",
- "/NonMaskedImageDict",
- "{",
- " class " PS3_PseudoClass " eq",
- " { PseudoClassImageDict }",
- " { DirectClassImageDict }",
- " ifelse",
- "} bind def",
- "",
- "/MaskedImageDict",
- "{",
- " <<",
- " /ImageType 3",
- " /InterleaveType 3",
- " /DataDict NonMaskedImageDict",
- " /MaskDict",
- " <<",
- " /ImageType 1",
- " /Width columns",
- " /Height rows",
- " /BitsPerComponent 1",
- " /DataSource mask_stream",
- " /MultipleDataSources false",
- " /ImageMatrix [ columns 0 0 rows neg 0 rows]",
- " /Decode [ 0 1 ]",
- " >>",
- " >>",
- "} bind def",
- "",
- "/ClipImage",
- "{} def",
- "",
- "/DisplayImage",
- "{",
- " gsave",
- " /buffer 512 string def",
- " % Translation.",
- " currentfile buffer readline pop",
- " token pop /x exch def",
- " token pop /y exch def pop",
- " x y translate",
- " % Image size and font size.",
- " currentfile buffer readline pop",
- " token pop /x exch def",
- " token pop /y exch def pop",
- " currentfile buffer readline pop",
- " token pop /pointsize exch def pop",
- (const char *) NULL
- },
- *const PostscriptEpilog[]=
- {
- " x y scale",
- " % Clipping path.",
- " currentfile buffer readline pop",
- " token pop /clipped exch def pop",
- " % Showpage.",
- " currentfile buffer readline pop",
- " token pop /sp exch def pop",
- " % Image pixel size.",
- " currentfile buffer readline pop",
- " token pop /columns exch def",
- " token pop /rows exch def pop",
- " % Colorspace (RGB/CMYK).",
- " currentfile buffer readline pop",
- " token pop /colorspace exch def pop",
- " % Transparency.",
- " currentfile buffer readline pop",
- " token pop /alpha exch def pop",
- " % Stencil mask?",
- " currentfile buffer readline pop",
- " token pop /stencil exch def pop",
- " % Image class (direct/pseudo).",
- " currentfile buffer readline pop",
- " token pop /class exch def pop",
- " % Compression type.",
- " currentfile buffer readline pop",
- " token pop /compression exch def pop",
- " % Clip and render.",
- " /pixel_stream currentfile columns rows compression ByteStreamDecodeFilter def",
- " clipped { ClipImage } if",
- " alpha stencil not and",
- " { MaskedImageDict mask_stream resetfile }",
- " { NonMaskedImageDict }",
- " ifelse",
- " stencil { 0 setgray imagemask } { image } ifelse",
- " grestore",
- " sp { showpage } if",
- "} bind def",
- (const char *) NULL
- };
+ PostscriptProlog[] =
+ "/ByteStreamDecodeFilter\n"
+ "{\n"
+ " /z exch def\n"
+ " /r exch def\n"
+ " /c exch def\n"
+ " z " PS3_NoCompression " eq { /ASCII85Decode filter } if\n"
+ " z " PS3_FaxCompression " eq\n"
+ " {\n"
+ " <<\n"
+ " /K " CCITTParam "\n"
+ " /Columns c\n"
+ " /Rows r\n"
+ " >>\n"
+ " /CCITTFaxDecode filter\n"
+ " } if\n"
+ " z " PS3_JPEGCompression " eq { /DCTDecode filter } if\n"
+ " z " PS3_LZWCompression " eq { /LZWDecode filter } if\n"
+ " z " PS3_RLECompression " eq { /RunLengthDecode filter } if\n"
+ " z " PS3_ZipCompression " eq { /FlateDecode filter } if\n"
+ "} bind def\n"
+ "\n"
+ "/DirectClassImageDict\n"
+ "{\n"
+ " colorspace " PS3_RGBColorspace " eq\n"
+ " {\n"
+ " /DeviceRGB setcolorspace\n"
+ " <<\n"
+ " /ImageType 1\n"
+ " /Width columns\n"
+ " /Height rows\n"
+ " /BitsPerComponent 8\n"
+ " /DataSource pixel_stream\n"
+ " /MultipleDataSources false\n"
+ " /ImageMatrix [columns 0 0 rows neg 0 rows]\n"
+ " /Decode [0 1 0 1 0 1]\n"
+ " >>\n"
+ " }\n"
+ " {\n"
+ " /DeviceCMYK setcolorspace\n"
+ " <<\n"
+ " /ImageType 1\n"
+ " /Width columns\n"
+ " /Height rows\n"
+ " /BitsPerComponent 8\n"
+ " /DataSource pixel_stream\n"
+ " /MultipleDataSources false\n"
+ " /ImageMatrix [columns 0 0 rows neg 0 rows]\n"
+ " /Decode\n"
+ " compression " PS3_JPEGCompression " eq\n"
+ " { [1 0 1 0 1 0 1 0] }\n"
+ " { [0 1 0 1 0 1 0 1] }\n"
+ " ifelse\n"
+ " >>\n"
+ " }\n"
+ " ifelse\n"
+ "} bind def\n"
+ "\n"
+ "/PseudoClassImageDict\n"
+ "{\n"
+ " % Colors in colormap image.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /colors exch def pop\n"
+ " colors 0 eq\n"
+ " {\n"
+ " % Depth of grayscale image.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /bits exch def pop\n"
+ " /DeviceGray setcolorspace\n"
+ " <<\n"
+ " /ImageType 1\n"
+ " /Width columns\n"
+ " /Height rows\n"
+ " /BitsPerComponent bits\n"
+ " /Decode [0 1]\n"
+ " /ImageMatrix [columns 0 0 rows neg 0 rows]\n"
+ " /DataSource pixel_stream\n"
+ " >>\n"
+ " }\n"
+ " {\n"
+ " % RGB colormap.\n"
+ " /colormap colors 3 mul string def\n"
+ " compression " PS3_NoCompression " eq\n"
+ " { currentfile /ASCII85Decode filter colormap readstring pop pop }\n"
+ " { currentfile colormap readstring pop pop }\n"
+ " ifelse\n"
+ " [ /Indexed /DeviceRGB colors 1 sub colormap ] setcolorspace\n"
+ " <<\n"
+ " /ImageType 1\n"
+ " /Width columns\n"
+ " /Height rows\n"
+ " /BitsPerComponent 8\n"
+ " /Decode [0 255]\n"
+ " /ImageMatrix [columns 0 0 rows neg 0 rows]\n"
+ " /DataSource pixel_stream\n"
+ " >>\n"
+ " }\n"
+ " ifelse\n"
+ "} bind def\n"
+ "\n"
+ "/NonMaskedImageDict\n"
+ "{\n"
+ " class " PS3_PseudoClass " eq\n"
+ " { PseudoClassImageDict }\n"
+ " { DirectClassImageDict }\n"
+ " ifelse\n"
+ "} bind def\n"
+ "\n"
+ "/MaskedImageDict\n"
+ "{\n"
+ " <<\n"
+ " /ImageType 3\n"
+ " /InterleaveType 3\n"
+ " /DataDict NonMaskedImageDict\n"
+ " /MaskDict\n"
+ " <<\n"
+ " /ImageType 1\n"
+ " /Width columns\n"
+ " /Height rows\n"
+ " /BitsPerComponent 1\n"
+ " /DataSource mask_stream\n"
+ " /MultipleDataSources false\n"
+ " /ImageMatrix [ columns 0 0 rows neg 0 rows]\n"
+ " /Decode [ 0 1 ]\n"
+ " >>\n"
+ " >>\n"
+ "} bind def\n"
+ "\n"
+ "/ClipImage\n"
+ "{} def\n"
+ "\n"
+ "/DisplayImage\n"
+ "{\n"
+ " gsave\n"
+ " /buffer 512 string def\n"
+ " % Translation.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /x exch def\n"
+ " token pop /y exch def pop\n"
+ " x y translate\n"
+ " % Image size and font size.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /x exch def\n"
+ " token pop /y exch def pop\n"
+ " currentfile buffer readline pop\n"
+ " token pop /pointsize exch def pop\n";
+ static const char
+ PostscriptEpilog[] =
+ " x y scale\n"
+ " % Clipping path.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /clipped exch def pop\n"
+ " % Showpage.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /sp exch def pop\n"
+ " % Image pixel size.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /columns exch def\n"
+ " token pop /rows exch def pop\n"
+ " % Colorspace (RGB/CMYK).\n"
+ " currentfile buffer readline pop\n"
+ " token pop /colorspace exch def pop\n"
+ " % Transparency.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /alpha exch def pop\n"
+ " % Stencil mask?\n"
+ " currentfile buffer readline pop\n"
+ " token pop /stencil exch def pop\n"
+ " % Image class (direct/pseudo).\n"
+ " currentfile buffer readline pop\n"
+ " token pop /class exch def pop\n"
+ " % Compression type.\n"
+ " currentfile buffer readline pop\n"
+ " token pop /compression exch def pop\n"
+ " % Clip and render.\n"
+ " /pixel_stream currentfile columns rows compression ByteStreamDecodeFilter def\n"
+ " clipped { ClipImage } if\n"
+ " alpha stencil not and\n"
+ " { MaskedImageDict mask_stream resetfile }\n"
+ " { NonMaskedImageDict }\n"
+ " ifelse\n"
+ " stencil { 0 setgray imagemask } { image } ifelse\n"
+ " grestore\n"
+ " sp { showpage } if\n"
+ "} bind def\n";
char
buffer[MagickPathExtent],
const char
*option,
- *const *q,
*value;
double
/*
The static postscript procedures prolog.
*/
- (void)WriteBlobString(image,"%%BeginProlog\n");
- for (q=PostscriptProlog; *q; q++)
- {
- (void) WriteBlobString(image,*q);
- (void) WriteBlobByte(image,'\n');
- }
+ (void) WriteBlobString(image,"%%BeginProlog\n");
+ (void) WriteBlob(image,sizeof(PostscriptProlog)-1,PostscriptProlog);
/*
One label line for each line in label string.
*/
value=GetImageProperty(image,"label",exception);
if (value != (const char *) NULL)
{
- (void) WriteBlobString(image,"\n %% Labels.\n /Helvetica "
+ (void) WriteBlobString(image,"\n %% Labels.\n /Helvetica "
" findfont pointsize scalefont setfont\n");
for (i=(ssize_t) MultilineCensus(value)-1; i >= 0; i--)
{
/*
The static postscript procedures epilog.
*/
- for (q=PostscriptEpilog; *q; q++)
- {
- (void) WriteBlobString(image,*q);
- (void) WriteBlobByte(image,'\n');
- }
- (void)WriteBlobString(image,"%%EndProlog\n");
+ (void) WriteBlob(image,sizeof(PostscriptEpilog)-1,PostscriptEpilog);
+ (void) WriteBlobString(image,"%%EndProlog\n");
}
(void) FormatLocaleString(buffer,MagickPathExtent,"%%%%Page: 1 %.20g\n",
(double) page);