Create a color bitmap in CreateDIBitmap even with a black&white DC.
[wine/testsucceed.git] / dlls / wineps / psdrv.h
blobff50cc4d7ca4a949ee7de4473752ce64461f7a96
1 #ifndef __WINE_PSDRV_H
2 #define __WINE_PSDRV_H
4 /*
5 * PostScript driver definitions
7 * Copyright 1998 Huw D M Davies
8 */
9 #include "windef.h"
10 #include "wingdi.h"
11 #include "gdi.h"
12 #include "wine/wingdi16.h"
13 #include "winspool.h"
15 typedef struct {
16 INT index;
17 LPCSTR sz;
18 } GLYPHNAME;
20 typedef struct {
21 LONG UV;
22 const GLYPHNAME *name;
23 } UNICODEGLYPH;
25 typedef struct {
26 float llx, lly, urx, ury;
27 } AFMBBOX;
29 typedef struct _tagAFMLIGS {
30 char *successor;
31 char *ligature;
32 struct _tagAFMLIGS *next;
33 } AFMLIGS;
35 typedef struct {
36 int C; /* character */
37 LONG UV;
38 float WX;
39 const GLYPHNAME *N; /* name */
40 AFMBBOX B;
41 const AFMLIGS *L; /* Ligatures */
42 } OLD_AFMMETRICS;
44 typedef struct {
45 INT C; /* AFM encoding (or -1) */
46 LONG UV; /* Unicode value */
47 FLOAT WX; /* Advance width */
48 const GLYPHNAME *N; /* Glyph name */
49 } AFMMETRICS;
51 typedef struct {
52 USHORT usUnitsPerEm; /* head:unitsPerEm */
53 SHORT sAscender; /* hhea:Ascender */
54 SHORT sDescender; /* hhea:Descender */
55 SHORT sLineGap; /* hhea:LineGap */
56 SHORT sAvgCharWidth; /* OS/2:xAvgCharWidth */
57 SHORT sTypoAscender; /* OS/2:sTypoAscender */
58 SHORT sTypoDescender; /* OS/2:sTypoDescender */
59 SHORT sTypoLineGap; /* OS/2:sTypeLineGap */
60 USHORT usWinAscent; /* OS/2:usWinAscent */
61 USHORT usWinDescent; /* OS/2:usWinDescent */
62 } WINMETRICS;
64 typedef struct _tagAFM {
65 LPCSTR FontName;
66 LPCSTR FullName;
67 LPCSTR FamilyName;
68 LPCSTR EncodingScheme;
69 LONG Weight; /* FW_NORMAL etc. */
70 float ItalicAngle;
71 BOOL IsFixedPitch;
72 float UnderlinePosition;
73 float UnderlineThickness;
74 AFMBBOX FontBBox;
75 float Ascender;
76 float Descender;
77 WINMETRICS WinMetrics;
78 int NumofMetrics;
79 const AFMMETRICS *Metrics;
80 } AFM;
82 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
83 one list to exist without having to reallocate the entire AFM structure. We
84 keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
85 fonts for each DC (dc->physDev->Fonts) */
87 typedef struct _tagAFMLISTENTRY {
88 const AFM *afm;
89 struct _tagAFMLISTENTRY *next;
90 } AFMLISTENTRY;
92 typedef struct _tagFONTFAMILY {
93 char *FamilyName; /* family name */
94 AFMLISTENTRY *afmlist; /* list of afms for this family */
95 struct _tagFONTFAMILY *next; /* next family */
96 } FONTFAMILY;
98 extern FONTFAMILY *PSDRV_AFMFontList;
99 extern const AFM *const PSDRV_BuiltinAFMs[]; /* last element is NULL */
101 typedef struct _tagFONTNAME {
102 char *Name;
103 struct _tagFONTNAME *next;
104 } FONTNAME;
106 typedef struct {
107 float llx, lly, urx, ury;
108 } IMAGEABLEAREA;
110 typedef struct {
111 float x, y;
112 } PAPERDIMENSION;
114 /* Solaris kludge */
115 #undef PAGESIZE
116 typedef struct _tagPAGESIZE {
117 char *Name;
118 char *FullName;
119 char *InvocationString;
120 IMAGEABLEAREA *ImageableArea;
121 PAPERDIMENSION *PaperDimension;
122 WORD WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
123 struct _tagPAGESIZE *next;
124 } PAGESIZE;
127 typedef struct _tagOPTIONENTRY {
128 char *Name; /* eg "True" */
129 char *FullName; /* eg "Installed" */
130 char *InvocationString; /* Often NULL */
131 struct _tagOPTIONENTRY *next;
132 } OPTIONENTRY;
134 typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
135 char *OptionName; /* eg "*Option1" */
136 char *FullName; /* eg "Envelope Feeder" */
137 char *DefaultOption; /* eg "False" */
138 OPTIONENTRY *Options;
139 struct _tagOPTION *next;
140 } OPTION;
142 typedef struct _tagCONSTRAINT {
143 char *Feature1;
144 char *Value1;
145 char *Feature2;
146 char *Value2;
147 struct _tagCONSTRAINT *next;
148 } CONSTRAINT;
150 typedef struct _tagINPUTSLOT {
151 char *Name;
152 char *FullName;
153 char *InvocationString;
154 WORD WinBin; /* eg DMBIN_LOWER */
155 struct _tagINPUTSLOT *next;
156 } INPUTSLOT;
158 typedef struct {
159 char *NickName;
160 int LanguageLevel;
161 BOOL ColorDevice;
162 int DefaultResolution;
163 signed int LandscapeOrientation;
164 char *JCLBegin;
165 char *JCLToPSInterpreter;
166 char *JCLEnd;
167 char *DefaultFont;
168 FONTNAME *InstalledFonts; /* ptr to a list of FontNames */
169 PAGESIZE *PageSizes;
170 OPTION *InstalledOptions;
171 CONSTRAINT *Constraints;
172 INPUTSLOT *InputSlots;
173 } PPD;
175 typedef struct {
176 DEVMODEA dmPublic;
177 struct _tagdocprivate {
178 int dummy;
179 } dmDocPrivate;
180 struct _tagdrvprivate {
181 UINT numInstalledOptions; /* Options at end of struct */
182 } dmDrvPrivate;
184 /* Now comes:
186 numInstalledOptions of OPTIONs
190 } PSDRV_DEVMODEA;
192 typedef struct _tagPI {
193 char *FriendlyName;
194 PPD *ppd;
195 PSDRV_DEVMODEA *Devmode;
196 FONTFAMILY *Fonts;
197 PPRINTER_ENUM_VALUESA FontSubTable;
198 DWORD FontSubTableSize;
199 struct _tagPI *next;
200 } PRINTERINFO;
202 typedef struct {
203 float r, g, b;
204 } PSRGB;
206 typedef struct {
207 float i;
208 } PSGRAY;
211 /* def's for PSCOLOR.type */
212 #define PSCOLOR_GRAY 0
213 #define PSCOLOR_RGB 1
215 typedef struct {
216 int type;
217 union {
218 PSRGB rgb;
219 PSGRAY gray;
220 } value;
221 } PSCOLOR;
223 typedef struct {
224 const AFM *afm;
225 TEXTMETRICW tm;
226 INT size;
227 float scale;
228 INT escapement;
229 PSCOLOR color;
230 BOOL set; /* Have we done a setfont yet */
231 } PSFONT;
233 typedef struct {
234 PSCOLOR color;
235 BOOL set;
236 } PSBRUSH;
238 typedef struct {
239 INT style;
240 INT width;
241 char *dash;
242 PSCOLOR color;
243 BOOL set;
244 } PSPEN;
246 typedef struct {
247 HANDLE16 hJob;
248 LPSTR output; /* Output file/port */
249 BOOL banding; /* Have we received a NEXTBAND */
250 BOOL OutOfPage; /* Page header not sent yet */
251 INT PageNo;
252 } JOB;
254 typedef struct {
255 PSFONT font; /* Current PS font */
256 PSPEN pen;
257 PSBRUSH brush;
258 PSCOLOR bkColor;
259 PSCOLOR inkColor; /* Last colour set */
260 JOB job;
261 PSDRV_DEVMODEA *Devmode;
262 PRINTERINFO *pi;
263 RECT PageSize; /* Imageable area in device co-ords */
264 int horzRes; /* device caps */
265 int vertRes;
266 int horzSize;
267 int vertSize;
268 int logPixelsX;
269 int logPixelsY;
270 } PSDRV_PDEVICE;
272 typedef struct {
273 PRINTERINFO *pi;
274 PSDRV_DEVMODEA *dlgdm;
275 } PSDRV_DLGINFO;
279 * Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
282 extern const INT PSDRV_AGLGlyphNamesSize;
283 extern GLYPHNAME PSDRV_AGLGlyphNames[];
287 * The AGL encoding vector
290 extern const INT PSDRV_AGLbyNameSize; /* sorted by name - */
291 extern const UNICODEGLYPH PSDRV_AGLbyName[]; /* duplicates omitted */
293 extern const INT PSDRV_AGLbyUVSize; /* sorted by UV - */
294 extern const UNICODEGLYPH PSDRV_AGLbyUV[]; /* duplicates included */
297 extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
298 LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort,
299 LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode);
301 extern HANDLE PSDRV_Heap;
302 extern char *PSDRV_ANSIVector[256];
304 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
305 PRINTERINFO *pi);
306 extern BOOL PSDRV_GetFontMetrics(void);
307 extern PPD *PSDRV_ParsePPD(char *fname);
308 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
309 extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name);
310 extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
311 BOOL *p_added);
312 extern void PSDRV_FreeAFMList( FONTFAMILY *head );
314 extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved);
315 extern HFONT PSDRV_FONT_SelectObject( DC *dc, HFONT hfont );
316 extern HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen );
317 extern HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush );
319 extern BOOL PSDRV_Brush(DC *dc, BOOL EO);
320 extern BOOL PSDRV_SetFont( DC *dc );
321 extern BOOL PSDRV_SetPen( DC *dc );
323 extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
324 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
325 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
326 COLORREF wincolor );
327 extern char PSDRV_UnicodeToANSI(int u);
329 extern INT PSDRV_WriteHeader( DC *dc, LPCSTR title );
330 extern INT PSDRV_WriteFooter( DC *dc );
331 extern INT PSDRV_WriteNewPage( DC *dc );
332 extern INT PSDRV_WriteEndPage( DC *dc );
333 extern BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y);
334 extern BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y);
335 extern BOOL PSDRV_WriteStroke(DC *dc);
336 extern BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width,
337 INT height);
338 extern BOOL PSDRV_WriteRRectangle(DC *dc, INT x, INT y, INT width,
339 INT height);
340 extern BOOL PSDRV_WriteSetFont(DC *dc);
341 extern BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count);
342 extern BOOL PSDRV_WriteSetPen(DC *dc);
343 extern BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h,
344 double ang1, double ang2);
345 extern BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color);
346 extern BOOL PSDRV_WriteSetBrush(DC *dc);
347 extern BOOL PSDRV_WriteFill(DC *dc);
348 extern BOOL PSDRV_WriteEOFill(DC *dc);
349 extern BOOL PSDRV_WriteGSave(DC *dc);
350 extern BOOL PSDRV_WriteGRestore(DC *dc);
351 extern BOOL PSDRV_WriteNewPath(DC *dc);
352 extern BOOL PSDRV_WriteClosePath(DC *dc);
353 extern BOOL PSDRV_WriteInitClip(DC *dc);
354 extern BOOL PSDRV_WriteClip(DC *dc);
355 extern BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h);
356 extern BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName);
357 extern BOOL PSDRV_WriteEOClip(DC *dc);
358 extern BOOL PSDRV_WriteHatch(DC *dc);
359 extern BOOL PSDRV_WriteRotate(DC *dc, float ang);
360 extern BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size);
361 extern BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc);
362 extern BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number);
363 extern BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
364 INT widthDst, INT heightDst, INT widthSrc,
365 INT heightSrc, char *bits);
366 extern BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number);
367 extern BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number);
368 extern BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number);
369 extern BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number);
370 extern int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch);
371 extern BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits);
372 extern BOOL PSDRV_WriteArrayPut(DC *dc, CHAR *pszArrayName, INT nIndex, LONG lCoord);
373 extern BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize);
375 extern BOOL PSDRV_Arc( DC *dc, INT left, INT top, INT right,
376 INT bottom, INT xstart, INT ystart,
377 INT xend, INT yend );
378 extern BOOL PSDRV_Chord( DC *dc, INT left, INT top, INT right,
379 INT bottom, INT xstart, INT ystart,
380 INT xend, INT yend );
381 extern BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right,
382 INT bottom );
383 extern INT PSDRV_EndDoc( DC *dc );
384 extern INT PSDRV_EndPage( DC *dc );
385 extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
386 DEVICEFONTENUMPROC proc, LPARAM lp );
387 extern INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput,
388 SEGPTR lpInData, SEGPTR lpOutData );
389 extern BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
390 const RECT *lprect, LPCWSTR str, UINT count,
391 const INT *lpDx );
392 extern BOOL PSDRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar,
393 LPINT buffer );
394 extern BOOL PSDRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count,
395 LPSIZE size );
396 extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics );
397 extern BOOL PSDRV_LineTo( DC *dc, INT x, INT y );
398 extern BOOL PSDRV_PatBlt( DC *dc, INT x, INT y, INT width, INT height, DWORD
399 dwRop);
400 extern BOOL PSDRV_Pie( DC *dc, INT left, INT top, INT right,
401 INT bottom, INT xstart, INT ystart,
402 INT xend, INT yend );
403 extern BOOL PSDRV_Polygon( DC *dc, const POINT* pt, INT count );
404 extern BOOL PSDRV_Polyline( DC *dc, const POINT* pt, INT count );
405 extern BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts,
406 UINT polygons );
407 extern BOOL PSDRV_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts,
408 DWORD polylines );
409 extern BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right,
410 INT bottom );
411 extern BOOL PSDRV_RoundRect(DC *dc, INT left, INT top, INT right,
412 INT bottom, INT ell_width, INT ell_height);
413 extern HGDIOBJ PSDRV_SelectObject( DC *dc, HGDIOBJ handle );
414 extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color );
415 extern VOID PSDRV_SetDeviceClipping( DC *dc );
416 extern COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color );
417 extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color );
418 extern INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc );
419 extern INT PSDRV_StartPage( DC *dc );
420 extern INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst,
421 INT widthDst, INT heightDst, INT xSrc,
422 INT ySrc, INT widthSrc, INT heightSrc,
423 const void *bits, const BITMAPINFO *info,
424 UINT wUsage, DWORD dwRop );
426 extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
427 LPDEVMODEA lpdmOutput,
428 LPSTR lpszDevice, LPSTR lpszPort,
429 LPDEVMODEA lpdmInput, LPSTR lpszProfile,
430 DWORD dwMode);
431 extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
432 LPCSTR lpszPort,
433 WORD fwCapability, LPSTR lpszOutput,
434 LPDEVMODEA lpdm);
435 VOID PSDRV_DrawLine( DC *dc );
436 INT PSDRV_GlyphListInit(void);
437 const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
438 VOID PSDRV_IndexGlyphList(void);
439 BOOL PSDRV_GetTrueTypeMetrics(void);
440 BOOL PSDRV_GetType1Metrics(void);
441 const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm);
442 SHORT PSDRV_CalcAvgCharWidth(const AFM *afm);
444 #endif