2 * PostScript output functions
4 * Copyright 1998 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
34 static char psheader[] = /* title llx lly urx ury orientation */
36 "%%%%Creator: Wine PostScript Driver\n"
38 "%%%%BoundingBox: %d %d %d %d\n"
39 "%%%%Pages: (atend)\n"
40 "%%%%Orientation: %s\n"
43 static char psbeginprolog[] =
46 static char psendprolog[] =
49 static char psprolog[] =
50 "/tmpmtrx matrix def\n"
53 " /b exch def /r exch def /t exch def /l exch def /gap 32 def\n"
54 " l cvi gap idiv gap mul\n"
56 " r cvi gap idiv gap mul\n"
57 " {t moveto 0 b t sub rlineto}\n"
60 "/B {pop pop pop pop} def\n";
62 static char psbeginsetup[] =
65 static char psendsetup[] =
68 static char psbeginfeature[] = /* feature, value */
70 "%%%%BeginFeature: %s %s\n";
72 static char psendfeature[] =
74 "} stopped cleartomark\n";
76 static char psnewpage[] = /* name, number, xres, yres, xtrans, ytrans, rot */
78 "%%%%BeginPageSetup\n"
80 "72 %d div 72 %d div scale\n"
86 static char psendpage[] =
90 static char psfooter[] = /* pages */
95 static char psmoveto[] = /* x, y */
98 static char pslineto[] = /* x, y */
101 static char psstroke[] =
104 static char psrectangle[] = /* x, y, width, height, -width */
111 static char psrrectangle[] = /* x, y, width, height, -width */
118 static const char psglyphshow[] = /* glyph name */
121 static char pssetfont[] = /* fontname, xscale, yscale, ascent, escapement */
124 "%d 10 div matrix rotate\n"
125 "matrix concatmatrix\n"
126 "makefont setfont\n";
128 static char pssetlinewidth[] = /* width */
131 static char pssetdash[] = /* dash, offset */
134 static char pssetgray[] = /* gray */
137 static char pssetrgbcolor[] = /* r, g, b */
138 "%.2f %.2f %.2f setrgbcolor\n";
140 static char psarc[] = /* x, y, w, h, ang1, ang2 */
141 "tmpmtrx currentmatrix pop\n"
144 "0 0 0.5 %.1f %.1f arc\n"
145 "tmpmtrx setmatrix\n";
147 static char psgsave[] =
150 static char psgrestore[] =
153 static char psfill[] =
156 static char pseofill[] =
159 static char psnewpath[] =
162 static char psclosepath[] =
165 static char psclip[] =
168 static char psinitclip[] =
171 static char pseoclip[] =
174 static char psrectclip[] =
175 "%d %d %d %d rectclip\n";
177 static char psrectclip2[] =
180 static char pshatch[] =
183 static char psrotate[] = /* ang */
186 static char psarrayget[] =
189 static char psarrayput[] =
192 static char psarraydef[] =
193 "/%s %d array def\n";
196 int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch)
198 if(physDev->job.quiet) {
199 TRACE("ignoring output\n");
203 if(physDev->job.OutOfPage) { /* Will get here after NEWFRAME Escape */
204 if( !PSDRV_StartPage(physDev) )
207 return WriteSpool16( physDev->job.hJob, lpData, cch );
211 INT PSDRV_WriteFeature(HANDLE16 hJob, char *feature, char *value,
215 char *buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psbeginfeature) +
216 strlen(feature) + strlen(value));
219 sprintf(buf, psbeginfeature, feature, value);
220 WriteSpool16( hJob, buf, strlen(buf) );
222 WriteSpool16( hJob, invocation, strlen(invocation) );
224 WriteSpool16( hJob, psendfeature, strlen(psendfeature) );
226 HeapFree( PSDRV_Heap, 0, buf );
232 INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title )
237 int llx, lly, urx, ury;
239 TRACE("'%s'\n", title);
241 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) +
242 strlen(title) + 30 );
244 WARN("HeapAlloc failed\n");
248 /* BBox co-ords are in default user co-ord system so urx < ury even in
250 llx = physDev->ImageableArea.left * 72.0 / physDev->logPixelsX;
251 lly = physDev->ImageableArea.bottom * 72.0 / physDev->logPixelsY;
252 urx = physDev->ImageableArea.right * 72.0 / physDev->logPixelsX;
253 ury = physDev->ImageableArea.top * 72.0 / physDev->logPixelsY;
255 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
256 orient = "Landscape";
261 /* FIXME should do something better with BBox */
263 sprintf(buf, psheader, title, llx, lly, urx, ury, orient);
265 if( WriteSpool16( physDev->job.hJob, buf, strlen(buf) ) !=
267 WARN("WriteSpool error\n");
268 HeapFree( PSDRV_Heap, 0, buf );
271 HeapFree( PSDRV_Heap, 0, buf );
273 WriteSpool16( physDev->job.hJob, psbeginprolog, strlen(psbeginprolog) );
274 WriteSpool16( physDev->job.hJob, psprolog, strlen(psprolog) );
275 WriteSpool16( physDev->job.hJob, psendprolog, strlen(psendprolog) );
277 WriteSpool16( physDev->job.hJob, psbeginsetup, strlen(psbeginsetup) );
279 for(slot = physDev->pi->ppd->InputSlots; slot; slot = slot->next) {
280 if(slot->WinBin == physDev->Devmode->dmPublic.dmDefaultSource) {
281 if(slot->InvocationString) {
282 PSDRV_WriteFeature(physDev->job.hJob, "*InputSlot", slot->Name,
283 slot->InvocationString);
289 for(page = physDev->pi->ppd->PageSizes; page; page = page->next) {
290 if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize) {
291 if(page->InvocationString) {
292 PSDRV_WriteFeature(physDev->job.hJob, "*PageSize", page->Name,
293 page->InvocationString);
299 WriteSpool16( physDev->job.hJob, psendsetup, strlen(psendsetup) );
306 INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev )
310 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psfooter) + 100 );
312 WARN("HeapAlloc failed\n");
316 sprintf(buf, psfooter, physDev->job.PageNo);
318 if( WriteSpool16( physDev->job.hJob, buf, strlen(buf) ) !=
320 WARN("WriteSpool error\n");
321 HeapFree( PSDRV_Heap, 0, buf );
324 HeapFree( PSDRV_Heap, 0, buf );
330 INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev )
332 if( WriteSpool16( physDev->job.hJob, psendpage, sizeof(psendpage)-1 ) !=
333 sizeof(psendpage)-1 ) {
334 WARN("WriteSpool error\n");
343 INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev )
347 signed int xtrans, ytrans, rotation;
349 sprintf(name, "%d", physDev->job.PageNo);
351 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psnewpage) + 200 );
353 WARN("HeapAlloc failed\n");
357 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
358 if(physDev->pi->ppd->LandscapeOrientation == -90) {
359 xtrans = physDev->ImageableArea.right;
360 ytrans = physDev->ImageableArea.top;
363 xtrans = physDev->ImageableArea.left;
364 ytrans = physDev->ImageableArea.bottom;
368 xtrans = physDev->ImageableArea.left;
369 ytrans = physDev->ImageableArea.top;
373 sprintf(buf, psnewpage, name, physDev->job.PageNo,
374 physDev->logPixelsX, physDev->logPixelsY,
375 xtrans, ytrans, rotation);
377 if( WriteSpool16( physDev->job.hJob, buf, strlen(buf) ) !=
379 WARN("WriteSpool error\n");
380 HeapFree( PSDRV_Heap, 0, buf );
383 HeapFree( PSDRV_Heap, 0, buf );
388 BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y)
392 sprintf(buf, psmoveto, x, y);
393 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
396 BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y)
400 sprintf(buf, pslineto, x, y);
401 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
405 BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev)
407 return PSDRV_WriteSpool(physDev, psstroke, sizeof(psstroke)-1);
412 BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
417 sprintf(buf, psrectangle, x, y, width, height, -width);
418 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
421 BOOL PSDRV_WriteRRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
426 sprintf(buf, psrrectangle, x, y, width, height, -width);
427 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
430 BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h, double ang1,
435 /* Make angles -ve and swap order because we're working with an upside
437 sprintf(buf, psarc, x, y, w, h, -ang2, -ang1);
438 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
442 BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev, const char *name, INT size, INT escapement)
446 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(pssetfont) +
450 WARN("HeapAlloc failed\n");
454 sprintf(buf, pssetfont, name, size, -size, -escapement);
456 PSDRV_WriteSpool(physDev, buf, strlen(buf));
457 HeapFree(PSDRV_Heap, 0, buf);
461 BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color)
465 PSDRV_CopyColor(&physDev->inkColor, color);
466 switch(color->type) {
468 sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
470 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
473 sprintf(buf, pssetgray, color->value.gray.i);
474 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
477 ERR("Unkonwn colour type %d\n", color->type);
484 BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev)
488 sprintf(buf, pssetlinewidth, physDev->pen.width);
489 PSDRV_WriteSpool(physDev, buf, strlen(buf));
491 if(physDev->pen.dash) {
492 sprintf(buf, pssetdash, physDev->pen.dash, 0);
493 PSDRV_WriteSpool(physDev, buf, strlen(buf));
499 BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCSTR g_name)
504 l = snprintf(buf, sizeof(buf), psglyphshow, g_name);
506 if (l < sizeof(psglyphshow) - 2 || l > sizeof(buf) - 1) {
507 WARN("Unusable glyph name '%s' - ignoring\n", g_name);
511 PSDRV_WriteSpool(physDev, buf, l);
515 BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev)
517 return PSDRV_WriteSpool(physDev, psfill, sizeof(psfill)-1);
520 BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev)
522 return PSDRV_WriteSpool(physDev, pseofill, sizeof(pseofill)-1);
525 BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev)
527 return PSDRV_WriteSpool(physDev, psgsave, sizeof(psgsave)-1);
530 BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev)
532 return PSDRV_WriteSpool(physDev, psgrestore, sizeof(psgrestore)-1);
535 BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev)
537 return PSDRV_WriteSpool(physDev, psnewpath, sizeof(psnewpath)-1);
540 BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev)
542 return PSDRV_WriteSpool(physDev, psclosepath, sizeof(psclosepath)-1);
545 BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev)
547 return PSDRV_WriteSpool(physDev, psclip, sizeof(psclip)-1);
550 BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev)
552 return PSDRV_WriteSpool(physDev, pseoclip, sizeof(pseoclip)-1);
555 BOOL PSDRV_WriteInitClip(PSDRV_PDEVICE *physDev)
557 return PSDRV_WriteSpool(physDev, psinitclip, sizeof(psinitclip)-1);
560 BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev)
562 return PSDRV_WriteSpool(physDev, pshatch, sizeof(pshatch)-1);
565 BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang)
569 sprintf(buf, psrotate, ang);
570 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
573 BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size)
576 sprintf(buf, "[/Indexed /DeviceRGB %d\n<\n", size);
577 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
580 BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev)
582 char buf[] = ">\n] setcolorspace\n";
583 return PSDRV_WriteSpool(physDev, buf, sizeof(buf) - 1);
586 BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number)
588 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1), *ptr;
592 for(i = 0; i < number; i++) {
593 sprintf(ptr, "%02x%02x%02x%c", (int)GetRValue(map[i]),
594 (int)GetGValue(map[i]), (int)GetBValue(map[i]),
595 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
598 PSDRV_WriteSpool(physDev, buf, number * 7);
599 HeapFree(PSDRV_Heap, 0, buf);
604 BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
605 INT widthDst, INT heightDst, INT widthSrc,
606 INT heightSrc, char *bits, BOOL mask)
608 char start[] = "%d %d translate\n%d %d scale\n<<\n"
609 " /ImageType 1\n /Width %d\n /Height %d\n /BitsPerComponent %d\n"
610 " /ImageMatrix [%d 0 0 %d 0 %d]\n";
612 char decode1[] = " /Decode [0 %d]\n";
613 char decode3[] = " /Decode [0 1 0 1 0 1]\n";
615 char end[] = " /DataSource currentfile /ASCIIHexDecode filter\n>> image\n";
616 char endmask[] = " /DataSource currentfile /ASCIIHexDecode filter\n>> imagemask\n";
618 char endbits[] = " /DataSource <%s>\n>> image\n";
620 char *buf = HeapAlloc(PSDRV_Heap, 0, 1000);
622 sprintf(buf, start, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc,
623 (depth < 8) ? depth : 8, widthSrc, -heightSrc, heightSrc);
625 PSDRV_WriteSpool(physDev, buf, strlen(buf));
629 sprintf(buf, decode1, 255);
633 sprintf(buf, decode1, 15);
637 sprintf(buf, decode1, 1);
641 strcpy(buf, decode3);
645 PSDRV_WriteSpool(physDev, buf, strlen(buf));
649 PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
651 PSDRV_WriteSpool(physDev, endmask, sizeof(endmask) - 1);
653 sprintf(buf, endbits, bits);
654 PSDRV_WriteSpool(physDev, buf, strlen(buf));
657 HeapFree(PSDRV_Heap, 0, buf);
662 BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number)
664 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 3 + 1);
670 for(i = 0; i < number; i++) {
671 sprintf(ptr, "%02x%c", bytes[i],
672 ((i & 0xf) == 0xf) || (i == number - 1) ? '\n' : ' ');
675 PSDRV_WriteSpool(physDev, buf, number * 3);
677 HeapFree(PSDRV_Heap, 0, buf);
681 BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number)
683 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
689 for(i = 0; i < number; i++) {
692 /* We want 0x0 -- 0x1f to map to 0x0 -- 0xff */
694 r = words[i] >> 10 & 0x1f;
696 g = words[i] >> 5 & 0x1f;
700 sprintf(ptr, "%02x%02x%02x%c", r, g, b,
701 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
704 PSDRV_WriteSpool(physDev, buf, number * 7);
706 HeapFree(PSDRV_Heap, 0, buf);
710 BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number)
712 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
718 for(i = 0; i < number; i++) {
719 sprintf(ptr, "%02x%02x%02x%c", bits[i * 3 + 2], bits[i * 3 + 1],
721 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
724 PSDRV_WriteSpool(physDev, buf, number * 7);
726 HeapFree(PSDRV_Heap, 0, buf);
730 BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number)
732 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
738 for(i = 0; i < number; i++) {
739 sprintf(ptr, "%02x%02x%02x%c", bits[i * 4 + 2], bits[i * 4 + 1],
741 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
744 PSDRV_WriteSpool(physDev, buf, number * 7);
746 HeapFree(PSDRV_Heap, 0, buf);
750 BOOL PSDRV_WriteArrayGet(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex)
754 sprintf(buf, psarrayget, pszArrayName, nIndex);
755 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
758 BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lObject)
762 sprintf(buf, psarrayput, pszArrayName, nIndex, lObject);
763 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
766 BOOL PSDRV_WriteArrayDef(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nSize)
770 sprintf(buf, psarraydef, pszArrayName, nSize);
771 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
774 BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h)
778 sprintf(buf, psrectclip, x, y, w, h);
779 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
782 BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName)
786 sprintf(buf, psrectclip2, pszArrayName);
787 return PSDRV_WriteSpool(physDev, buf, strlen(buf));
790 BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits)
792 char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
793 "/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n";
795 char end[] = " end\n }\n>>\n matrix makepattern setpattern\n";
800 w = bm->bmWidth & ~0x7;
801 h = bm->bmHeight & ~0x7;
803 buf = HeapAlloc(PSDRV_Heap, 0, sizeof(start) + 100);
804 sprintf(buf, start, w, h, w, h);
805 PSDRV_WriteSpool(physDev, buf, strlen(buf));
806 PSDRV_WriteIndexColorSpaceBegin(physDev, 1);
807 map[0] = GetTextColor( physDev->hdc );
808 map[1] = GetBkColor( physDev->hdc );
809 PSDRV_WriteRGB(physDev, map, 2);
810 PSDRV_WriteIndexColorSpaceEnd(physDev);
812 for(y = h-1; y >= 0; y--) {
813 for(x = 0; x < w/8; x++) {
814 sprintf(ptr, "%02x", *(bits + x/8 + y * bm->bmWidthBytes));
818 PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf, FALSE);
819 PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
820 HeapFree(PSDRV_Heap, 0, buf);
824 BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage)
826 char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
827 "/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n";
829 char end[] = " end\n }\n>>\n matrix makepattern setpattern\n";
832 INT w, h, x, y, colours;
835 if(bmi->bmiHeader.biBitCount != 1) {
836 FIXME("dib depth %d not supported\n", bmi->bmiHeader.biBitCount);
840 bits = (char*)bmi + bmi->bmiHeader.biSize;
841 colours = bmi->bmiHeader.biClrUsed;
842 if(!colours && bmi->bmiHeader.biBitCount <= 8)
843 colours = 1 << bmi->bmiHeader.biBitCount;
844 bits += colours * ((usage == DIB_RGB_COLORS) ?
845 sizeof(RGBQUAD) : sizeof(WORD));
847 w = bmi->bmiHeader.biWidth & ~0x7;
848 h = bmi->bmiHeader.biHeight & ~0x7;
850 buf = HeapAlloc(PSDRV_Heap, 0, sizeof(start) + 100);
851 sprintf(buf, start, w, h, w, h);
852 PSDRV_WriteSpool(physDev, buf, strlen(buf));
853 PSDRV_WriteIndexColorSpaceBegin(physDev, 1);
854 map[0] = physDev->dc->textColor;
855 map[1] = physDev->dc->backgroundColor;
856 PSDRV_WriteRGB(physDev, map, 2);
857 PSDRV_WriteIndexColorSpaceEnd(physDev);
859 for(y = h-1; y >= 0; y--) {
860 for(x = 0; x < w/8; x++) {
861 sprintf(ptr, "%02x", *(bits + x/8 + y *
862 (bmi->bmiHeader.biWidth + 31) / 32 * 4));
866 PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf, FALSE);
867 PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
868 HeapFree(PSDRV_Heap, 0, buf);