-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopvp_common.h
303 lines (271 loc) · 8.91 KB
/
opvp_common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/*
Copyright (c) 2003-2006, AXE, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* $Id: opvp_common.h,v 1.4 2005/06/10 16:53:36 gishi Exp $ */
/* opvp_common.h ver.1.00 rel.1.0 26 Nov 2004 */
/* OpenPrinting Vector Printer Driver Glue Code */
#ifndef _OPVP_COMMON_H_
#define _OPVP_COMMON_H_
#define _PDAPI_VERSION_MAJOR_ 0
#define _PDAPI_VERSION_MINOR_ 2
/* Return Values */
#define OPVP_OK 0 /* エラーは -1 */
/* Error Codes */
#define OPVP_FATALERROR -101 /* ライブラリ内で復旧不可能なエラーが */
/* 発生した */
#define OPVP_BADREQUEST -102 /* 関数を呼んではいけないところで、 */
/* 呼んでしまった */
#define OPVP_BADCONTEXT -103 /* パラメータのプリコンテキストが不正 */
#define OPVP_NOTSUPPORTED -104 /* パラメータの組み合わせにより、 */
/* ドライバもしくはプリンタが */
/* 扱えないリクエストが行なわれた */
#define OPVP_JOBCANCELED -105 /* 何らかの要因により、ジョブを */
/* キャンセルしている */
#define OPVP_PARAMERROR -106 /* パラメータの組み合わせが不正 */
/* Info params */
#define OPVP_INFO_PREFIX "updf:"
/* Fix */
#define OPVP_FIX_FRACT_WIDTH 8
#define OPVP_FIX_FRACT_DENOM (1<<OPVP_FIX_FRACT_WIDTH)
#define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH)
#if 0
typedef struct {
unsigned int fract : OPVP_FIX_FRACT_WIDTH;
signed int floor : OPVP_FIX_FLOOR_WIDTH;
} OPVP_Fix;
#define OPVP_i2Fix(i,fix) (fix.fract=0,fix.floor=i)
#define OPVP_Fix2f(fix,f) (f=(double)fix.floor\
+(double)(fix.fract)/OPVP_FIX_FRACT_DENOM)
#define OPVP_f2Fix(f,fix) (fix.fract=(f-floor(f))*OPVP_FIX_FRACT_DENOM,\
fix.floor=floor(f))
#else
typedef int OPVP_Fix;
#define OPVP_i2Fix(i,fix) (fix=i<<8)
#define OPVP_f2Fix(f,fix) (fix=((int)floor(f)<<8)\
|((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
&0x000000ff))
#endif
/* Basic Types */
typedef struct _OPVP_Point {
OPVP_Fix x;
OPVP_Fix y;
} OPVP_Point;
typedef struct _OPVP_Rectangle {
OPVP_Point p0; /* 開始点 */
OPVP_Point p1; /* 終了点 */
} OPVP_Rectangle;
typedef struct _OPVP_RoundRectangle {
OPVP_Point p0; /* 開始点 */
OPVP_Point p1; /* 終了点 */
OPVP_Fix xellipse;
OPVP_Fix yellipse;
} OPVP_RoundRectangle;
/* Image Formats */
typedef enum _OPVP_ImageFormat {
OPVP_iformatRaw = 0,
OPVP_iformatRLE = 1,
OPVP_iformatJPEG = 2,
OPVP_iformatPNG = 3
} OPVP_ImageFormat;
/* Color Presentation */
typedef enum _OPVP_ColorMapping {
OPVP_cmapDirect = 0,
OPVP_cmapIndexed = 1
} OPVP_ColorMapping;
typedef enum _OPVP_ColorSpace {
OPVP_cspaceBW = 0,
OPVP_cspaceDeviceGray = 1,
OPVP_cspaceDeviceCMY = 2,
OPVP_cspaceDeviceCMYK = 3,
OPVP_cspaceDeviceRGB = 4,
OPVP_cspaceStandardRGB = 5,
OPVP_cspaceStandardRGB64 = 6
} OPVP_ColorSpace;
/* Raster Operation modes */
typedef enum _OPVP_ROP {
OPVP_ropPset = 0,
OPVP_ropPreset = 1,
OPVP_ropOr = 2,
OPVP_ropAnd = 3,
OPVP_ropXor = 4
} OPVP_ROP;
/* Fill, Paint, Clip */
typedef enum _OPVP_FillMode {
OPVP_fillModeEvenOdd = 0,
OPVP_fillModeWinding = 1
} OPVP_FillMode;
typedef enum _OPVP_PaintMode {
OPVP_paintModeOpaque = 0,
OPVP_paintModeTransparent = 1
} OPVP_PaintMode;
typedef enum _OPVP_ClipRule {
OPVP_clipRuleEvenOdd = 0,
OPVP_clipRuleWinding = 1
} OPVP_ClipRule;
/* Line */
typedef enum _OPVP_LineStyle {
OPVP_lineStyleSolid = 0,
OPVP_lineStyleDash = 1
} OPVP_LineStyle;
typedef enum _OPVP_LineCap {
OPVP_lineCapButt = 0,
OPVP_lineCapRound = 1,
OPVP_lineCapSquare = 2
} OPVP_LineCap;
typedef enum _OPVP_LineJoin {
OPVP_lineJoinMiter = 0,
OPVP_lineJoinRound = 1,
OPVP_lineJoinBevel = 2
} OPVP_LineJoin;
/* Brush */
typedef enum _OPVP_BrushDataType {
OPVP_bdtypeNormal = 0
} OPVP_BrushDataType;
typedef struct _OPVP_BrushData {
OPVP_BrushDataType type;
int width;
int height;
int pitch;
#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
void *data; /* pointer to actual data */
#else
char data[1];
#endif
} OPVP_BrushData;
typedef struct _OPVP_Brush {
OPVP_ColorSpace colorSpace;
int color[4]; /* aRGB quadruplet */
#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
OPVP_BrushData *pbrush; /* pointer to brush data */
/* solid brush used, if null */
int xorg; /* brush origin */
int yorg; /* ignored for SetBgColor */
#else
int xorg; /* brush origin */
int yorg; /* ignored for SetBgColor */
OPVP_BrushData *pbrush; /* pointer to brush data */
/* solid brush used, if null */
#endif
} OPVP_Brush;
/* Misc. Flags */
#define OPVP_Arc 0 /* 円弧 */
#define OPVP_Chord 1 /* 弓形 */
#define OPVP_Pie 2 /* 扇形 */
#define OPVP_Clockwise 0 /* 時計方向 */
#define OPVP_Counterclockwise 1 /* 反時計方向 */
#define OPVP_PathClose 0 /* Close path upon LinePath */
#define OPVP_PathOpen 1 /* Do not close path upon LinePath */
/* CTM */
typedef struct _OPVP_CTM {
float a;
float b;
float c;
float d;
float e;
float f;
} OPVP_CTM;
/* Vector Driver API Proc. Entries */
typedef struct _OPVP_api_procs {
int (*OpenPrinter)(int,char *,int *,struct _OPVP_api_procs **);
int (*ClosePrinter)(int);
int (*StartJob)(int,char *);
int (*EndJob)(int);
int (*StartDoc)(int,char *);
int (*EndDoc)(int);
int (*StartPage)(int,char *);
int (*EndPage)(int);
#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
int (*QueryDeviceCapability)(int,int,int,char *);
int (*QueryDeviceInfo)(int,int,int,char *);
#endif
int (*ResetCTM)(int);
int (*SetCTM)(int,OPVP_CTM *);
int (*GetCTM)(int,OPVP_CTM *);
int (*InitGS)(int);
int (*SaveGS)(int);
int (*RestoreGS)(int);
int (*QueryColorSpace)(int,OPVP_ColorSpace *,int *);
int (*SetColorSpace)(int,OPVP_ColorSpace);
int (*GetColorSpace)(int,OPVP_ColorSpace *);
int (*QueryROP)(int,int *,int *);
int (*SetROP)(int,int);
int (*GetROP)(int,int *);
int (*SetFillMode)(int,OPVP_FillMode);
int (*GetFillMode)(int,OPVP_FillMode *);
int (*SetAlphaConstant)(int,float);
int (*GetAlphaConstant)(int,float *);
int (*SetLineWidth)(int,OPVP_Fix);
int (*GetLineWidth)(int,OPVP_Fix *);
int (*SetLineDash)(int,OPVP_Fix *,int);
int (*GetLineDash)(int,OPVP_Fix *,int *);
int (*SetLineDashOffset)(int,OPVP_Fix);
int (*GetLineDashOffset)(int,OPVP_Fix *);
int (*SetLineStyle)(int,OPVP_LineStyle);
int (*GetLineStyle)(int,OPVP_LineStyle *);
int (*SetLineCap)(int,OPVP_LineCap);
int (*GetLineCap)(int,OPVP_LineCap *);
int (*SetLineJoin)(int,OPVP_LineJoin);
int (*GetLineJoin)(int,OPVP_LineJoin *);
int (*SetMiterLimit)(int,OPVP_Fix);
int (*GetMiterLimit)(int,OPVP_Fix *);
int (*SetPaintMode)(int,OPVP_PaintMode);
int (*GetPaintMode)(int,OPVP_PaintMode *);
int (*SetStrokeColor)(int,OPVP_Brush *);
int (*SetFillColor)(int,OPVP_Brush *);
int (*SetBgColor)(int,OPVP_Brush *);
int (*NewPath)(int);
int (*EndPath)(int);
int (*StrokePath)(int);
int (*FillPath)(int);
int (*StrokeFillPath)(int);
int (*SetClipPath)(int,OPVP_ClipRule);
#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
int (*ResetClipPath)(int);
#endif
int (*SetCurrentPoint)(int,OPVP_Fix,OPVP_Fix);
int (*LinePath)(int,int,int,OPVP_Point *);
int (*PolygonPath)(int,int,int *,OPVP_Point *);
int (*RectanglePath)(int,int,OPVP_Rectangle *);
int (*RoundRectanglePath)(int,int,OPVP_RoundRectangle *);
#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
int (*BezierPath)(int,int *,OPVP_Point *);
#else
int (*BezierPath)(int,int,OPVP_Point *);
#endif
int (*ArcPath)(int,int,int,OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix,
OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix);
int (*DrawBitmapText)(int,int,int,int,void *);
int (*DrawImage)(int,int,int,int,
OPVP_ImageFormat,OPVP_Rectangle,int,void *);
int (*StartDrawImage)(int,int,int,int,
OPVP_ImageFormat,OPVP_Rectangle);
int (*TransferDrawImage)(int,int,void *);
int (*EndDrawImage)(int);
int (*StartScanline)(int,int);
int (*Scanline)(int,int,int *);
int (*EndScanline)(int);
int (*StartRaster)(int,int);
int (*TransferRasterData)(int,int,unsigned char *);
int (*SkipRaster)(int,int);
int (*EndRaster)(int);
int (*StartStream)(int);
int (*TransferStreamData)(int,int,void *);
int (*EndStream)(int);
} OPVP_api_procs;
#endif /* _OPVP_COMMON_H_ */