2 * PostScript output functions
4 * Copyright 1998 Huw D M Davies
14 DEFAULT_DEBUG_CHANNEL(psdrv)
16 static char psheader[] = /* title llx lly urx ury orientation */
18 "%%%%Creator: Wine PostScript Driver\n"
20 "%%%%BoundingBox: %d %d %d %d\n"
21 "%%%%Pages: (atend)\n"
22 "%%%%Orientation: %s\n"
25 static char psbeginprolog[] =
28 static char psendprolog[] =
31 static char psvectorstart[] =
34 static char psvectorend[] =
37 static char psprolog[] = /* output ANSIEncoding vector first */
40 " dup length dict begin\n"
41 " {1 index /FID ne {def} {pop pop} ifelse} forall\n"
42 " /Encoding ANSIEncoding def\n"
47 "/tmpmtrx matrix def\n"
50 " /b exch def /r exch def /t exch def /l exch def /gap 32 def\n"
51 " l cvi gap idiv gap mul\n"
53 " r cvi gap idiv gap mul\n"
54 " {t moveto 0 b t sub rlineto}\n"
58 static char psbeginsetup[] =
61 static char psendsetup[] =
64 static char psbeginfeature[] = /* feature, value */
66 "%%%%BeginFeature: %s %s\n";
68 static char psendfeature[] =
70 "} stopped cleartomark\n";
72 static char psnewpage[] = /* name, number, xres, yres, xtrans, ytrans, rot */
74 "%%%%BeginPageSetup\n"
76 "72 %d div 72 %d div scale\n"
82 static char psendpage[] =
86 static char psfooter[] = /* pages */
91 static char psmoveto[] = /* x, y */
94 static char pslineto[] = /* x, y */
97 static char psstroke[] =
100 static char psrectangle[] = /* x, y, width, height, -width */
107 static char psshow[] = /* string */
110 static char pssetfont[] = /* fontname, xscale, yscale, ascent, escapement */
113 "%d 10 div matrix rotate\n"
114 "matrix concatmatrix\n"
115 "makefont setfont\n";
117 static char pssetlinewidth[] = /* width */
120 static char pssetdash[] = /* dash, offset */
123 static char pssetgray[] = /* gray */
126 static char pssetrgbcolor[] = /* r, g, b */
127 "%.2f %.2f %.2f setrgbcolor\n";
129 static char psarc[] = /* x, y, w, h, ang1, ang2 */
130 "tmpmtrx currentmatrix pop\n"
133 "0 0 0.5 %.1f %.1f arc\n"
134 "tmpmtrx setmatrix\n";
136 static char psgsave[] =
139 static char psgrestore[] =
142 static char psfill[] =
145 static char pseofill[] =
148 static char psclosepath[] =
151 static char psclip[] =
154 static char pseoclip[] =
157 static char pshatch[] =
160 static char psrotate[] = /* ang */
163 char *PSDRV_ANSIVector[256] = {
164 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x00 */
165 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
166 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x10 */
167 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
168 "space", "exclam", "quotedbl", "numbersign", /* 0x20 */
169 "dollar", "percent", "ampersand", "quotesingle",
170 "parenleft", "parenright", "asterisk", "plus",
171 "comma", "hyphen", "period", "slash",
172 "zero", "one", "two", "three", /* 0x30 */
173 "four", "five", "six", "seven",
174 "eight", "nine", "colon", "semicolon",
175 "less", "equal", "greater", "question",
176 "at", "A", "B", "C", /* 0x40 */
180 "P", "Q", "R", "S", /* 0x50 */
182 "X", "Y", "Z", "bracketleft",
183 "backslash", "bracketright", "asciicircum", "underscore",
184 "grave", "a", "b", "c", /* 0x60 */
188 "p", "q", "r", "s", /* 0x70 */
190 "x", "y", "z", "braceleft",
191 "bar", "braceright", "asciitilde", NULL,
192 NULL, NULL, NULL, NULL, /* 0x80 */
193 NULL, NULL, NULL, NULL,
194 NULL, NULL, NULL, NULL,
195 NULL, NULL, NULL, NULL,
196 NULL, "quoteleft", "quoteright", "quotedblleft", /* 0x90 */
197 "quotedblright","bullet", "endash", "emdash",
198 NULL, NULL, NULL, NULL,
199 NULL, NULL, NULL, NULL,
200 "space", "exclamdown", "cent", "sterling", /* 0xa0 */
201 "currency", "yen", "brokenbar", "section",
202 "dieresis", "copyright", "ordfeminine", "guillemotleft",
203 "logicalnot", "hyphen", "registered", "macron",
204 "degree", "plusminus", "twosuperior", "threesuperior", /* 0xb0 */
205 "acute", "mu", "paragraph", "periodcentered",
206 "cedilla", "onesuperior", "ordmasculine", "guillemotright",
207 "onequarter", "onehalf", "threequarters","questiondown",
208 "Agrave", "Aacute", "Acircumflex", "Atilde", /* 0xc0 */
209 "Adieresis", "Aring", "AE", "Ccedilla",
210 "Egrave", "Eacute", "Ecircumflex", "Edieresis",
211 "Igrave", "Iacute", "Icircumflex", "Idieresis",
212 "Eth", "Ntilde", "Ograve", "Oacute", /* 0xd0 */
213 "Ocircumflex", "Otilde", "Odieresis", "multiply",
214 "Oslash", "Ugrave", "Uacute", "Ucircumflex",
215 "Udieresis", "Yacute", "Thorn", "germandbls",
216 "agrave", "aacute", "acircumflex", "atilde", /* 0xe0 */
217 "adieresis", "aring", "ae", "ccedilla",
218 "egrave", "eacute", "ecircumflex", "edieresis",
219 "igrave", "iacute", "icircumflex", "idieresis",
220 "eth", "ntilde", "ograve", "oacute", /* 0xf0 */
221 "ocircumflex", "otilde", "odieresis", "divide",
222 "oslash", "ugrave", "uacute", "ucircumflex",
223 "udieresis", "yacute", "thorn", "ydieresis"
227 char psreencodefont[] = /* newfontname basefontname*/
228 "/%s /%s reencodefont\n";
231 int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch)
233 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
235 if(physDev->job.NeedPageHeader) {
236 physDev->job.PageNo++;
237 if( !PSDRV_WriteNewPage(dc) )
239 physDev->job.NeedPageHeader = FALSE;
241 return WriteSpool16( physDev->job.hJob, lpData, cch );
245 INT PSDRV_WriteFeature(HANDLE16 hJob, char *feature, char *value,
249 char *buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) +
250 strlen(feature) + strlen(value));
253 sprintf(buf, psbeginfeature, feature, value);
254 WriteSpool16( hJob, buf, strlen(buf) );
256 WriteSpool16( hJob, invocation, strlen(invocation) );
258 WriteSpool16( hJob, psendfeature, strlen(psendfeature) );
260 HeapFree( PSDRV_Heap, 0, buf );
266 INT PSDRV_WriteHeader( DC *dc, char *title, int len )
268 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
269 char *buf, *titlebuf, *orient, vectbuf[256];
274 titlebuf = (char *)HeapAlloc( PSDRV_Heap, 0, len+1 );
276 WARN(psdrv, "HeapAlloc failed\n");
279 memcpy(titlebuf, title, len);
280 titlebuf[len] = '\0';
282 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) + len + 30);
284 WARN(psdrv, "HeapAlloc failed\n");
285 HeapFree( PSDRV_Heap, 0, titlebuf );
289 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
290 /* BBox co-ords are in default user co-ord system so urx < ury even in
292 urx = (int) (dc->w.devCaps->vertSize * 72.0 / 25.4);
293 ury = (int) (dc->w.devCaps->horzSize * 72.0 / 25.4);
294 orient = "Landscape";
296 urx = (int) (dc->w.devCaps->horzSize * 72.0 / 25.4);
297 ury = (int) (dc->w.devCaps->vertSize * 72.0 / 25.4);
301 /* FIXME should do something better with BBox */
303 sprintf(buf, psheader, title, 0, 0, urx, ury, orient);
305 if( WriteSpool16( physDev->job.hJob, buf, strlen(buf) ) !=
307 WARN(psdrv, "WriteSpool error\n");
308 HeapFree( PSDRV_Heap, 0, titlebuf );
309 HeapFree( PSDRV_Heap, 0, buf );
312 HeapFree( PSDRV_Heap, 0, titlebuf );
313 HeapFree( PSDRV_Heap, 0, buf );
315 WriteSpool16( physDev->job.hJob, psbeginprolog, strlen(psbeginprolog) );
316 WriteSpool16( physDev->job.hJob, psvectorstart, strlen(psvectorstart) );
318 for(i = 0; i < 256; i += 8) {
320 for(j = 0; j < 8; j++) {
321 strcat(vectbuf, "/");
322 if(PSDRV_ANSIVector[i+j]) {
323 strcat(vectbuf, PSDRV_ANSIVector[i+j]);
324 strcat(vectbuf, " ");
326 strcat(vectbuf, ".notdef ");
329 strcat(vectbuf, "\n");
330 WriteSpool16( physDev->job.hJob, vectbuf, strlen(vectbuf) );
333 WriteSpool16( physDev->job.hJob, psvectorend, strlen(psvectorend) );
334 WriteSpool16( physDev->job.hJob, psprolog, strlen(psprolog) );
335 WriteSpool16( physDev->job.hJob, psendprolog, strlen(psendprolog) );
338 WriteSpool16( physDev->job.hJob, psbeginsetup, strlen(psbeginsetup) );
340 for(slot = physDev->pi->ppd->InputSlots; slot; slot = slot->next) {
341 if(slot->WinBin == physDev->Devmode->dmPublic.dmDefaultSource) {
342 if(slot->InvocationString) {
343 PSDRV_WriteFeature(physDev->job.hJob, "*InputSlot", slot->Name,
344 slot->InvocationString);
350 for(page = physDev->pi->ppd->PageSizes; page; page = page->next) {
351 if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize) {
352 if(page->InvocationString) {
353 PSDRV_WriteFeature(physDev->job.hJob, "*PageSize", page->Name,
354 page->InvocationString);
360 WriteSpool16( physDev->job.hJob, psendsetup, strlen(psendsetup) );
367 INT PSDRV_WriteFooter( DC *dc )
369 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
372 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psfooter) + 100 );
374 WARN(psdrv, "HeapAlloc failed\n");
378 sprintf(buf, psfooter, physDev->job.PageNo);
380 if( WriteSpool16( physDev->job.hJob, buf, strlen(buf) ) !=
382 WARN(psdrv, "WriteSpool error\n");
383 HeapFree( PSDRV_Heap, 0, buf );
386 HeapFree( PSDRV_Heap, 0, buf );
392 INT PSDRV_WriteEndPage( DC *dc )
394 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
396 if( WriteSpool16( physDev->job.hJob, psendpage, sizeof(psendpage)-1 ) !=
397 sizeof(psendpage)-1 ) {
398 WARN(psdrv, "WriteSpool error\n");
407 INT PSDRV_WriteNewPage( DC *dc )
409 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
412 signed int xtrans, ytrans, rotation;
414 sprintf(name, "%d", physDev->job.PageNo);
416 buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psnewpage) + 200 );
418 WARN(psdrv, "HeapAlloc failed\n");
422 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
423 if(physDev->pi->ppd->LandscapeOrientation == -90) {
424 xtrans = dc->w.devCaps->vertRes;
425 ytrans = dc->w.devCaps->horzRes;
433 ytrans = dc->w.devCaps->vertRes;
437 sprintf(buf, psnewpage, name, physDev->job.PageNo,
438 dc->w.devCaps->logPixelsX, dc->w.devCaps->logPixelsY,
439 xtrans, ytrans, rotation);
441 if( WriteSpool16( physDev->job.hJob, buf, strlen(buf) ) !=
443 WARN(psdrv, "WriteSpool error\n");
444 HeapFree( PSDRV_Heap, 0, buf );
447 HeapFree( PSDRV_Heap, 0, buf );
452 BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y)
456 sprintf(buf, psmoveto, x, y);
457 return PSDRV_WriteSpool(dc, buf, strlen(buf));
460 BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y)
464 sprintf(buf, pslineto, x, y);
465 return PSDRV_WriteSpool(dc, buf, strlen(buf));
469 BOOL PSDRV_WriteStroke(DC *dc)
471 return PSDRV_WriteSpool(dc, psstroke, sizeof(psstroke)-1);
476 BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width,
481 sprintf(buf, psrectangle, x, y, width, height, -width);
482 return PSDRV_WriteSpool(dc, buf, strlen(buf));
485 BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h, double ang1,
490 /* Make angles -ve and swap order because we're working with an upside
492 sprintf(buf, psarc, x, y, w, h, -ang2, -ang1);
493 return PSDRV_WriteSpool(dc, buf, strlen(buf));
496 static char encodingext[] = "-ANSI";
498 BOOL PSDRV_WriteSetFont(DC *dc, BOOL UseANSI)
500 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
503 buf = (char *)HeapAlloc( PSDRV_Heap, 0,
504 sizeof(pssetfont) + strlen(physDev->font.afm->FontName) + 40);
507 WARN(psdrv, "HeapAlloc failed\n");
511 newbuf = (char *)HeapAlloc( PSDRV_Heap, 0,
512 strlen(physDev->font.afm->FontName) + sizeof(encodingext));
515 WARN(psdrv, "HeapAlloc failed\n");
516 HeapFree(PSDRV_Heap, 0, buf);
521 sprintf(newbuf, "%s%s", physDev->font.afm->FontName, encodingext);
523 strcpy(newbuf, physDev->font.afm->FontName);
525 sprintf(buf, pssetfont, newbuf,
526 physDev->font.size, -physDev->font.size,
527 -physDev->font.escapement);
529 PSDRV_WriteSpool(dc, buf, strlen(buf));
530 HeapFree(PSDRV_Heap, 0, buf);
534 BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color)
536 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
539 if(PSDRV_CmpColor(&physDev->inkColor, color))
542 PSDRV_CopyColor(&physDev->inkColor, color);
543 switch(color->type) {
545 sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
547 return PSDRV_WriteSpool(dc, buf, strlen(buf));
550 sprintf(buf, pssetgray, color->value.gray.i);
551 return PSDRV_WriteSpool(dc, buf, strlen(buf));
554 ERR(psdrv, "Unkonwn colour type %d\n", color->type);
561 BOOL PSDRV_WriteSetPen(DC *dc)
563 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
566 sprintf(buf, pssetlinewidth, physDev->pen.width);
567 PSDRV_WriteSpool(dc, buf, strlen(buf));
569 if(physDev->pen.dash) {
570 sprintf(buf, pssetdash, physDev->pen.dash, 0);
571 PSDRV_WriteSpool(dc, buf, strlen(buf));
577 BOOL PSDRV_WriteReencodeFont(DC *dc)
579 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
582 buf = (char *)HeapAlloc( PSDRV_Heap, 0,
583 sizeof(psreencodefont) + 2 * strlen(physDev->font.afm->FontName)
584 + sizeof(encodingext));
587 WARN(psdrv, "HeapAlloc failed\n");
591 newbuf = (char *)HeapAlloc( PSDRV_Heap, 0,
592 strlen(physDev->font.afm->FontName) + sizeof(encodingext));
595 WARN(psdrv, "HeapAlloc failed\n");
596 HeapFree(PSDRV_Heap, 0, buf);
600 sprintf(newbuf, "%s%s", physDev->font.afm->FontName, encodingext);
601 sprintf(buf, psreencodefont, newbuf, physDev->font.afm->FontName);
603 PSDRV_WriteSpool(dc, buf, strlen(buf));
605 HeapFree(PSDRV_Heap, 0, newbuf);
606 HeapFree(PSDRV_Heap, 0, buf);
610 BOOL PSDRV_WriteShow(DC *dc, char *str, INT count)
613 INT buflen = count + 10, i, done;
615 buf = (char *)HeapAlloc( PSDRV_Heap, 0, buflen );
617 for(i = done = 0; i < count; i++) {
618 if(!isprint(str[i])) {
619 if(done + 4 >= buflen)
620 buf = HeapReAlloc( PSDRV_Heap, 0, buf, buflen += 10 );
621 sprintf(buf + done, "\\%03o", (int)(unsigned char)str[i] );
623 } else if(str[i] == '\\' || str[i] == '(' || str[i] == ')' ) {
624 if(done + 2 >= buflen)
625 buf = HeapReAlloc( PSDRV_Heap, 0, buf, buflen += 10 );
627 buf[done++] = str[i];
629 if(done + 1 >= buflen)
630 buf = HeapReAlloc( PSDRV_Heap, 0, buf, buflen += 10 );
631 buf[done++] = str[i];
636 buf1 = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psshow) + done);
638 sprintf(buf1, psshow, buf);
640 PSDRV_WriteSpool(dc, buf1, strlen(buf1));
641 HeapFree(PSDRV_Heap, 0, buf);
642 HeapFree(PSDRV_Heap, 0, buf1);
647 BOOL PSDRV_WriteFill(DC *dc)
649 return PSDRV_WriteSpool(dc, psfill, sizeof(psfill)-1);
652 BOOL PSDRV_WriteEOFill(DC *dc)
654 return PSDRV_WriteSpool(dc, pseofill, sizeof(pseofill)-1);
657 BOOL PSDRV_WriteGSave(DC *dc)
659 return PSDRV_WriteSpool(dc, psgsave, sizeof(psgsave)-1);
662 BOOL PSDRV_WriteGRestore(DC *dc)
664 return PSDRV_WriteSpool(dc, psgrestore, sizeof(psgrestore)-1);
667 BOOL PSDRV_WriteClosePath(DC *dc)
669 return PSDRV_WriteSpool(dc, psclosepath, sizeof(psclosepath)-1);
672 BOOL PSDRV_WriteClip(DC *dc)
674 return PSDRV_WriteSpool(dc, psclip, sizeof(psclip)-1);
677 BOOL PSDRV_WriteEOClip(DC *dc)
679 return PSDRV_WriteSpool(dc, pseoclip, sizeof(pseoclip)-1);
682 BOOL PSDRV_WriteHatch(DC *dc)
684 return PSDRV_WriteSpool(dc, pshatch, sizeof(pshatch)-1);
687 BOOL PSDRV_WriteRotate(DC *dc, float ang)
691 sprintf(buf, psrotate, ang);
692 return PSDRV_WriteSpool(dc, buf, strlen(buf));
695 BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size)
698 sprintf(buf, "[/Indexed /DeviceRGB %d\n<\n", size);
699 return PSDRV_WriteSpool(dc, buf, strlen(buf));
702 BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc)
704 char buf[] = ">\n] setcolorspace\n";
705 return PSDRV_WriteSpool(dc, buf, sizeof(buf) - 1);
708 BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number)
710 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1), *ptr;
714 for(i = 0; i < number; i++) {
715 sprintf(ptr, "%02x%02x%02x%c", (int)GetRValue(map[i]),
716 (int)GetGValue(map[i]), (int)GetBValue(map[i]),
717 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
720 PSDRV_WriteSpool(dc, buf, number * 7);
721 HeapFree(PSDRV_Heap, 0, buf);
726 BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
727 INT widthDst, INT heightDst, INT widthSrc,
730 char start[] = "%d %d translate\n%d %d scale\n<<\n"
731 " /ImageType 1\n /Width %d\n /Height %d\n /BitsPerComponent %d\n"
732 " /ImageMatrix [%d 0 0 %d 0 %d]\n";
734 char decode1[] = " /Decode [0 %d]\n";
735 char decode3[] = " /Decode [0 1 0 1 0 1]\n";
737 char end[] = " /DataSource currentfile /ASCIIHexDecode filter\n>> image\n";
739 char *buf = HeapAlloc(PSDRV_Heap, 0, 1000);
741 sprintf(buf, start, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc,
742 (depth < 8) ? depth : 8, widthSrc, -heightSrc, heightSrc);
744 PSDRV_WriteSpool(dc, buf, strlen(buf));
748 sprintf(buf, decode1, 255);
752 sprintf(buf, decode1, 15);
756 sprintf(buf, decode1, 1);
760 strcpy(buf, decode3);
764 PSDRV_WriteSpool(dc, buf, strlen(buf));
766 PSDRV_WriteSpool(dc, end, sizeof(end) - 1);
768 HeapFree(PSDRV_Heap, 0, buf);
772 BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number)
774 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 3 + 1);
780 for(i = 0; i < number; i++) {
781 sprintf(ptr, "%02x%c", bytes[i],
782 ((i & 0xf) == 0xf) || (i == number - 1) ? '\n' : ' ');
785 PSDRV_WriteSpool(dc, buf, number * 3);
787 HeapFree(PSDRV_Heap, 0, buf);
791 BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number)
793 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
799 for(i = 0; i < number; i++) {
802 /* We want 0x0 -- 0x1f to map to 0x0 -- 0xff */
804 r = words[i] >> 10 & 0x1f;
806 g = words[i] >> 5 & 0x1f;
810 sprintf(ptr, "%02x%02x%02x%c", r, g, b,
811 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
814 PSDRV_WriteSpool(dc, buf, number * 7);
816 HeapFree(PSDRV_Heap, 0, buf);
820 BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number)
822 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
828 for(i = 0; i < number; i++) {
829 sprintf(ptr, "%02x%02x%02x%c", bits[i * 3 + 2], bits[i * 3 + 1],
831 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
834 PSDRV_WriteSpool(dc, buf, number * 7);
836 HeapFree(PSDRV_Heap, 0, buf);
840 BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number)
842 char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
848 for(i = 0; i < number; i++) {
849 sprintf(ptr, "%02x%02x%02x%c", bits[i * 4 + 2], bits[i * 4 + 1],
851 ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
854 PSDRV_WriteSpool(dc, buf, number * 7);
856 HeapFree(PSDRV_Heap, 0, buf);