1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
13
/* $Id: gdevmacpictop.h 8022 2007-06-05 22:23:38Z giles $ */
15
/* Helpers for working with Classic MacOS Quickdraw pictures */
16
/* (obsoleted by the DISPLAY device) */
18
#ifndef gdevmacpictop_INCLUDED
19
# define gdevmacpictop_INCLUDED
21
#include <QDOffscreen.h>
24
/************************/
25
/* PICT data structures */
26
/************************/
28
/* write raw data to PICT file */
29
#define PICTWriteByte(ptr, data) *((unsigned char*) (ptr))++ = data;
30
#define PICTWriteInt(ptr, data) *((short*) (ptr))++ = data;
31
#define PICTWriteLong(ptr, data) *((long*) (ptr))++ = data;
33
#define PICTWriteFillByte(ptr) PICTWriteByte(ptr, 0);
35
/* write a PICT opcode */
36
#define PICTWriteOpcode(ptr, op) PICTWriteInt(ptr, op);
39
/*****************************/
40
/* QuickDraw data structures */
41
/*****************************/
43
/* write a Point structure */
44
#define PICTWritePoint(ptr, h, v) \
46
PICTWriteInt(ptr, v); /* vertical coordinate */ \
47
PICTWriteInt(ptr, h); /* horizontal coordinate */ \
50
/* write a Rect structure */
51
#define PICTWriteRect(ptr, x, y, w, h) \
53
PICTWritePoint(ptr, x, y); /* upper-left corner */ \
54
PICTWritePoint(ptr, x+w, y+h); /* lower-right corner */ \
57
/* write a rectangular Region structure */
58
#define PICTWriteRegionRectangular(ptr, x, y, w, h) \
60
PICTWriteInt(ptr, 10); /* rgnSize */ \
61
PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \
64
/* write a non-rectangular Region structure */
65
#define PICTWriteRegion(ptr, x, y, b, h, size, dataptr) \
67
PICTWriteInt(ptr, 10+size); /* rgnSize */ \
68
PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \
69
memcpy(ptr, dataptr, size); /* additional data */ \
70
((char*)(ptr)) += size; \
74
#define PICTWritePattern(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
76
PICTWriteByte(ptr, byte1); /* pattern */ \
77
PICTWriteByte(ptr, byte2); /* pattern */ \
78
PICTWriteByte(ptr, byte3); /* pattern */ \
79
PICTWriteByte(ptr, byte4); /* pattern */ \
80
PICTWriteByte(ptr, byte5); /* pattern */ \
81
PICTWriteByte(ptr, byte6); /* pattern */ \
82
PICTWriteByte(ptr, byte7); /* pattern */ \
83
PICTWriteByte(ptr, byte8); /* pattern */ \
86
/* write a RGBColor structure */
87
#define PICTWriteRGBColor(ptr, r, g, b) \
89
PICTWriteInt(ptr, r); /* red */ \
90
PICTWriteInt(ptr, g); /* green */ \
91
PICTWriteInt(ptr, b); /* blue */ \
94
/* write a ColorSpec structure */
95
#define PICTWriteColorSpec(ptr, value, r, g, b) \
97
PICTWriteInt(ptr, value); /* value */ \
98
PICTWriteRGBColor(ptr, r, g, b); /* color */ \
101
/* write a ColorTable structure */
102
#define PICTWriteColorTable(ptr, seed, numEntries, cspecarr) \
105
PICTWriteLong(ptr, seed); /* ctSeed */ \
106
PICTWriteInt(ptr, 0); /* ctFlags */ \
107
PICTWriteInt(ptr, numEntries-1); /* ctSize */ \
108
for (i=0; i<numEntries; i++) /* ctTable */ \
109
PICTWriteColorSpec(ptr, cspecarr[i].value, \
110
cspecarr[i].rgb.red, \
111
cspecarr[i].rgb.green, \
112
cspecarr[i].rgb.blue); \
115
/* write a PixMap structure */
116
#define PICTWritePixMap(ptr, x, y, w, h, rowBytes, \
117
packType, packSize, \
118
hRes, vRes, pixelSize) \
120
PICTWriteInt(ptr, 0x8000+rowBytes); /* rowBytes */ \
121
PICTWriteRect(ptr, x, y, w, h); /* bounds */ \
122
PICTWriteInt(ptr, 0); /* pmVersion */ \
123
PICTWriteInt(ptr, packType); /* packType */ \
124
PICTWriteLong(ptr, (packType ? packSize : 0)); /* packSize */ \
125
PICTWriteLong(ptr, hRes); /* hRes */ \
126
PICTWriteLong(ptr, vRes); /* vRes */ \
127
if (pixelSize < 16) { /* indexed */ \
128
PICTWriteInt(ptr, 0); /* pixelType */ \
129
PICTWriteInt(ptr, pixelSize); /* pixelSize */ \
130
PICTWriteInt(ptr, 1); /* cmpCount */ \
131
PICTWriteInt(ptr, pixelSize); /* cmpSize */ \
132
} else { /* direct */ \
133
PICTWriteInt(ptr, RGBDirect); /* pixelType */ \
134
PICTWriteInt(ptr, pixelSize); /* pixelSize */ \
135
PICTWriteInt(ptr, 3); /* cmpCount */ \
136
PICTWriteInt(ptr, (pixelSize==16 ? 5 : 8)); /* cmpSize */ \
138
PICTWriteLong(ptr, 0); /* planeBytes */ \
139
PICTWriteLong(ptr, 0); /* pmTable */ \
140
PICTWriteLong(ptr, 0); /* pmReserved */ \
143
/* write PackBits data */
144
#define PICTWriteDataPackBits(ptr, base, rowBytes, lines) \
147
if (raster < 8) { /* data uncompressed */ \
148
byteCount = rowBytes * lines; \
149
memcpy(ptr, base, byteCount); /* bitmap data */ \
150
(char*)(ptr) += byteCount; \
151
} else { /* raster >= 8 use PackBits compression */ \
152
Ptr destBufBegin = (Ptr) malloc(raster + (raster+126)/127), destBuf, \
153
srcBuf = (Ptr) base; \
157
for (i=0; i<lines; i++) { \
158
destBuf = destBufBegin; \
159
PackBits(&srcBuf, &destBuf, rowBytes); \
160
len = destBuf - destBufBegin; \
161
if (rowBytes > 250) { \
162
PICTWriteInt(ptr, len); \
165
PICTWriteByte(ptr, len); \
169
memcpy(ptr, destBufBegin, len); \
170
(char*)(ptr) += len; \
173
free(destBufBegin); \
177
PICTWriteFillByte(ptr); \
181
#define PICTWriteText(ptr, textptr /* pascal string*/) \
183
memcpy(ptr, textptr, textptr[0]+1); /* copy string */ \
184
(char*)(ptr) += textptr[0]+1; \
194
#define PICT_NOP(ptr) \
196
PICTWriteOpcode(ptr, 0x0000); /* NOP opcode */ \
199
#define PICT_Clip_Rectangular(ptr, x, y, w, h) \
201
PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \
202
PICTWriteRegionRectangular(ptr, x, y, w, h); /* clipRgn */ \
205
#define PICT_Clip(ptr, x, y, w, h, size, dataptr) \
207
PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \
208
PICTWriteRegion(ptr, x, y, w, h, size, dataptr); /* clipRgn */ \
211
#define PICT_BkPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
213
PICTWriteOpcode(ptr, 0x0002); /* BkPat opcode */ \
214
PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
215
byte5, byte6, byte7, byte8); \
218
#define PICT_TxFont(ptr, font) \
220
PICTWriteOpcode(ptr, 0x0003); /* TxFont opcode */ \
221
PICTWriteInt(ptr, font); /* Font number */ \
224
#define PICT_TxFace(ptr, style) \
226
PICTWriteOpcode(ptr, 0x0004); /* TxFace opcode */ \
227
PICTWriteByte(ptr, style); /* Font style */ \
228
PICTWriteFillByte(ptr); /* Fill byte */ \
231
#define PICT_TxMode(ptr, mode) \
233
PICTWriteOpcode(ptr, 0x0005); /* TxMode opcode */ \
234
PICTWriteInt(ptr, mode); /* Source mode */ \
237
#define PICT_PnSize(ptr, w, h) \
239
PICTWriteOpcode(ptr, 0x0006); /* PnSize opcode */ \
240
PICTWritePoint(w, h); /* Pen size */ \
243
#define PICT_PnMode(ptr, mode) \
245
PICTWriteOpcode(ptr, 0x0007); /* PnMode opcode */ \
246
PICTWriteInt(ptr, mode); /* Pen mode */ \
249
#define PICT_PnPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
251
PICTWriteOpcode(ptr, 0x0009); /* PnPat opcode */ \
252
PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
253
byte5, byte6, byte7, byte8); \
256
#define PICT_FillPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
258
PICTWriteOpcode(ptr, 0x000A); /* FillPat opcode */ \
259
PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
260
byte5, byte6, byte7, byte8); \
263
#define PICT_OvSize(ptr, w, h) \
265
PICTWriteOpcode(ptr, 0x000B); /* OvSize opcode */ \
266
PICTWritePoint(w, h); /* Oval size */ \
269
#define PICT_Origin(ptr, dh, dv) \
271
PICTWriteOpcode(ptr, 0x000C); /* Origin opcode */ \
272
PICTWriteInt(ptr, dh); /* dh */ \
273
PICTWriteInt(ptr, dv); /* dv */ \
276
#define PICT_TxSize(ptr, size) \
278
PICTWriteOpcode(ptr, 0x000D); /* TxSize opcode */ \
279
PICTWriteInt(ptr, size); /* Text Size */ \
282
#define PICT_FgColor(ptr, color) \
284
PICTWriteOpcode(ptr, 0x000E); /* FgColor opcode */ \
285
PICTWriteLong(ptr, color); /* Foreground color */ \
288
#define PICT_BkColor(ptr, color) \
290
PICTWriteOpcode(ptr, 0x000F); /* BkColor opcode */ \
291
PICTWriteLong(ptr, color); /* Background color */ \
294
#define PICT_TxRatio(ptr, num, denom) \
296
PICTWriteOpcode(ptr, 0x0010); /* TxRatio opcode */ \
297
PICTWritePoint(ptr, num); /* Numerator (Point) */ \
298
PICTWritePoint(ptr, denom); /* Denominator (Point) */ \
301
#define PICT_VersionOp(ptr, version) \
303
PICTWriteOpcode(ptr, 0x0011); /* VersionOp opcode */ \
304
PICTWriteByte(ptr, version); /* Version */ \
305
PICTWriteFillByte(ptr); /* Fill byte */ \
308
#define PICT_RGBFgCol(ptr, r, g, b) \
310
PICTWriteOpcode(ptr, 0x001A); /* RGBFgCol opcode */ \
311
PICTWriteRGBColor(ptr, r, g, b); /* Foreground color */ \
314
#define PICT_RGBBkCol(ptr, r, g, b) \
316
PICTWriteOpcode(ptr, 0x001B); /* RGBBkCol opcode */ \
317
PICTWriteRGBColor(ptr, r, g, b); /* Background color */ \
320
#define PICT_HiliteMode(ptr) \
322
PICTWriteOpcode(ptr, 0x001C); /* HiliteMode opcode */ \
325
#define PICT_HiliteColor(ptr, r, g, b) \
327
PICTWriteOpcode(ptr, 0x001D); /* HiliteColor opcode */ \
328
PICTWriteRGBColor(ptr, r, g, b); /* Highlight color */ \
331
#define PICT_DefHilite(ptr) \
333
PICTWriteOpcode(ptr, 0x001E); /* DefHilite opcode */ \
336
#define PICT_OpColor(ptr, r, g, b) \
338
PICTWriteOpcode(ptr, 0x001F); /* OpColor opcode */ \
339
PICTWriteRGBColor(ptr, r, g, b); /* Opcolor */ \
342
#define PICT_Line(ptr, x0, y0, x1, y1) \
344
PICTWriteOpcode(ptr, 0x0020); /* Line opcode */ \
345
PICTWritePoint(ptr, x0, y0); /* pnLoc */ \
346
PICTWritePoint(ptr, x1, y1); /* newPt */ \
349
#define PICT_LineFrom(ptr, x, y) \
351
PICTWriteOpcode(ptr, 0x0021); /* LineFrom opcode */ \
352
PICTWritePoint(ptr, x, y); /* newPt */ \
355
#define PICT_ShortLine(ptr, x, y, dh, dv) \
357
PICTWriteOpcode(ptr, 0x0022); /* ShortLine opcode */ \
358
PICTWritePoint(ptr, x, y); /* pnLoc */ \
359
PICTWriteByte(ptr, dh); /* dh */ \
360
PICTWriteByte(ptr, dv); /* dv */ \
363
#define PICT_ShortLineFrom(ptr, dh, dv) \
365
PICTWriteOpcode(ptr, 0x0023); /* ShortLineFrom opcode */ \
366
PICTWriteByte(ptr, dh); /* dh */ \
367
PICTWriteByte(ptr, dv); /* dv */ \
370
#define PICT_LongText(ptr, x, y, textptr /* pascal string */) \
372
PICTWriteOpcode(ptr, 0x0028); /* LongText opcode */ \
373
PICTWritePoint(ptr, x, y); /* Point */ \
374
PICTWriteText(ptr, textptr); /* text */ \
375
if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \
378
#define PICT_DHText(ptr, dh, textptr /* pascal string */) \
380
PICTWriteOpcode(ptr, 0x0029); /* DHText opcode */ \
381
PICTWriteByte(ptr, dh); /* dh */ \
382
PICTWriteText(ptr, textptr); /* text */ \
383
if (textptr[0] % 2) PICTWriteFillByte(ptr); \
386
#define PICT_DVText(ptr, dv, textptr /* pascal string */) \
388
PICTWriteOpcode(ptr, 0x002A); /* DVText opcode */ \
389
PICTWriteByte(ptr, dv); /* dv */ \
390
PICTWriteText(ptr, textptr); /* text */ \
391
if (textptr[0] % 2) PICTWriteFillByte(ptr); \
394
#define PICT_DHDVText(ptr, dh, dv, textptr /* pascal string */) \
396
PICTWriteOpcode(ptr, 0x002B); /* DHDVText opcode */ \
397
PICTWriteByte(ptr, dh); /* dh */ \
398
PICTWriteByte(ptr, dv); /* dv */ \
399
PICTWriteText(ptr, textptr); /* text */ \
400
if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \
403
#define PICT_fontName(ptr, id, nameptr /* pascal string */) \
405
PICTWriteOpcode(ptr, 0x002C); /* fontName opcode */ \
406
PICTWriteInt(ptr, nameptr[0]+1+2); /* data length */ \
407
PICTWriteInt(ptr, id); /* font id */ \
408
PICTWriteText(ptr, nameptr); /* text */ \
409
if ((nameptr[0]+1) % 2) PICTWriteFillByte(ptr); \
412
#define PICT_frameRect(ptr, x, y, w, h) \
414
PICTWriteOpcode(ptr, 0x0030); /* frameRect opcode */ \
415
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
418
#define PICT_paintRect(ptr, x, y, w, h) \
420
PICTWriteOpcode(ptr, 0x0031); /* paintRect opcode */ \
421
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
424
#define PICT_eraseRect(ptr, x, y, w, h) \
426
PICTWriteOpcode(ptr, 0x0032); /* eraseRect opcode */ \
427
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
430
#define PICT_invertRect(ptr, x, y, w, h) \
432
PICTWriteOpcode(ptr, 0x0033); /* invertRect opcode */ \
433
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
436
#define PICT_fillRect(ptr, x, y, w, h) \
438
PICTWriteOpcode(ptr, 0x0034); /* fillRect opcode */ \
439
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
442
#define PICT_frameSameRect(ptr) \
444
PICTWriteOpcode(ptr, 0x0038); /* frameSameRect opcode */ \
447
#define PICT_paintSameRect(ptr) \
449
PICTWriteOpcode(ptr, 0x0039); /* paintSameRect opcode */ \
452
#define PICT_eraseSameRect(ptr) \
454
PICTWriteOpcode(ptr, 0x003A); /* eraseSameRect opcode */ \
457
#define PICT_invertSameRect(ptr) \
459
PICTWriteOpcode(ptr, 0x003B); /* invertSameRect opcode */ \
462
#define PICT_fillSameRect(ptr) \
464
PICTWriteOpcode(ptr, 0x003C); /* fillSameRect opcode */ \
467
#define PICT_frameRRect(ptr, x, y, w, h) \
469
PICTWriteOpcode(ptr, 0x0040); /* frameRRect opcode */ \
470
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
473
#define PICT_paintRRect(ptr, x, y, w, h) \
475
PICTWriteOpcode(ptr, 0x0041); /* paintRRect opcode */ \
476
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
479
#define PICT_eraseRRect(ptr, x, y, w, h) \
481
PICTWriteOpcode(ptr, 0x0042); /* eraseRRect opcode */ \
482
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
485
#define PICT_invertRRect(ptr, x, y, w, h) \
487
PICTWriteOpcode(ptr, 0x0043); /* invertRRect opcode */ \
488
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
491
#define PICT_fillRRect(ptr, x, y, w, h) \
493
PICTWriteOpcode(ptr, 0x0044); /* fillRRect opcode */ \
494
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
497
#define PICT_frameSameRRect(ptr) \
499
PICTWriteOpcode(ptr, 0x0048); /* frameSameRRect opcode */ \
502
#define PICT_paintSameRRect(ptr) \
504
PICTWriteOpcode(ptr, 0x0049); /* paintSameRRect opcode */ \
507
#define PICT_eraseSameRRect(ptr) \
509
PICTWriteOpcode(ptr, 0x004A); /* eraseSameRRect opcode */ \
512
#define PICT_invertSameRRect(ptr) \
514
PICTWriteOpcode(ptr, 0x004B); /* invertSameRRect opcode */\
517
#define PICT_fillSameRRect(ptr) \
519
PICTWriteOpcode(ptr, 0x004C); /* fillSameRRect opcode */ \
522
#define PICT_frameOval(ptr, x, y, w, h) \
524
PICTWriteOpcode(ptr, 0x0050); /* frameOval opcode */ \
525
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
528
#define PICT_paintOval(ptr, x, y, w, h) \
530
PICTWriteOpcode(ptr, 0x0051); /* paintOval opcode */ \
531
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
534
#define PICT_eraseOval(ptr, x, y, w, h) \
536
PICTWriteOpcode(ptr, 0x0052); /* eraseOval opcode */ \
537
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
540
#define PICT_invertOval(ptr, x, y, w, h) \
542
PICTWriteOpcode(ptr, 0x0053); /* invertOval opcode */ \
543
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
546
#define PICT_fillOval(ptr, x, y, w, h) \
548
PICTWriteOpcode(ptr, 0x0054); /* fillOval opcode */ \
549
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
552
#define PICT_frameSameOval(ptr) \
554
PICTWriteOpcode(ptr, 0x0058); /* frameSameOval opcode */ \
557
#define PICT_paintSameOval(ptr) \
559
PICTWriteOpcode(ptr, 0x0059); /* paintSameOval opcode */ \
562
#define PICT_eraseSameOval(ptr) \
564
PICTWriteOpcode(ptr, 0x005A); /* eraseSameOval opcode */ \
567
#define PICT_invertSameOval(ptr) \
569
PICTWriteOpcode(ptr, 0x005B); /* invertSameOval opcode */ \
572
#define PICT_fillSameOval(ptr) \
574
PICTWriteOpcode(ptr, 0x005C); /* fillSameOval opcode */ \
577
#define PICT_frameArc(ptr, x, y, w, h, startAngle, arcAngle) \
579
PICTWriteOpcode(ptr, 0x0060); /* frameArc opcode */ \
580
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
581
PICTWriteInt(ptr, startAngle); /* startAngle */ \
582
PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
585
#define PICT_paintArc(ptr, x, y, w, h, startAngle, arcAngle) \
587
PICTWriteOpcode(ptr, 0x0061); /* paintArc opcode */ \
588
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
589
PICTWriteInt(ptr, startAngle); /* startAngle */ \
590
PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
593
#define PICT_eraseArc(ptr, x, y, w, h, startAngle, arcAngle) \
595
PICTWriteOpcode(ptr, 0x0062); /* eraseArc opcode */ \
596
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
597
PICTWriteInt(ptr, startAngle); /* startAngle */ \
598
PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
601
#define PICT_invertArc(ptr, x, y, w, h, startAngle, arcAngle) \
603
PICTWriteOpcode(ptr, 0x0063); /* invertArc opcode */ \
604
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
605
PICTWriteInt(ptr, startAngle); /* startAngle */ \
606
PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
609
#define PICT_fillArc(ptr, x, y, w, h, startAngle, arcAngle) \
611
PICTWriteOpcode(ptr, 0x0064); /* fillArc opcode */ \
612
PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
613
PICTWriteInt(ptr, startAngle); /* startAngle */ \
614
PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
617
/* use only with rowBytes < 8 !! */
618
#define PICT_BitsRect_BitMap(ptr, x0, y0, w0, h0, x1, y1, w1, h1, rowBytes, mode, dataPtr) \
620
PICTWriteOpcode(ptr, 0x0090); /* BitsRect opcode */ \
621
PICTWriteInt(ptr, rowBytes); /* rowBytes */ \
622
PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \
623
PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \
624
PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \
625
PICTWriteInt(ptr, mode); /* mode */ \
626
memcpy(ptr, dataPtr, h0*rowBytes); /* BitMap data */ \
629
#define PICT_PackBitsRect_BitMap(ptr, x0, y0, w0, h0, x1, y1, w1, h1, rowBytes, mode, \
632
PICTWriteOpcode(ptr, 0x0098); /* PackBitsRect opcode */ \
633
PICTWriteInt(ptr, rowBytes); /* rowBytes */ \
634
PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \
635
PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \
636
PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \
637
PICTWriteInt(ptr, mode); /* mode */ \
638
memcpy(ptr, dataPtr, size); /* BitMap data */ \
641
#define PICT_OpEndPic(ptr) \
643
PICTWriteOpcode(ptr, 0x00FF); /* OpEndPic opcode */ \
646
/* same as PICT_OpEndPic, but doesn't move pointer */
647
#define PICT_OpEndPicGoOn(ptr) \
649
*(ptr) = 0x00FF; /* OpEndPic opcode */ \
659
/******************************/
660
/* ghostscript to PICT macros */
661
/******************************/
663
/* set forground color to black and background color to white */
664
#define GSSetStdCol(ptr) \
666
PICT_RGBFgCol(ptr, 0x0000, 0x0000, 0x0000); /* black */ \
667
PICT_RGBBkCol(ptr, 0xFFFF, 0xFFFF, 0xFFFF); /* white */ \
670
#define GSSetFgCol(dev, ptr, col) \
672
gx_color_value rgb[3]; \
673
(*dev_proc(dev, map_color_rgb))(dev, col, rgb); \
674
PICT_RGBFgCol(ptr, rgb[0], rgb[1], rgb[2]); \
677
#define GSSetBkCol(dev, ptr, col) \
679
gx_color_value rgb[3]; \
680
(*dev_proc(dev, map_color_rgb))(dev, col, rgb); \
681
PICT_RGBBkCol(ptr, rgb[0], rgb[1], rgb[2]); \
684
#endif /* gdevmacpictop_INCLUDED */