blob: b32a32b27cb010e04c639f716be3c3f01d1fe1df [file] [log] [blame]
Dimitrie O. Paun3c770351999-01-01 19:50:40 +00001#ifndef __WINE_PSDRV_H
2#define __WINE_PSDRV_H
Alexandre Julliard767e6f61998-08-09 12:47:43 +00003
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +00004/*
Alexandre Julliard767e6f61998-08-09 12:47:43 +00005 * PostScript driver definitions
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +00006 *
7 * Copyright 1998 Huw D M Davies
8 */
Marcus Meissner317af321999-02-17 13:51:06 +00009#include "wingdi.h"
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000010#include "font.h"
Alexandre Julliarda0d77311998-09-13 16:32:00 +000011#include "pen.h"
12#include "brush.h"
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000013
14typedef struct {
15 float llx, lly, urx, ury;
16} AFMBBOX;
17
18typedef struct _tagAFMLIGS {
19 char *successor;
20 char *ligature;
21 struct _tagAFMLIGS *next;
22} AFMLIGS;
23
24typedef struct _tagAFMMETRICS {
25 int C; /* character */
26 float WX;
27 char *N; /* name */
28 AFMBBOX B;
29 AFMLIGS *L; /* Ligatures */
30 struct _tagAFMMETRICS *next;
31} AFMMETRICS;
32
33typedef struct _tagAFM {
34 char *FontName;
35 char *FullName;
36 char *FamilyName;
Alexandre Julliarda0d77311998-09-13 16:32:00 +000037 char *EncodingScheme;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000038 int Weight; /* FW_NORMAL etc. */
39 float ItalicAngle;
Alexandre Julliarda3960291999-02-26 11:11:13 +000040 BOOL IsFixedPitch;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000041 float UnderlinePosition;
42 float UnderlineThickness;
43 AFMBBOX FontBBox;
44 float CapHeight;
45 float XHeight;
46 float Ascender;
47 float Descender;
Alexandre Julliard767e6f61998-08-09 12:47:43 +000048 float FullAscender; /* Ascent of Aring character */
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000049 float CharWidths[256];
50 int NumofMetrics;
51 AFMMETRICS *Metrics;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000052} AFM; /* CharWidths is a shortcut to the WX values of numbered glyphs */
53
Alexandre Julliard767e6f61998-08-09 12:47:43 +000054/* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
55 one list to exist without having to reallocate the entire AFM structure. We
56 keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
57 fonts for each DC (dc->physDev->Fonts) */
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000058
Alexandre Julliard767e6f61998-08-09 12:47:43 +000059typedef struct _tagAFMLISTENTRY {
60 AFM *afm;
61 struct _tagAFMLISTENTRY *next;
62} AFMLISTENTRY;
63
64typedef struct _tagFONTFAMILY {
65 char *FamilyName; /* family name */
66 AFMLISTENTRY *afmlist; /* list of afms for this family */
67 struct _tagFONTFAMILY *next; /* next family */
68} FONTFAMILY;
69
70extern FONTFAMILY *PSDRV_AFMFontList;
71
72typedef struct _tagFONTNAME {
73 char *Name;
74 struct _tagFONTNAME *next;
75} FONTNAME;
76
77typedef struct {
78 float llx, lly, urx, ury;
79} IMAGEABLEAREA;
80
81typedef struct {
82 float x, y;
83} PAPERDIMENSION;
84
85typedef struct _tagPAGESIZE {
86 char *Name;
87 char *FullName;
88 char *InvocationString;
89 IMAGEABLEAREA *ImageableArea;
90 PAPERDIMENSION *PaperDimension;
91 WORD WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
92 struct _tagPAGESIZE *next;
93} PAGESIZE;
94
95
96typedef struct _tagOPTIONENTRY {
97 char *Name; /* eg "True" */
98 char *FullName; /* eg "Installed" */
99 char *InvocationString; /* Often NULL */
100 struct _tagOPTIONENTRY *next;
101} OPTIONENTRY;
102
103typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
104 char *OptionName; /* eg "*Option1" */
105 char *FullName; /* eg "Envelope Feeder" */
106 char *DefaultOption; /* eg "False" */
107 OPTIONENTRY *Options;
108 struct _tagOPTION *next;
109} OPTION;
110
111typedef struct _tagCONSTRAINT {
112 char *Feature1;
113 char *Value1;
114 char *Feature2;
115 char *Value2;
116 struct _tagCONSTRAINT *next;
117} CONSTRAINT;
118
119typedef struct _tagINPUTSLOT {
120 char *Name;
121 char *FullName;
122 char *InvocationString;
123 WORD WinBin; /* eg DMBIN_LOWER */
124 struct _tagINPUTSLOT *next;
125} INPUTSLOT;
126
127typedef struct {
128 char *NickName;
129 int LanguageLevel;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000130 BOOL ColorDevice;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000131 int DefaultResolution;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000132 signed int LandscapeOrientation;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000133 char *JCLBegin;
134 char *JCLToPSInterpreter;
135 char *JCLEnd;
136 char *DefaultFont;
137 FONTNAME *InstalledFonts; /* ptr to a list of FontNames */
138 PAGESIZE *PageSizes;
139 OPTION *InstalledOptions;
140 CONSTRAINT *Constraints;
141 INPUTSLOT *InputSlots;
142} PPD;
143
144typedef struct {
145 DEVMODE16 dmPublic;
146 struct _tagdocprivate {
Patrik Stridvall896889f1999-05-08 12:50:36 +0000147 int dummy;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000148 } dmDocPrivate;
149 struct _tagdrvprivate {
150 char ppdFileName[100]; /* Hack */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000151 UINT numInstalledOptions; /* Options at end of struct */
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000152 } dmDrvPrivate;
153
154/* Now comes:
155
156numInstalledOptions of OPTIONs
157
158*/
159
160} PSDRV_DEVMODE16;
161
162typedef struct _tagPI {
163 char *FriendlyName;
164 PPD *ppd;
165 PSDRV_DEVMODE16 *Devmode;
166 FONTFAMILY *Fonts;
167 struct _tagPI *next;
168} PRINTERINFO;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000169
170typedef struct {
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000171 float r, g, b;
172} PSRGB;
173
174typedef struct {
175 float i;
176} PSGRAY;
177
178
179/* def's for PSCOLOR.type */
180#define PSCOLOR_GRAY 0
181#define PSCOLOR_RGB 1
182
183typedef struct {
184 int type;
185 union {
186 PSRGB rgb;
187 PSGRAY gray;
188 } value;
189} PSCOLOR;
190
191typedef struct {
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000192 AFM *afm;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000193 TEXTMETRICA tm;
194 INT size;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000195 float scale;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000196 INT escapement;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000197 PSCOLOR color;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000198 BOOL set; /* Have we done a setfont yet */
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000199} PSFONT;
200
201typedef struct {
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000202 PSCOLOR color;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000203 BOOL set;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000204} PSBRUSH;
205
206typedef struct {
Alexandre Julliarda3960291999-02-26 11:11:13 +0000207 INT width;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000208 char *dash;
209 PSCOLOR color;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000210 BOOL set;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000211} PSPEN;
212
213typedef struct {
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000214 HANDLE16 hJob;
215 LPSTR output; /* Output file/port */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000216 BOOL banding; /* Have we received a NEXTBAND */
217 BOOL NeedPageHeader; /* Page header not sent yet */
218 INT PageNo;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000219} JOB;
220
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000221typedef struct {
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000222 PSFONT font; /* Current PS font */
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000223 PSPEN pen;
224 PSBRUSH brush;
225 PSCOLOR bkColor;
226 PSCOLOR inkColor; /* Last colour set */
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000227 JOB job;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000228 PSDRV_DEVMODE16 *Devmode;
229 PRINTERINFO *pi;
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000230} PSDRV_PDEVICE;
231
Alexandre Julliarda3960291999-02-26 11:11:13 +0000232extern HANDLE PSDRV_Heap;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000233extern char *PSDRV_ANSIVector[256];
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000234
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000235extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE16 *dm1, PSDRV_DEVMODE16 *dm2,
236 PRINTERINFO *pi);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000237extern BOOL PSDRV_GetFontMetrics(void);
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000238extern PPD *PSDRV_ParsePPD(char *fname);
239extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
240extern AFM *PSDRV_FindAFMinList(FONTFAMILY *head, char *name);
241extern void PSDRV_AddAFMtoList(FONTFAMILY **head, AFM *afm);
242extern void PSDRV_FreeAFMList( FONTFAMILY *head );
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000243
Alexandre Julliarda3960291999-02-26 11:11:13 +0000244extern BOOL PSDRV_Init(void);
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000245extern HFONT16 PSDRV_FONT_SelectObject( DC *dc, HFONT16 hfont, FONTOBJ *font);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000246extern HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
247extern HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000248 BRUSHOBJ * brush );
249
Alexandre Julliarda3960291999-02-26 11:11:13 +0000250extern BOOL PSDRV_Brush(DC *dc, BOOL EO);
251extern BOOL PSDRV_SetFont( DC *dc );
252extern BOOL PSDRV_SetPen( DC *dc );
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000253
Alexandre Julliarda3960291999-02-26 11:11:13 +0000254extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
255extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000256extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
257 COLORREF wincolor );
258
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000259
Alexandre Julliarda3960291999-02-26 11:11:13 +0000260extern INT PSDRV_WriteHeader( DC *dc, char *title, int len );
261extern INT PSDRV_WriteFooter( DC *dc );
262extern INT PSDRV_WriteNewPage( DC *dc );
263extern INT PSDRV_WriteEndPage( DC *dc );
264extern BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y);
265extern BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y);
266extern BOOL PSDRV_WriteStroke(DC *dc);
267extern BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width,
268 INT height);
269extern BOOL PSDRV_WriteSetFont(DC *dc, BOOL UseANSI);
270extern BOOL PSDRV_WriteShow(DC *dc, char *str, INT count);
271extern BOOL PSDRV_WriteReencodeFont(DC *dc);
272extern BOOL PSDRV_WriteSetPen(DC *dc);
273extern BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h,
Huw D M Davies14c99d01998-10-24 10:44:05 +0000274 double ang1, double ang2);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000275extern BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color);
276extern BOOL PSDRV_WriteSetBrush(DC *dc);
277extern BOOL PSDRV_WriteFill(DC *dc);
278extern BOOL PSDRV_WriteEOFill(DC *dc);
279extern BOOL PSDRV_WriteGSave(DC *dc);
280extern BOOL PSDRV_WriteGRestore(DC *dc);
281extern BOOL PSDRV_WriteClosePath(DC *dc);
282extern BOOL PSDRV_WriteClip(DC *dc);
283extern BOOL PSDRV_WriteEOClip(DC *dc);
284extern BOOL PSDRV_WriteHatch(DC *dc);
285extern BOOL PSDRV_WriteRotate(DC *dc, float ang);
Huw D M Davies44a79c41999-03-23 13:46:04 +0000286extern BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size);
287extern BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc);
288extern BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number);
289extern BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
290 INT widthDst, INT heightDst, INT widthSrc,
291 INT heightSrc);
292extern BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number);
293extern BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number);
294extern BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number);
295extern BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number);
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000296
297
298
Alexandre Julliarda3960291999-02-26 11:11:13 +0000299extern BOOL PSDRV_Arc( DC *dc, INT left, INT top, INT right,
300 INT bottom, INT xstart, INT ystart,
301 INT xend, INT yend );
302extern BOOL PSDRV_Chord( DC *dc, INT left, INT top, INT right,
303 INT bottom, INT xstart, INT ystart,
304 INT xend, INT yend );
305extern BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right,
306 INT bottom );
307extern BOOL PSDRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf,
Huw D M Davies14c99d01998-10-24 10:44:05 +0000308 DEVICEFONTENUMPROC proc, LPARAM lp );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000309extern INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput,
Huw D M Davies14c99d01998-10-24 10:44:05 +0000310 SEGPTR lpInData, SEGPTR lpOutData );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000311extern BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
312 const RECT *lprect, LPCSTR str, UINT count,
313 const INT *lpDx );
314extern BOOL PSDRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar,
315 LPINT buffer );
316extern BOOL PSDRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT count,
317 LPSIZE size );
318extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICA *metrics );
319extern BOOL PSDRV_LineTo( DC *dc, INT x, INT y );
320extern BOOL PSDRV_MoveToEx( DC *dc, INT x, INT y, LPPOINT pt );
321extern BOOL PSDRV_Pie( DC *dc, INT left, INT top, INT right,
322 INT bottom, INT xstart, INT ystart,
323 INT xend, INT yend );
324extern BOOL PSDRV_Polygon( DC *dc, const POINT* pt, INT count );
325extern BOOL PSDRV_Polyline( DC *dc, const POINT* pt, INT count );
326extern BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts,
327 UINT polygons );
328extern BOOL PSDRV_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts,
Huw D M Davies14c99d01998-10-24 10:44:05 +0000329 DWORD polylines );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000330extern BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right,
331 INT bottom );
332extern BOOL PSDRV_RoundRect(DC *dc, INT left, INT top, INT right,
333 INT bottom, INT ell_width, INT ell_height);
334extern HGDIOBJ PSDRV_SelectObject( DC *dc, HGDIOBJ handle );
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000335extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000336extern COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color );
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000337extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000338extern INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst,
339 INT widthDst, INT heightDst, INT xSrc,
340 INT ySrc, INT widthSrc, INT heightSrc,
Huw D M Davies14c99d01998-10-24 10:44:05 +0000341 const void *bits, const BITMAPINFO *info,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000342 UINT wUsage, DWORD dwRop );
Huw D M Davies14c99d01998-10-24 10:44:05 +0000343
Dimitrie O. Paun3c770351999-01-01 19:50:40 +0000344#endif
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000345
346