7
#include "OPVPWrapper_0_2.h"
10
/* color space mapping 0.2 to 1.0 */
11
opvp_cspace_t OPVPWrapper_0_2::cspace_0_2_to_1_0[] = {
13
OPVP_CSPACE_DEVICEGRAY,
14
OPVP_CSPACE_DEVICECMY,
15
OPVP_CSPACE_DEVICECMYK,
16
OPVP_CSPACE_DEVICERGB,
17
OPVP_CSPACE_STANDARDRGB,
18
OPVP_CSPACE_STANDARDRGB64
21
/* color space mapping 1.0 to 0.2 */
22
OPVP_ColorSpace OPVPWrapper_0_2::cspace_1_0_to_0_2[] = {
24
OPVP_cspaceDeviceGray,
26
OPVP_cspaceDeviceCMYK,
28
(OPVP_ColorSpace)0, /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
29
OPVP_cspaceStandardRGB,
30
OPVP_cspaceStandardRGB64,
33
/* image format mapping 1.0 to 0.2 */
34
OPVP_ImageFormat OPVPWrapper_0_2::iformat_1_0_to_0_2[] = {
36
/* OPVP_IFORMAT_MASK use iformat raw in 0.2 */
43
/* image colorDepth needed in 0.2 */
44
int OPVPWrapper_0_2::colorDepth_0_2[] = {
45
1, /* OPVP_CSPACE_BW */
46
8, /* OPVP_CSPACE_DEVICEGRAY */
47
24, /* OPVP_CSPACE_DEVICECMY */
48
32, /* OPVP_CSPACE_DEVICECMYK */
49
24, /* OPVP_CSPACE_DEVICERGB */
50
32, /* OPVP_CSPACE_DEVICEKRGB */
51
24, /* OPVP_CSPACE_STANDARDRGB */
52
64, /* OPVP_CSPACE_STANDARDRGB64 */
55
OPVPWrapper_0_2::OPVPWrapper_0_2(void *opvpHandleA, int *opvpErrorNoA,
56
OPVP_api_procs *procsA, int printerContextA)
59
opvpHandle = opvpHandleA;
60
opvpErrorNo_0_2 = opvpErrorNoA;
61
printerContext_0_2 = printerContextA;
64
supportClosePrinter = (procs_0_2->ClosePrinter != 0);
65
supportStartJob = (procs_0_2->StartJob != 0);
66
supportEndJob = (procs_0_2->EndJob != 0);
67
supportAbortJob = false;
68
supportStartDoc = (procs_0_2->StartDoc != 0);
69
supportEndDoc = (procs_0_2->EndDoc != 0);
70
supportStartPage = (procs_0_2->StartPage != 0);
71
supportEndPage = (procs_0_2->EndPage != 0);
72
supportResetCTM = (procs_0_2->ResetCTM != 0);
73
supportSetCTM = (procs_0_2->SetCTM != 0);
74
supportGetCTM = (procs_0_2->GetCTM != 0);
75
supportInitGS = (procs_0_2->InitGS != 0);
76
supportSaveGS = (procs_0_2->SaveGS != 0);
77
supportRestoreGS = (procs_0_2->RestoreGS != 0);
78
supportQueryColorSpace = (procs_0_2->QueryColorSpace != 0);
79
supportSetColorSpace = (procs_0_2->SetColorSpace != 0);
80
supportGetColorSpace = (procs_0_2->GetColorSpace != 0);
81
supportSetFillMode = (procs_0_2->SetFillMode != 0);
82
supportGetFillMode = (procs_0_2->GetFillMode != 0);
83
supportSetAlphaConstant = (procs_0_2->SetAlphaConstant != 0);
84
supportGetAlphaConstant = (procs_0_2->GetAlphaConstant != 0);
85
supportSetLineWidth = (procs_0_2->SetLineWidth != 0);
86
supportGetLineWidth = (procs_0_2->GetLineWidth != 0);
87
supportSetLineDash = (procs_0_2->SetLineDash != 0);
88
supportGetLineDash = (procs_0_2->GetLineDash != 0);
89
supportSetLineDashOffset = (procs_0_2->SetLineDashOffset != 0);
90
supportGetLineDashOffset = (procs_0_2->GetLineDashOffset != 0);
91
supportSetLineStyle = (procs_0_2->SetLineStyle != 0);
92
supportGetLineStyle = (procs_0_2->GetLineStyle != 0);
93
supportSetLineCap = (procs_0_2->SetLineCap != 0);
94
supportGetLineCap = (procs_0_2->GetLineCap != 0);
95
supportSetLineJoin = (procs_0_2->SetLineJoin != 0);
96
supportGetLineJoin = (procs_0_2->GetLineJoin != 0);
97
supportSetMiterLimit = (procs_0_2->SetMiterLimit != 0);
98
supportGetMiterLimit = (procs_0_2->GetMiterLimit != 0);
99
supportSetPaintMode = (procs_0_2->SetPaintMode != 0);
100
supportGetPaintMode = (procs_0_2->GetPaintMode != 0);
101
supportSetStrokeColor = (procs_0_2->SetStrokeColor != 0);
102
supportSetFillColor = (procs_0_2->SetFillColor != 0);
103
supportSetBgColor = (procs_0_2->SetBgColor != 0);
104
supportNewPath = (procs_0_2->NewPath != 0);
105
supportEndPath = (procs_0_2->EndPath != 0);
106
supportStrokePath = (procs_0_2->StrokePath != 0);
107
supportFillPath = (procs_0_2->FillPath != 0);
108
supportStrokeFillPath = (procs_0_2->StrokeFillPath != 0);
109
supportSetClipPath = (procs_0_2->SetClipPath != 0);
110
supportSetCurrentPoint = (procs_0_2->SetCurrentPoint != 0);
111
supportLinePath = (procs_0_2->LinePath != 0);
112
supportPolygonPath = (procs_0_2->PolygonPath != 0);
113
supportRectanglePath = (procs_0_2->RectanglePath != 0);
114
supportRoundRectanglePath = (procs_0_2->RoundRectanglePath != 0);
115
supportBezierPath = (procs_0_2->BezierPath != 0);
116
supportArcPath = (procs_0_2->ArcPath != 0);
117
supportDrawImage = (procs_0_2->DrawImage != 0);
118
supportStartDrawImage = (procs_0_2->StartDrawImage != 0);
119
supportTransferDrawImage = (procs_0_2->TransferDrawImage != 0);
120
supportEndDrawImage = (procs_0_2->EndDrawImage != 0);
121
supportStartScanline = (procs_0_2->StartScanline != 0);
122
supportScanline = (procs_0_2->Scanline != 0);
123
supportEndScanline = (procs_0_2->EndScanline != 0);
124
supportStartRaster = (procs_0_2->StartRaster != 0);
125
supportTransferRasterData = (procs_0_2->TransferRasterData != 0);
126
supportSkipRaster = (procs_0_2->SkipRaster != 0);
127
supportEndRaster = (procs_0_2->EndRaster != 0);
128
supportStartStream = (procs_0_2->StartStream != 0);
129
supportTransferStreamData = (procs_0_2->TransferStreamData != 0);
130
supportEndStream = (procs_0_2->EndStream != 0);
131
supportQueryDeviceCapability = (procs_0_2->QueryDeviceCapability != 0);
132
supportQueryDeviceInfo = (procs_0_2->QueryDeviceInfo != 0);
133
supportResetClipPath = (procs_0_2->ResetClipPath != 0);
134
colorSpace = OPVP_CSPACE_STANDARDRGB;
135
if (supportGetColorSpace) {
136
if (GetColorSpace(&colorSpace) != OPVP_OK) {
137
colorSpace = OPVP_CSPACE_STANDARDRGB;
142
OPVPWrapper_0_2::~OPVPWrapper_0_2()
146
opvp_result_t OPVPWrapper_0_2::ClosePrinter()
148
if (!supportClosePrinter) {
149
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
152
return (opvp_result_t)procs_0_2->ClosePrinter(printerContext_0_2);
155
opvp_result_t OPVPWrapper_0_2::StartJob(
156
const opvp_char_t *jobInfo)
158
if (!supportStartJob) {
159
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
162
return (opvp_result_t)procs_0_2->StartJob(printerContext_0_2,
166
opvp_result_t OPVPWrapper_0_2::EndJob()
168
if (!supportEndJob) {
169
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
172
return (opvp_result_t)procs_0_2->EndJob(printerContext_0_2);
175
opvp_result_t OPVPWrapper_0_2::AbortJob()
177
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
181
opvp_result_t OPVPWrapper_0_2::StartDoc(
182
const opvp_char_t *docInfo)
184
if (!supportStartDoc) {
185
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
188
return (opvp_result_t)procs_0_2->StartDoc(printerContext_0_2,
192
opvp_result_t OPVPWrapper_0_2::EndDoc()
194
if (!supportEndDoc) {
195
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
198
return (opvp_result_t)procs_0_2->EndDoc(printerContext_0_2);
201
opvp_result_t OPVPWrapper_0_2::StartPage(
202
const opvp_char_t *pageInfo)
206
if (!supportStartPage) {
207
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
210
if ((r = procs_0_2->StartPage(printerContext_0_2,
211
/* discard const */(char *)pageInfo)) != OPVP_OK) {
213
return (opvp_result_t)r;
216
if (procs_0_2->SetROP != 0) {
217
procs_0_2->SetROP(printerContext_0_2,
223
opvp_result_t OPVPWrapper_0_2::EndPage()
225
if (!supportEndPage) {
226
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
229
return (opvp_result_t)procs_0_2->EndPage(printerContext_0_2);
232
opvp_result_t OPVPWrapper_0_2::QueryDeviceCapability(
233
opvp_flag_t queryflag, opvp_int_t *buflen, opvp_byte_t *infoBuf)
235
if (!supportQueryDeviceCapability) {
236
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
239
return (opvp_result_t)procs_0_2->
240
QueryDeviceCapability(printerContext_0_2,queryflag,*buflen,
244
opvp_result_t OPVPWrapper_0_2::QueryDeviceInfo(
245
opvp_flag_t queryflag, opvp_int_t *buflen, opvp_byte_t *infoBuf)
247
if (!supportQueryDeviceInfo) {
248
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
251
if (queryflag & OPVP_QF_MEDIACOPY) {
252
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
255
if (queryflag & OPVP_QF_PRINTREGION) {
256
queryflag &= ~OPVP_QF_PRINTREGION;
257
queryflag |= 0x0020000;
259
return (opvp_result_t)procs_0_2->QueryDeviceInfo(printerContext_0_2,
260
queryflag,*buflen,(char *)infoBuf);
263
opvp_result_t OPVPWrapper_0_2::ResetCTM()
265
if (!supportResetCTM) {
266
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
269
return (opvp_result_t)procs_0_2->ResetCTM(printerContext_0_2);
272
opvp_result_t OPVPWrapper_0_2::SetCTM(const opvp_ctm_t *pCTM)
274
if (!supportSetCTM) {
275
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
278
return (opvp_result_t)procs_0_2->SetCTM(printerContext_0_2,
282
opvp_result_t OPVPWrapper_0_2::GetCTM(opvp_ctm_t *pCTM)
284
if (!supportGetCTM) {
285
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
288
return (opvp_result_t)procs_0_2->GetCTM(printerContext_0_2,
292
opvp_result_t OPVPWrapper_0_2::InitGS()
296
if (!supportInitGS) {
297
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
300
if ((r = procs_0_2->InitGS(printerContext_0_2)) != OPVP_OK) {
302
return (opvp_result_t)r;
305
if (procs_0_2->SetROP != 0) {
306
procs_0_2->SetROP(printerContext_0_2,
312
opvp_result_t OPVPWrapper_0_2::SaveGS()
314
if (!supportSaveGS) {
315
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
318
return (opvp_result_t)procs_0_2->SaveGS(printerContext_0_2);
321
opvp_result_t OPVPWrapper_0_2::RestoreGS()
323
if (!supportRestoreGS) {
324
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
327
return (opvp_result_t)procs_0_2->RestoreGS(printerContext_0_2);
330
opvp_result_t OPVPWrapper_0_2::QueryColorSpace(
331
opvp_int_t *pnum, opvp_cspace_t *pcspace)
336
if (!supportQueryColorSpace) {
337
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
340
if ((r = procs_0_2->QueryColorSpace(printerContext_0_2,
341
(OPVP_ColorSpace *)pcspace,pnum)) != OPVP_OK) {
343
return (opvp_result_t)r;
345
/* translate cspaces */
346
for (i = 0;i < *pnum;i++) {
347
if ((unsigned int)pcspace[i]
348
> sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
349
/* unknown color space */
350
/* set DEVICERGB instead */
351
pcspace[i] = OPVP_CSPACE_DEVICERGB;
353
pcspace[i] = cspace_0_2_to_1_0[pcspace[i]];
359
opvp_result_t OPVPWrapper_0_2::SetColorSpace(
360
opvp_cspace_t cspace)
364
if (!supportSetColorSpace) {
365
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
368
if (cspace == OPVP_CSPACE_DEVICEKRGB) {
369
/* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
370
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
373
if ((unsigned int)cspace
374
> sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
375
/* unknown color space */
376
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
379
r = procs_0_2->SetColorSpace(printerContext_0_2,
380
cspace_1_0_to_0_2[cspace]);
384
return (opvp_result_t)r;
387
opvp_result_t OPVPWrapper_0_2::GetColorSpace(
388
opvp_cspace_t *pcspace)
392
if (!supportGetColorSpace) {
393
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
396
if ((r = procs_0_2->GetColorSpace(printerContext_0_2,
397
(OPVP_ColorSpace *)pcspace)) != OPVP_OK) {
399
return (opvp_result_t)r;
401
if ((unsigned int)*pcspace
402
> sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
403
/* unknown color space */
404
/* set DEVICERGB instead */
405
*pcspace = OPVP_CSPACE_DEVICERGB;
407
*pcspace = cspace_0_2_to_1_0[*pcspace];
409
return (opvp_result_t)r;
412
opvp_result_t OPVPWrapper_0_2::SetFillMode(
413
opvp_fillmode_t fillmode)
415
if (!supportSetFillMode) {
416
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
419
/* OPVP_FillMode is comaptible with opvp_fillmode_t */
420
return (opvp_result_t)procs_0_2->SetFillMode(printerContext_0_2,
421
(OPVP_FillMode)fillmode);
424
opvp_result_t OPVPWrapper_0_2::GetFillMode(
425
opvp_fillmode_t *pfillmode)
427
if (!supportGetFillMode) {
428
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
431
/* OPVP_FillMode is comaptible with opvp_fillmode_t */
432
return (opvp_result_t)procs_0_2->GetFillMode(printerContext_0_2,
433
(OPVP_FillMode *)pfillmode);
436
opvp_result_t OPVPWrapper_0_2::SetAlphaConstant(
439
if (!supportSetAlphaConstant) {
440
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
443
return (opvp_result_t)procs_0_2->SetAlphaConstant(printerContext_0_2,alpha);
446
opvp_result_t OPVPWrapper_0_2::GetAlphaConstant(
447
opvp_float_t *palpha)
449
if (!supportGetAlphaConstant) {
450
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
453
return (opvp_result_t)procs_0_2->GetAlphaConstant(printerContext_0_2,palpha);
456
opvp_result_t OPVPWrapper_0_2::SetLineWidth(
459
if (!supportSetLineWidth) {
460
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
463
return (opvp_result_t)procs_0_2->SetLineWidth(printerContext_0_2,width);
466
opvp_result_t OPVPWrapper_0_2::GetLineWidth(
469
if (!supportGetLineWidth) {
470
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
473
return (opvp_result_t)procs_0_2->GetLineWidth(printerContext_0_2,pwidth);
476
opvp_result_t OPVPWrapper_0_2::SetLineDash(opvp_int_t num,
477
const opvp_fix_t *pdash)
479
if (!supportSetLineDash) {
480
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
483
return (opvp_result_t)procs_0_2->SetLineDash(printerContext_0_2,
484
/* remove const */ (OPVP_Fix *)pdash,num);
487
opvp_result_t OPVPWrapper_0_2::GetLineDash(
488
opvp_int_t *pnum, opvp_fix_t *pdash)
490
if (!supportGetLineDash) {
491
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
494
return (opvp_result_t)procs_0_2->GetLineDash(printerContext_0_2,
498
opvp_result_t OPVPWrapper_0_2::SetLineDashOffset(
501
if (!supportSetLineDashOffset) {
502
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
505
return (opvp_result_t)procs_0_2->SetLineDashOffset(printerContext_0_2,offset);
508
opvp_result_t OPVPWrapper_0_2::GetLineDashOffset(
511
if (!supportGetLineDashOffset) {
512
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
515
return (opvp_result_t)procs_0_2->GetLineDashOffset(printerContext_0_2,poffset);
518
opvp_result_t OPVPWrapper_0_2::SetLineStyle(
519
opvp_linestyle_t linestyle)
521
if (!supportSetLineStyle) {
522
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
525
/* OPVP_LineStyle is compatible with opvp_linestyle_t */
526
return (opvp_result_t)procs_0_2->SetLineStyle(printerContext_0_2,
527
(OPVP_LineStyle)linestyle);
530
opvp_result_t OPVPWrapper_0_2::GetLineStyle(
531
opvp_linestyle_t *plinestyle)
533
if (!supportGetLineStyle) {
534
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
537
/* OPVP_LineStyle is compatible with opvp_linestyle_t */
538
return (opvp_result_t)procs_0_2->GetLineStyle(printerContext_0_2,
539
(OPVP_LineStyle *)plinestyle);
542
opvp_result_t OPVPWrapper_0_2::SetLineCap(
543
opvp_linecap_t linecap)
545
if (!supportSetLineCap) {
546
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
549
/* OPVP_LineCap is compatible with opvp_cap_t */
550
return (opvp_result_t)procs_0_2->SetLineCap(printerContext_0_2,
551
(OPVP_LineCap)linecap);
554
opvp_result_t OPVPWrapper_0_2::GetLineCap(
555
opvp_linecap_t *plinecap)
557
if (!supportGetLineCap) {
558
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
561
/* OPVP_LineCap is compatible with opvp_cap_t */
562
return (opvp_result_t)procs_0_2->GetLineCap(printerContext_0_2,
563
(OPVP_LineCap *)plinecap);
566
opvp_result_t OPVPWrapper_0_2::SetLineJoin(
567
opvp_linejoin_t linejoin)
569
if (!supportSetLineJoin) {
570
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
573
/* OPVP_LineJoin is compatible with opvp_linejoin_t */
574
return (opvp_result_t)procs_0_2->SetLineJoin(printerContext_0_2,
575
(OPVP_LineJoin)linejoin);
578
opvp_result_t OPVPWrapper_0_2::GetLineJoin(
579
opvp_linejoin_t *plinejoin)
581
if (!supportGetLineJoin) {
582
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
585
/* OPVP_LineJoin is compatible with opvp_linejoin_t */
586
return (opvp_result_t)procs_0_2->GetLineJoin(printerContext_0_2,
587
(OPVP_LineJoin *)plinejoin);
590
opvp_result_t OPVPWrapper_0_2::SetMiterLimit(
591
opvp_fix_t miterlimit)
593
if (!supportSetMiterLimit) {
594
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
597
/* OPVP_Fix is compatible with opvp_fix_t */
598
return (opvp_result_t)procs_0_2->SetMiterLimit(printerContext_0_2,
599
(OPVP_Fix)miterlimit);
602
opvp_result_t OPVPWrapper_0_2::GetMiterLimit(
603
opvp_fix_t *pmiterlimit)
605
if (!supportGetMiterLimit) {
606
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
609
/* OPVP_Fix is compatible with opvp_fix_t */
610
return (opvp_result_t)procs_0_2->GetMiterLimit(printerContext_0_2,
611
(OPVP_Fix *)pmiterlimit);
614
opvp_result_t OPVPWrapper_0_2::SetPaintMode(
615
opvp_paintmode_t paintmode)
617
if (!supportSetPaintMode) {
618
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
621
/* OPVP_PaintMode is compatible with opvp_paintmode_t */
622
return (opvp_result_t)procs_0_2->SetPaintMode(printerContext_0_2,
623
(OPVP_PaintMode)paintmode);
626
opvp_result_t OPVPWrapper_0_2::GetPaintMode(
627
opvp_paintmode_t *ppaintmode)
629
if (!supportGetPaintMode) {
630
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
633
/* OPVP_PaintMode is compatible with opvp_paintmode_t */
634
return (opvp_result_t)procs_0_2->GetPaintMode(printerContext_0_2,
635
(OPVP_PaintMode *)ppaintmode);
638
opvp_result_t OPVPWrapper_0_2::SetStrokeColor(
639
const opvp_brush_t *brush)
641
OPVP_Brush brush_0_2;
643
if (!supportSetStrokeColor) {
644
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
648
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
651
if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
652
/* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
653
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
656
if ((unsigned int)brush->colorSpace
657
> sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
658
/* unknown color space */
659
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
662
brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
663
brush_0_2.xorg = brush->xorg;
664
brush_0_2.yorg = brush->yorg;
665
brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
666
memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
667
return (opvp_result_t)procs_0_2->SetStrokeColor(printerContext_0_2,
671
opvp_result_t OPVPWrapper_0_2::SetFillColor(
672
const opvp_brush_t *brush)
674
OPVP_Brush brush_0_2;
676
if (!supportSetFillColor) {
677
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
681
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
684
if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
685
/* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
686
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
689
if ((unsigned int)brush->colorSpace
690
> sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
691
/* unknown color space */
692
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
695
brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
696
brush_0_2.xorg = brush->xorg;
697
brush_0_2.yorg = brush->yorg;
698
brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
699
memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
700
return (opvp_result_t)procs_0_2->SetFillColor(printerContext_0_2,
704
opvp_result_t OPVPWrapper_0_2::SetBgColor(
705
const opvp_brush_t *brush)
707
OPVP_Brush brush_0_2;
709
if (!supportSetBgColor) {
710
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
714
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
717
if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
718
/* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
719
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
722
if ((unsigned int)brush->colorSpace
723
> sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
724
/* unknown color space */
725
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
728
brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
729
brush_0_2.xorg = brush->xorg;
730
brush_0_2.yorg = brush->yorg;
731
brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
732
memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
733
return (opvp_result_t)procs_0_2->SetBgColor(printerContext_0_2,
737
opvp_result_t OPVPWrapper_0_2::NewPath()
739
if (!supportNewPath) {
740
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
743
return (opvp_result_t)procs_0_2->NewPath(printerContext_0_2);
746
opvp_result_t OPVPWrapper_0_2::EndPath()
748
if (!supportEndPath) {
749
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
752
return (opvp_result_t)procs_0_2->EndPath(printerContext_0_2);
755
opvp_result_t OPVPWrapper_0_2::StrokePath()
757
if (!supportStrokePath) {
758
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
761
return (opvp_result_t)procs_0_2->StrokePath(printerContext_0_2);
764
opvp_result_t OPVPWrapper_0_2::FillPath()
766
if (!supportFillPath) {
767
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
770
return (opvp_result_t)procs_0_2->FillPath(printerContext_0_2);
773
opvp_result_t OPVPWrapper_0_2::StrokeFillPath()
775
if (!supportStrokeFillPath) {
776
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
779
return (opvp_result_t)procs_0_2->StrokeFillPath(printerContext_0_2);
782
opvp_result_t OPVPWrapper_0_2::SetClipPath(
783
opvp_cliprule_t clipRule)
785
if (!supportSetClipPath) {
786
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
789
/* OPVP_ClipRule is compatible with opvp_cliprule_t */
790
return (opvp_result_t)procs_0_2->SetClipPath(printerContext_0_2,
791
(OPVP_ClipRule)clipRule);
794
opvp_result_t OPVPWrapper_0_2::SetCurrentPoint(
795
opvp_fix_t x, opvp_fix_t y)
797
if (!supportSetCurrentPoint) {
798
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
801
return (opvp_result_t)procs_0_2->SetCurrentPoint(printerContext_0_2,x,y);
804
opvp_result_t OPVPWrapper_0_2::LinePath(
805
opvp_pathmode_t flag, opvp_int_t npoints, const opvp_point_t *points)
807
if (!supportLinePath) {
808
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
811
/* OPVP_Point is compatible with opvp_point_t */
812
return (opvp_result_t)procs_0_2->LinePath(printerContext_0_2,flag,npoints,
813
(OPVP_Point *)points);
816
opvp_result_t OPVPWrapper_0_2::PolygonPath(
817
opvp_int_t npolygons, const opvp_int_t *nvertexes,
818
const opvp_point_t *points)
820
if (!supportPolygonPath) {
821
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
824
/* OPVP_Point is compatible with opvp_point_t */
825
return (opvp_result_t)procs_0_2->PolygonPath(printerContext_0_2,
826
(int)npolygons,(int *)nvertexes,(OPVP_Point *)points);
829
opvp_result_t OPVPWrapper_0_2::RectanglePath(
830
opvp_int_t nrectangles, const opvp_rectangle_t *rectangles)
832
if (!supportRectanglePath) {
833
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
836
/* OPVP_Rectangle is compatible with opvp_rectangle_t */
837
return (opvp_result_t)procs_0_2->RectanglePath(printerContext_0_2,
838
(int)nrectangles,(OPVP_Rectangle *)rectangles);
841
opvp_result_t OPVPWrapper_0_2::RoundRectanglePath(
842
opvp_int_t nrectangles, const opvp_roundrectangle_t *rectangles)
844
if (!supportRoundRectanglePath) {
845
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
848
/* OPVP_RoundRectangle is compatible with opvp_roundrectangle_t */
849
return (opvp_result_t)procs_0_2->RoundRectanglePath(printerContext_0_2,
850
(int)nrectangles,(OPVP_RoundRectangle *)rectangles);
853
opvp_result_t OPVPWrapper_0_2::BezierPath(opvp_int_t npoints,
854
const opvp_point_t *points)
856
if (!supportBezierPath) {
857
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
860
/* OPVP_Point is compatible with opvp_point_t */
861
return (opvp_result_t)procs_0_2->BezierPath(printerContext_0_2,(int)npoints,
862
(OPVP_Point *)points);
865
opvp_result_t OPVPWrapper_0_2::ArcPath(opvp_arcmode_t kind, opvp_arcdir_t dir,
866
opvp_fix_t bbx0, opvp_fix_t bby0, opvp_fix_t bbx1,
867
opvp_fix_t bby1, opvp_fix_t x0, opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1)
869
if (!supportArcPath) {
870
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
873
/* opvp_arcmode_t is compatible with int */
874
/* opvp_arcdir_t is compatible with int */
875
return (opvp_result_t)procs_0_2->ArcPath(printerContext_0_2,
876
(int)kind,(int)dir,bbx0,bby0,
877
bbx1,bby1,x0,y0,x1,y1);
880
opvp_result_t OPVPWrapper_0_2::DrawImage(opvp_int_t sourceWidth,
881
opvp_int_t sourceHeight, opvp_int_t sourcePitch,
882
opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
883
opvp_int_t destinationHeight, const void *imagedata)
887
OPVP_ImageFormat iformat_0_2;
888
OPVP_PaintMode paintmode_0_2 = OPVP_paintModeTransparent;
891
if (!supportDrawImage) {
894
if ((result = StartDrawImage(sourceWidth,
895
sourceHeight,sourcePitch,imageFormat,destinationWidth,
896
destinationHeight)) < 0) {
899
if ((result = TransferDrawImage(sourcePitch*sourceHeight,
903
return EndDrawImage();
906
if (imageFormat == OPVP_IFORMAT_MASK) {
907
if (procs_0_2->GetPaintMode != 0) {
908
procs_0_2->GetPaintMode(printerContext_0_2,
911
if (paintmode_0_2 != OPVP_paintModeTransparent) {
912
if (procs_0_2->SetROP != 0) {
913
procs_0_2->SetROP(printerContext_0_2,
918
if (procs_0_2->SetROP != 0) {
919
procs_0_2->SetROP(printerContext_0_2,
925
if (procs_0_2->SetROP != 0) {
926
procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
928
depth = colorDepth_0_2[colorSpace];
931
OPVP_I2FIX(0,rect.p0.x);
932
OPVP_I2FIX(0,rect.p0.y);
933
OPVP_I2FIX(destinationWidth,rect.p1.x);
934
OPVP_I2FIX(destinationHeight,rect.p1.y);
935
if ((unsigned int)imageFormat
936
> sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
937
/* illegal image format */
938
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
941
iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
942
r = procs_0_2->DrawImage(printerContext_0_2,sourceWidth,sourceHeight,
943
depth,iformat_0_2,rect,
944
sourcePitch*sourceHeight,
945
/* remove const */ (void *)imagedata);
947
if (procs_0_2->SetROP != 0) {
948
procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_P);
951
return (opvp_result_t)r;
954
opvp_result_t OPVPWrapper_0_2::StartDrawImage(opvp_int_t sourceWidth,
955
opvp_int_t sourceHeight, opvp_int_t sourcePitch,
956
opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
957
opvp_int_t destinationHeight)
961
OPVP_ImageFormat iformat_0_2;
962
OPVP_PaintMode paintmode_0_2 = OPVP_paintModeTransparent;
965
if (!supportStartDrawImage) {
966
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
969
if (imageFormat == OPVP_IFORMAT_MASK) {
970
if (procs_0_2->GetPaintMode != 0) {
971
procs_0_2->GetPaintMode(printerContext_0_2,
974
if (paintmode_0_2 != OPVP_paintModeTransparent) {
975
if (procs_0_2->SetROP != 0) {
976
procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
980
if (procs_0_2->SetROP != 0) {
981
procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_OR);
986
if (procs_0_2->SetROP != 0) {
987
procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
989
depth = colorDepth_0_2[colorSpace];
992
OPVP_I2FIX(0,rect.p0.x);
993
OPVP_I2FIX(0,rect.p0.y);
994
OPVP_I2FIX(destinationWidth,rect.p1.x);
995
OPVP_I2FIX(destinationHeight,rect.p1.y);
996
if ((unsigned int)imageFormat
997
> sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
998
/* illegal image format */
999
*opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
1002
iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
1003
r = procs_0_2->StartDrawImage(printerContext_0_2,
1004
sourceWidth,sourceHeight,
1005
depth,iformat_0_2,rect);
1007
return (opvp_result_t)r;
1010
opvp_result_t OPVPWrapper_0_2::TransferDrawImage(opvp_int_t count,
1011
const void *imagedata)
1013
if (!supportTransferDrawImage) {
1014
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1017
return (opvp_result_t)procs_0_2->TransferDrawImage(printerContext_0_2,
1018
count,(void *)imagedata);
1021
opvp_result_t OPVPWrapper_0_2::EndDrawImage()
1025
if (!supportEndDrawImage) {
1026
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1029
r = procs_0_2->EndDrawImage(printerContext_0_2);
1031
/* make sure rop is pattern copy */
1032
if (procs_0_2->SetROP != 0) {
1033
procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_P);
1036
return (opvp_result_t)r;
1039
opvp_result_t OPVPWrapper_0_2::StartScanline(opvp_int_t yposition)
1041
if (!supportStartScanline) {
1042
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1045
return (opvp_result_t)procs_0_2->StartScanline(printerContext_0_2,yposition);
1048
opvp_result_t OPVPWrapper_0_2::Scanline(opvp_int_t nscanpairs,
1049
const opvp_int_t *scanpairs)
1051
if (!supportScanline) {
1052
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1055
return (opvp_result_t)procs_0_2->Scanline(printerContext_0_2,
1056
(int)nscanpairs,(int *)scanpairs);
1059
opvp_result_t OPVPWrapper_0_2::EndScanline()
1061
if (!supportEndScanline) {
1062
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1065
return (opvp_result_t)procs_0_2->EndScanline(printerContext_0_2);
1068
opvp_result_t OPVPWrapper_0_2::StartRaster(opvp_int_t rasterWidth)
1070
if (!supportStartRaster) {
1071
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1074
return (opvp_result_t)procs_0_2->StartRaster(printerContext_0_2,rasterWidth);
1077
opvp_result_t OPVPWrapper_0_2::TransferRasterData(opvp_int_t count,
1078
const opvp_byte_t *data)
1080
if (!supportTransferRasterData) {
1081
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1084
return (opvp_result_t)procs_0_2->TransferRasterData(printerContext_0_2,
1085
(int)count, (unsigned char *)data);
1088
opvp_result_t OPVPWrapper_0_2::SkipRaster(opvp_int_t count)
1090
if (!supportSkipRaster) {
1091
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1094
return (opvp_result_t)procs_0_2->SkipRaster(printerContext_0_2,count);
1097
opvp_result_t OPVPWrapper_0_2::EndRaster()
1099
if (!supportEndRaster) {
1100
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1103
return (opvp_result_t)procs_0_2->EndRaster(printerContext_0_2);
1106
opvp_result_t OPVPWrapper_0_2::StartStream()
1108
if (!supportStartStream) {
1109
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1112
return (opvp_result_t)procs_0_2->StartStream(printerContext_0_2);
1115
opvp_result_t OPVPWrapper_0_2::TransferStreamData(opvp_int_t count,
1118
if (!supportTransferStreamData) {
1119
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1122
return (opvp_result_t)procs_0_2->TransferStreamData(printerContext_0_2,
1123
count,(void *)data);
1126
opvp_result_t OPVPWrapper_0_2::EndStream()
1128
if (!supportEndStream) {
1129
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1132
return (opvp_result_t)procs_0_2->EndStream(printerContext_0_2);
1135
opvp_result_t OPVPWrapper_0_2::ResetClipPath()
1137
if (!supportResetClipPath) {
1138
*opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
1141
return (opvp_result_t)procs_0_2->ResetClipPath(printerContext_0_2);
1144
/* translate error code */
1145
opvp_int_t OPVPWrapper_0_2::getErrorNo()
1147
switch(*opvpErrorNo_0_2) {
1148
case OPVP_FATALERROR_0_2:
1149
return OPVP_FATALERROR;
1151
case OPVP_BADREQUEST_0_2:
1152
return OPVP_BADREQUEST;
1154
case OPVP_BADCONTEXT_0_2:
1155
return OPVP_BADCONTEXT;
1157
case OPVP_NOTSUPPORTED_0_2:
1158
return OPVP_NOTSUPPORTED;
1160
case OPVP_JOBCANCELED_0_2:
1161
return OPVP_JOBCANCELED;
1163
case OPVP_PARAMERROR_0_2:
1164
return OPVP_PARAMERROR;
1169
/* unknown error no */
1170
/* return FATALERROR instead */
1171
return OPVP_FATALERROR;