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 /* $Id: opvp_0_2_0.h 85 2007-02-15 08:48:56Z sho-otani $ */ 26 /* opvp_common.h ver.1.00 rel.1.0 26 Nov 2004 */ 27 /* OpenPrinting Vector Printer Driver Glue Code */ 28 29 #ifndef _FSGPD_0_2_0_H 30 #define _FSGPD_0_2_0_H 31 32 #define _PDAPI_VERSION_MAJOR_ 0 33 #define _PDAPI_VERSION_MINOR_ 2 34 35 /* Return Values */ 36 #define OPVP_OK 0 /* error is -1 */ 37 38 /* Error Codes */ 39 #define OPVP_FATALERROR -101 /* unrecoverable error occurred within the */ 40 /* library */ 41 #define OPVP_BADREQUEST -102 /* invalid function parameters */ 42 #define OPVP_BADCONTEXT -103 /* bad parameter precontext */ 43 #define OPVP_NOTSUPPORTED -104 /* printer or driver request not supported */ 44 #define OPVP_JOBCANCELED -105 /* job cancelled */ 45 #define OPVP_PARAMERROR -106 /* illegal parameter combination */ 46 47 /* Info params */ 48 #define OPVP_INFO_PREFIX "updf:" 49 50 /* Fix */ 51 #define OPVP_FIX_FRACT_WIDTH 8 52 #define OPVP_FIX_FRACT_DENOM (1<<OPVP_FIX_FRACT_WIDTH) 53 #define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH) 54 #if 0 55 typedef struct { 56 unsigned int fract : OPVP_FIX_FRACT_WIDTH; 57 signed int floor : OPVP_FIX_FLOOR_WIDTH; 58 } OPVP_Fix; 59 #define OPVP_i2Fix(i,fix) (fix.fract=0,fix.floor=i) 60 #define OPVP_Fix2f(fix,f) (f=(double)fix.floor\ 61 +(double)(fix.fract)/OPVP_FIX_FRACT_DENOM) 62 #define OPVP_f2Fix(f,fix) (fix.fract=(f-floor(f))*OPVP_FIX_FRACT_DENOM,\ 63 fix.floor=floor(f)) 64 #else 65 typedef int OPVP_Fix; 66 #define OPVP_i2Fix(i,fix) (fix=i<<8) 67 #define OPVP_f2Fix(f,fix) (fix=((int)floor(f)<<8)\ 68 |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\ 69 &0x000000ff)) 70 #endif 71 72 /* Basic Types */ 73 typedef struct _OPVP_Point { 74 OPVP_Fix x; 75 OPVP_Fix y; 76 } OPVP_Point; 77 78 typedef struct _OPVP_Rectangle { 79 OPVP_Point p0; /* start point */ 80 OPVP_Point p1; /* end point */ 81 } OPVP_Rectangle; 82 83 typedef struct _OPVP_RoundRectangle { 84 OPVP_Point p0; /* start point */ 85 OPVP_Point p1; /* end point */ 86 OPVP_Fix xellipse; 87 OPVP_Fix yellipse; 88 } OPVP_RoundRectangle; 89 90 /* Image Formats */ 91 typedef enum _OPVP_ImageFormat { 92 OPVP_iformatRaw = 0, 93 OPVP_iformatRLE = 1, 94 OPVP_iformatJPEG = 2, 95 OPVP_iformatPNG = 3 96 } OPVP_ImageFormat; 97 98 /* Color Presentation */ 99 typedef enum _OPVP_ColorMapping { 100 OPVP_cmapDirect = 0, 101 OPVP_cmapIndexed = 1 102 } OPVP_ColorMapping; 103 104 typedef enum _OPVP_ColorSpace { 105 OPVP_cspaceBW = 0, 106 OPVP_cspaceDeviceGray = 1, 107 OPVP_cspaceDeviceCMY = 2, 108 OPVP_cspaceDeviceCMYK = 3, 109 OPVP_cspaceDeviceRGB = 4, 110 OPVP_cspaceStandardRGB = 5, 111 OPVP_cspaceStandardRGB64 = 6 112 } OPVP_ColorSpace; 113 114 /* Raster Operation modes */ 115 typedef enum _OPVP_ROP { 116 OPVP_ropPset = 0, 117 OPVP_ropPreset = 1, 118 OPVP_ropOr = 2, 119 OPVP_ropAnd = 3, 120 OPVP_ropXor = 4 121 } OPVP_ROP; 122 123 /* Fill, Paint, Clip */ 124 typedef enum _OPVP_FillMode { 125 OPVP_fillModeEvenOdd = 0, 126 OPVP_fillModeWinding = 1 127 } OPVP_FillMode; 128 129 typedef enum _OPVP_PaintMode { 130 OPVP_paintModeOpaque = 0, 131 OPVP_paintModeTransparent = 1 132 } OPVP_PaintMode; 133 134 typedef enum _OPVP_ClipRule { 135 OPVP_clipRuleEvenOdd = 0, 136 OPVP_clipRuleWinding = 1 137 } OPVP_ClipRule; 138 139 /* Line */ 140 typedef enum _OPVP_LineStyle { 141 OPVP_lineStyleSolid = 0, 142 OPVP_lineStyleDash = 1 143 } OPVP_LineStyle; 144 145 typedef enum _OPVP_LineCap { 146 OPVP_lineCapButt = 0, 147 OPVP_lineCapRound = 1, 148 OPVP_lineCapSquare = 2 149 } OPVP_LineCap; 150 151 typedef enum _OPVP_LineJoin { 152 OPVP_lineJoinMiter = 0, 153 OPVP_lineJoinRound = 1, 154 OPVP_lineJoinBevel = 2 155 } OPVP_LineJoin; 156 157 /* Brush */ 158 typedef enum _OPVP_BrushDataType { 159 OPVP_bdtypeNormal = 0 160 } OPVP_BrushDataType; 161 162 typedef struct _OPVP_BrushData { 163 OPVP_BrushDataType type; 164 int width; 165 int height; 166 int pitch; 167 #if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2) 168 void *data; /* pointer to actual data */ 169 #else 170 char data[1]; 171 #endif 172 } OPVP_BrushData; 173 174 typedef struct _OPVP_Brush { 175 OPVP_ColorSpace colorSpace; 176 int color[4]; /* aRGB quadruplet */ 177 #if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2) 178 OPVP_BrushData *pbrush; /* pointer to brush data */ 179 /* solid brush used, if null */ 180 int xorg; /* brush origin */ 181 int yorg; /* ignored for SetBgColor */ 182 #else 183 int xorg; /* brush origin */ 184 int yorg; /* ignored for SetBgColor */ 185 OPVP_BrushData *pbrush; /* pointer to brush data */ 186 /* solid brush used, if null */ 187 #endif 188 } OPVP_Brush; 189 190 /* Misc. Flags */ 191 #define OPVP_Arc 0 /* circular arc */ 192 #define OPVP_Chord 1 /* arch */ 193 #define OPVP_Pie 2 /* pie section */ 194 #define OPVP_Clockwise 0 /* clockwise */ 195 #define OPVP_Counterclockwise 1 /* counter-clockwise */ 196 #define OPVP_PathClose 0 /* Close path when using LinePath */ 197 #define OPVP_PathOpen 1 /* Do not close path when using LinePath */ 198 199 /* CTM */ 200 typedef struct _OPVP_CTM { 201 float a; 202 float b; 203 float c; 204 float d; 205 float e; 206 float f; 207 } OPVP_CTM; 208 209 /* Vector Driver API Proc. Entries */ 210 typedef struct _OPVP_api_procs { 211 int (*OpenPrinter)(int,char *,int *,struct _OPVP_api_procs **); 212 int (*ClosePrinter)(int); 213 int (*StartJob)(int,char *); 214 int (*EndJob)(int); 215 int (*StartDoc)(int,char *); 216 int (*EndDoc)(int); 217 int (*StartPage)(int,char *); 218 int (*EndPage)(int); 219 #if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2) 220 int (*QueryDeviceCapability)(int,int,int,char *); 221 int (*QueryDeviceInfo)(int,int,int,char *); 222 #endif 223 int (*ResetCTM)(int); 224 int (*SetCTM)(int,OPVP_CTM *); 225 int (*GetCTM)(int,OPVP_CTM *); 226 int (*InitGS)(int); 227 int (*SaveGS)(int); 228 int (*RestoreGS)(int); 229 int (*QueryColorSpace)(int,OPVP_ColorSpace *,int *); 230 int (*SetColorSpace)(int,OPVP_ColorSpace); 231 int (*GetColorSpace)(int,OPVP_ColorSpace *); 232 int (*QueryROP)(int,int *,int *); 233 int (*SetROP)(int,int); 234 int (*GetROP)(int,int *); 235 int (*SetFillMode)(int,OPVP_FillMode); 236 int (*GetFillMode)(int,OPVP_FillMode *); 237 int (*SetAlphaConstant)(int,float); 238 int (*GetAlphaConstant)(int,float *); 239 int (*SetLineWidth)(int,OPVP_Fix); 240 int (*GetLineWidth)(int,OPVP_Fix *); 241 int (*SetLineDash)(int,OPVP_Fix *,int); 242 int (*GetLineDash)(int,OPVP_Fix *,int *); 243 int (*SetLineDashOffset)(int,OPVP_Fix); 244 int (*GetLineDashOffset)(int,OPVP_Fix *); 245 int (*SetLineStyle)(int,OPVP_LineStyle); 246 int (*GetLineStyle)(int,OPVP_LineStyle *); 247 int (*SetLineCap)(int,OPVP_LineCap); 248 int (*GetLineCap)(int,OPVP_LineCap *); 249 int (*SetLineJoin)(int,OPVP_LineJoin); 250 int (*GetLineJoin)(int,OPVP_LineJoin *); 251 int (*SetMiterLimit)(int,OPVP_Fix); 252 int (*GetMiterLimit)(int,OPVP_Fix *); 253 int (*SetPaintMode)(int,OPVP_PaintMode); 254 int (*GetPaintMode)(int,OPVP_PaintMode *); 255 int (*SetStrokeColor)(int,OPVP_Brush *); 256 int (*SetFillColor)(int,OPVP_Brush *); 257 int (*SetBgColor)(int,OPVP_Brush *); 258 int (*NewPath)(int); 259 int (*EndPath)(int); 260 int (*StrokePath)(int); 261 int (*FillPath)(int); 262 int (*StrokeFillPath)(int); 263 int (*SetClipPath)(int,OPVP_ClipRule); 264 #if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2) 265 int (*ResetClipPath)(int); 266 #endif 267 int (*SetCurrentPoint)(int,OPVP_Fix,OPVP_Fix); 268 int (*LinePath)(int,int,int,OPVP_Point *); 269 int (*PolygonPath)(int,int,int *,OPVP_Point *); 270 int (*RectanglePath)(int,int,OPVP_Rectangle *); 271 int (*RoundRectanglePath)(int,int,OPVP_RoundRectangle *); 272 #if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2) 273 int (*BezierPath)(int,int *,OPVP_Point *); 274 #else 275 int (*BezierPath)(int,int,OPVP_Point *); 276 #endif 277 int (*ArcPath)(int,int,int,OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix, 278 OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix); 279 int (*DrawBitmapText)(int,int,int,int,void *); 280 int (*DrawImage)(int,int,int,int, 281 OPVP_ImageFormat,OPVP_Rectangle,int,void *); 282 int (*StartDrawImage)(int,int,int,int, 283 OPVP_ImageFormat,OPVP_Rectangle); 284 int (*TransferDrawImage)(int,int,void *); 285 int (*EndDrawImage)(int); 286 int (*StartScanline)(int,int); 287 int (*Scanline)(int,int,int *); 288 int (*EndScanline)(int); 289 int (*StartRaster)(int,int); 290 int (*TransferRasterData)(int,int,unsigned char *); 291 int (*SkipRaster)(int,int); 292 int (*EndRaster)(int); 293 int (*StartStream)(int); 294 int (*TransferStreamData)(int,int,void *); 295 int (*EndStream)(int); 296 } OPVP_api_procs; 297 298 #endif /* _OPVP_COMMON_H_ */ 299 300