1st cut implementation of DdeInitialize32W and supporting code.
[wine] / include / psdrv.h
1 #ifndef __WINE_PSDRV_H
2 #define __WINE_PSDRV_H
3
4 /*
5  *      PostScript driver definitions
6  *
7  *      Copyright 1998  Huw D M Davies
8  */
9 #include "windows.h"
10 #include "font.h"
11 #include "pen.h"
12 #include "brush.h"
13
14 typedef struct {
15     float       llx, lly, urx, ury;
16 } AFMBBOX;
17
18 typedef struct _tagAFMLIGS {
19     char                *successor;
20     char                *ligature;
21     struct _tagAFMLIGS  *next;
22 } AFMLIGS;
23
24 typedef 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
33 typedef struct _tagAFM {
34     char                *FontName;
35     char                *FullName;
36     char                *FamilyName;
37     char                *EncodingScheme;
38     int                 Weight;                 /* FW_NORMAL etc. */
39     float               ItalicAngle;
40     BOOL32              IsFixedPitch;
41     float               UnderlinePosition;
42     float               UnderlineThickness;
43     AFMBBOX             FontBBox;
44     float               CapHeight;
45     float               XHeight;
46     float               Ascender;
47     float               Descender;
48     float               FullAscender;           /* Ascent of Aring character */
49     float               CharWidths[256];
50     int                 NumofMetrics;
51     AFMMETRICS          *Metrics;
52 } AFM; /* CharWidths is a shortcut to the WX values of numbered glyphs */
53
54 /* 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) */
58
59 typedef struct _tagAFMLISTENTRY {
60     AFM                         *afm;
61     struct _tagAFMLISTENTRY     *next;
62 } AFMLISTENTRY;
63
64 typedef 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
70 extern FONTFAMILY *PSDRV_AFMFontList;
71
72 typedef struct _tagFONTNAME {
73     char                *Name;
74     struct _tagFONTNAME *next;
75 } FONTNAME;
76
77 typedef struct {
78     float       llx, lly, urx, ury;
79 } IMAGEABLEAREA;
80
81 typedef struct {
82     float       x, y;
83 } PAPERDIMENSION;
84
85 typedef 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
96 typedef struct _tagOPTIONENTRY {
97     char                        *Name;          /* eg "True" */
98     char                        *FullName;      /* eg "Installed" */
99     char                        *InvocationString; /* Often NULL */
100     struct _tagOPTIONENTRY      *next;
101 } OPTIONENTRY;
102
103 typedef 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
111 typedef struct _tagCONSTRAINT {
112     char                        *Feature1;
113     char                        *Value1;
114     char                        *Feature2;
115     char                        *Value2;
116     struct _tagCONSTRAINT       *next;
117 } CONSTRAINT;
118
119 typedef struct _tagINPUTSLOT {
120     char                        *Name;
121     char                        *FullName;
122     char                        *InvocationString;
123     WORD                        WinBin; /* eg DMBIN_LOWER */
124     struct _tagINPUTSLOT        *next;
125 } INPUTSLOT;
126
127 typedef struct {
128     char                *NickName;
129     int                 LanguageLevel;
130     BOOL32              ColorDevice;
131     int                 DefaultResolution;
132     signed int          LandscapeOrientation;
133     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
144 typedef struct {
145     DEVMODE16                   dmPublic;
146     struct _tagdocprivate {
147     }                           dmDocPrivate;
148     struct _tagdrvprivate {
149       char      ppdFileName[100]; /* Hack */
150       UINT32    numInstalledOptions; /* Options at end of struct */
151     }                           dmDrvPrivate;
152
153 /* Now comes:
154
155 numInstalledOptions of OPTIONs
156
157 */
158
159 } PSDRV_DEVMODE16;
160
161 typedef struct _tagPI {
162     char                *FriendlyName;
163     PPD                 *ppd;
164     PSDRV_DEVMODE16     *Devmode;
165     FONTFAMILY          *Fonts;
166     struct _tagPI       *next;
167 } PRINTERINFO;
168
169 typedef struct {
170     float               r, g, b;
171 } PSRGB;
172
173 typedef struct {
174     float               i;
175 } PSGRAY;
176
177
178 /* def's for PSCOLOR.type */
179 #define PSCOLOR_GRAY    0
180 #define PSCOLOR_RGB     1
181
182 typedef struct {
183     int                 type;
184     union {
185         PSRGB  rgb;
186         PSGRAY gray;
187     }                   value;
188 } PSCOLOR;
189
190 typedef struct {
191     AFM                 *afm;
192     TEXTMETRIC32A       tm;
193     INT32               size;
194     float               scale;
195     INT32               escapement;
196     PSCOLOR             color;
197     BOOL32              set;            /* Have we done a setfont yet */
198 } PSFONT;
199
200 typedef struct {
201     PSCOLOR             color;
202     BOOL32              set;
203 } PSBRUSH;
204
205 typedef struct {
206     INT32               width;
207     char                *dash;
208     PSCOLOR             color;
209     BOOL32              set;
210 } PSPEN;
211
212 typedef struct {
213     HANDLE16            hJob;
214     LPSTR               output;         /* Output file/port */
215     BOOL32              banding;        /* Have we received a NEXTBAND */
216     BOOL32              NeedPageHeader; /* Page header not sent yet */
217     INT32               PageNo;
218 } JOB;
219
220 typedef struct {
221     PSFONT              font;           /* Current PS font */
222     PSPEN               pen;
223     PSBRUSH             brush;
224     PSCOLOR             bkColor;
225     PSCOLOR             inkColor;       /* Last colour set */
226     JOB                 job;
227     PSDRV_DEVMODE16     *Devmode;
228     PRINTERINFO         *pi;
229 } PSDRV_PDEVICE;
230
231 extern HANDLE32 PSDRV_Heap;
232 extern char *PSDRV_ANSIVector[256];
233
234 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE16 *dm1, PSDRV_DEVMODE16 *dm2,
235                          PRINTERINFO *pi);
236 extern BOOL32 PSDRV_GetFontMetrics(void);
237 extern PPD *PSDRV_ParsePPD(char *fname);
238 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
239 extern AFM *PSDRV_FindAFMinList(FONTFAMILY *head, char *name);
240 extern void PSDRV_AddAFMtoList(FONTFAMILY **head, AFM *afm);
241 extern void PSDRV_FreeAFMList( FONTFAMILY *head );
242
243 extern BOOL32 PSDRV_Init(void);
244 extern HFONT16 PSDRV_FONT_SelectObject( DC *dc, HFONT16 hfont, FONTOBJ *font);
245 extern HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
246 extern HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
247                                           BRUSHOBJ * brush );
248
249 extern BOOL32 PSDRV_Brush(DC *dc, BOOL32 EO);
250 extern BOOL32 PSDRV_SetFont( DC *dc );
251 extern BOOL32 PSDRV_SetPen( DC *dc );
252
253 extern BOOL32 PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
254 extern BOOL32 PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
255 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
256                      COLORREF wincolor );
257
258
259 extern INT32 PSDRV_WriteHeader( DC *dc, char *title, int len );
260 extern INT32 PSDRV_WriteFooter( DC *dc );
261 extern INT32 PSDRV_WriteNewPage( DC *dc );
262 extern INT32 PSDRV_WriteEndPage( DC *dc );
263 extern BOOL32 PSDRV_WriteMoveTo(DC *dc, INT32 x, INT32 y);
264 extern BOOL32 PSDRV_WriteLineTo(DC *dc, INT32 x, INT32 y);
265 extern BOOL32 PSDRV_WriteStroke(DC *dc);
266 extern BOOL32 PSDRV_WriteRectangle(DC *dc, INT32 x, INT32 y, INT32 width, 
267                         INT32 height);
268 extern BOOL32 PSDRV_WriteSetFont(DC *dc, BOOL32 UseANSI);
269 extern BOOL32 PSDRV_WriteShow(DC *dc, char *str, INT32 count);
270 extern BOOL32 PSDRV_WriteReencodeFont(DC *dc);
271 extern BOOL32 PSDRV_WriteSetPen(DC *dc);
272 extern BOOL32 PSDRV_WriteArc(DC *dc, INT32 x, INT32 y, INT32 w, INT32 h,
273                              double ang1, double ang2);
274 extern BOOL32 PSDRV_WriteSetColor(DC *dc, PSCOLOR *color);
275 extern BOOL32 PSDRV_WriteSetBrush(DC *dc);
276 extern BOOL32 PSDRV_WriteFill(DC *dc);
277 extern BOOL32 PSDRV_WriteEOFill(DC *dc);
278 extern BOOL32 PSDRV_WriteGSave(DC *dc);
279 extern BOOL32 PSDRV_WriteGRestore(DC *dc);
280 extern BOOL32 PSDRV_WriteClosePath(DC *dc);
281 extern BOOL32 PSDRV_WriteClip(DC *dc);
282 extern BOOL32 PSDRV_WriteEOClip(DC *dc);
283 extern BOOL32 PSDRV_WriteHatch(DC *dc);
284 extern BOOL32 PSDRV_WriteRotate(DC *dc, float ang);
285
286
287
288
289
290 extern BOOL32 PSDRV_Arc( DC *dc, INT32 left, INT32 top, INT32 right,
291                          INT32 bottom, INT32 xstart, INT32 ystart,
292                          INT32 xend, INT32 yend );
293 extern BOOL32 PSDRV_Chord( DC *dc, INT32 left, INT32 top, INT32 right,
294                            INT32 bottom, INT32 xstart, INT32 ystart,
295                            INT32 xend, INT32 yend );
296 extern BOOL32 PSDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right,
297                              INT32 bottom );
298 extern BOOL32 PSDRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf, 
299                                      DEVICEFONTENUMPROC proc, LPARAM lp );
300 extern INT32 PSDRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput, 
301                            SEGPTR lpInData, SEGPTR lpOutData );
302 extern BOOL32 PSDRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
303                                 const RECT32 *lprect, LPCSTR str, UINT32 count,
304                                 const INT32 *lpDx );
305 extern BOOL32 PSDRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar,
306                                   LPINT32 buffer );
307 extern BOOL32 PSDRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
308                                         LPSIZE32 size );
309 extern BOOL32 PSDRV_GetTextMetrics( DC *dc, TEXTMETRIC32A *metrics );
310 extern BOOL32 PSDRV_LineTo( DC *dc, INT32 x, INT32 y );
311 extern BOOL32 PSDRV_MoveToEx( DC *dc, INT32 x, INT32 y, LPPOINT32 pt );
312 extern BOOL32 PSDRV_Pie( DC *dc, INT32 left, INT32 top, INT32 right,
313                          INT32 bottom, INT32 xstart, INT32 ystart,
314                          INT32 xend, INT32 yend );
315 extern BOOL32 PSDRV_Polygon( DC *dc, const POINT32* pt, INT32 count );
316 extern BOOL32 PSDRV_Polyline( DC *dc, const POINT32* pt, INT32 count );
317 extern BOOL32 PSDRV_PolyPolygon( DC *dc, const POINT32* pts, const INT32* counts,
318                                  UINT32 polygons );
319 extern BOOL32 PSDRV_PolyPolyline( DC *dc, const POINT32* pts, const DWORD* counts,
320                                   DWORD polylines );
321 extern BOOL32 PSDRV_Rectangle( DC *dc, INT32 left, INT32 top, INT32 right,
322                               INT32 bottom );
323 extern BOOL32 PSDRV_RoundRect(DC *dc, INT32 left, INT32 top, INT32 right,
324                               INT32 bottom, INT32 ell_width, INT32 ell_height);
325 extern HGDIOBJ32 PSDRV_SelectObject( DC *dc, HGDIOBJ32 handle );
326 extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color );
327 extern COLORREF PSDRV_SetPixel( DC *dc, INT32 x, INT32 y, COLORREF color );
328 extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color );
329 extern INT32 PSDRV_StretchDIBits( DC *dc, INT32 xDst, INT32 yDst,
330                                   INT32 widthDst, INT32 heightDst, INT32 xSrc,
331                                   INT32 ySrc, INT32 widthSrc, INT32 heightSrc,
332                                   const void *bits, const BITMAPINFO *info,
333                                   UINT32 wUsage, DWORD dwRop );
334
335 #endif
336
337