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