dbghelp: Implement SymEnumSourceFilesW.
[wine] / dlls / gdi32 / gdi_private.h
1 /*
2  * GDI definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_GDI_PRIVATE_H
22 #define __WINE_GDI_PRIVATE_H
23
24 #include <math.h>
25 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29
30 /* Metafile defines */
31 #define META_EOF 0x0000
32 /* values of mtType in METAHEADER.  Note however that the disk image of a disk
33    based metafile has mtType == 1 */
34 #define METAFILE_MEMORY 1
35 #define METAFILE_DISK   2
36 #define MFHEADERSIZE (sizeof(METAHEADER))
37 #define MFVERSION 0x300
38
39 typedef struct {
40     EMR   emr;
41     INT   nBreakExtra;
42     INT   nBreakCount;
43 } EMRSETTEXTJUSTIFICATION, *PEMRSETTEXTJUSTIFICATION;
44
45 /* extra stock object: default 1x1 bitmap for memory DCs */
46 #define DEFAULT_BITMAP (STOCK_LAST+1)
47
48 struct gdi_obj_funcs
49 {
50     HGDIOBJ (*pSelectObject)( HGDIOBJ handle, HDC hdc );
51     INT     (*pGetObjectA)( HGDIOBJ handle, INT count, LPVOID buffer );
52     INT     (*pGetObjectW)( HGDIOBJ handle, INT count, LPVOID buffer );
53     BOOL    (*pUnrealizeObject)( HGDIOBJ handle );
54     BOOL    (*pDeleteObject)( HGDIOBJ handle );
55 };
56
57 struct hdc_list
58 {
59     HDC hdc;
60     struct hdc_list *next;
61 };
62
63 typedef struct tagGDIOBJHDR
64 {
65     WORD        type;         /* object type (one of the OBJ_* constants) */
66     WORD        system : 1;   /* system object flag */
67     WORD        deleted : 1;  /* whether DeleteObject has been called on this object */
68     DWORD       selcount;     /* number of times the object is selected in a DC */
69     const struct gdi_obj_funcs *funcs;
70     struct hdc_list *hdcs;
71 } GDIOBJHDR;
72
73 /* Device functions for the Wine driver interface */
74
75 typedef struct gdi_physdev
76 {
77     const struct tagDC_FUNCS *funcs;
78     struct gdi_physdev       *next;
79     HDC                       hdc;
80 } *PHYSDEV;
81
82 typedef struct
83 {
84     int bit_count, width, height;
85     int stride; /* stride in bytes.  Will be -ve for bottom-up dibs (see bits). */
86     void *bits; /* points to the top-left corner of the dib. */
87
88     DWORD red_mask, green_mask, blue_mask;
89     int red_shift, green_shift, blue_shift;
90     int red_len, green_len, blue_len;
91
92     RGBQUAD *color_table;
93     DWORD color_table_size;
94
95     const struct primitive_funcs *funcs;
96 } dib_info;
97
98 typedef struct
99 {
100     DWORD count;
101     DWORD dashes[16]; /* 16 is the maximium number for a PS_USERSTYLE pen */
102     DWORD total_len;  /* total length of the dashes, should be multiplied by 2 if there are an odd number of dash lengths */
103 } dash_pattern;
104
105 typedef struct
106 {
107     int left_in_dash;
108     int cur_dash;
109     BOOL mark;
110 } dash_pos;
111
112 typedef struct dibdrv_physdev
113 {
114     struct gdi_physdev dev;
115     dib_info dib;
116
117     HRGN clip;
118     DWORD defer;
119
120     /* pen */
121     DWORD pen_color, pen_and, pen_xor;
122     dash_pattern pen_pattern;
123     dash_pos dash_pos;
124     BOOL   (* pen_line)(struct dibdrv_physdev *pdev, POINT *start, POINT *end);
125
126     /* brush */
127     UINT brush_style;
128     INT brush_rop;   /* PatBlt, for example, can override the DC's rop2 */
129     DWORD brush_color, brush_and, brush_xor;
130     dib_info brush_dib;
131     void *brush_and_bits, *brush_xor_bits;
132     BOOL   (* brush_rects)(struct dibdrv_physdev *pdev, int num, RECT *rects);
133
134     /* background */
135     DWORD bkgnd_color, bkgnd_and, bkgnd_xor;
136 } dibdrv_physdev;
137
138 #define DEFER_FORMAT     1
139 #define DEFER_PEN        2
140 #define DEFER_BRUSH      4
141
142 typedef struct tagDC_FUNCS
143 {
144     INT      (CDECL *pAbortDoc)(PHYSDEV);
145     BOOL     (CDECL *pAbortPath)(PHYSDEV);
146     BOOL     (CDECL *pAlphaBlend)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,BLENDFUNCTION);
147     BOOL     (CDECL *pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
148     BOOL     (CDECL *pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
149     BOOL     (CDECL *pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
150     BOOL     (CDECL *pBeginPath)(PHYSDEV);
151     INT      (CDECL *pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
152     BOOL     (CDECL *pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
153     BOOL     (CDECL *pCloseFigure)(PHYSDEV);
154     BOOL     (CDECL *pCreateBitmap)(PHYSDEV,HBITMAP,LPVOID);
155     BOOL     (CDECL *pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
156     HBITMAP  (CDECL *pCreateDIBSection)(PHYSDEV,HBITMAP,const BITMAPINFO *,UINT);
157     BOOL     (CDECL *pDeleteBitmap)(HBITMAP);
158     BOOL     (CDECL *pDeleteDC)(PHYSDEV);
159     BOOL     (CDECL *pDeleteObject)(PHYSDEV,HGDIOBJ);
160     INT      (CDECL *pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
161     DWORD    (CDECL *pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
162     BOOL     (CDECL *pEllipse)(PHYSDEV,INT,INT,INT,INT);
163     INT      (CDECL *pEndDoc)(PHYSDEV);
164     INT      (CDECL *pEndPage)(PHYSDEV);
165     BOOL     (CDECL *pEndPath)(PHYSDEV);
166     BOOL     (CDECL *pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
167     INT      (CDECL *pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
168     INT      (CDECL *pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
169     INT      (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
170     INT      (CDECL *pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
171     BOOL     (CDECL *pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
172     INT      (CDECL *pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
173     BOOL     (CDECL *pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
174     BOOL     (CDECL *pFillPath)(PHYSDEV);
175     BOOL     (CDECL *pFillRgn)(PHYSDEV,HRGN,HBRUSH);
176     BOOL     (CDECL *pFlattenPath)(PHYSDEV);
177     BOOL     (CDECL *pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
178     BOOL     (CDECL *pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
179     LONG     (CDECL *pGetBitmapBits)(HBITMAP,void*,LONG);
180     BOOL     (CDECL *pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
181     INT      (CDECL *pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
182     INT      (CDECL *pGetDeviceCaps)(PHYSDEV,INT);
183     BOOL     (CDECL *pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
184     BOOL     (CDECL *pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR);
185     COLORREF (CDECL *pGetNearestColor)(PHYSDEV,COLORREF);
186     COLORREF (CDECL *pGetPixel)(PHYSDEV,INT,INT);
187     INT      (CDECL *pGetPixelFormat)(PHYSDEV);
188     UINT     (CDECL *pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
189     BOOL     (CDECL *pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE);
190     BOOL     (CDECL *pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
191     INT      (CDECL *pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
192     BOOL     (CDECL *pInvertRgn)(PHYSDEV,HRGN);
193     BOOL     (CDECL *pLineTo)(PHYSDEV,INT,INT);
194     BOOL     (CDECL *pModifyWorldTransform)(PHYSDEV,const XFORM*,DWORD);
195     BOOL     (CDECL *pMoveTo)(PHYSDEV,INT,INT);
196     INT      (CDECL *pOffsetClipRgn)(PHYSDEV,INT,INT);
197     BOOL     (CDECL *pOffsetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
198     BOOL     (CDECL *pOffsetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
199     BOOL     (CDECL *pPaintRgn)(PHYSDEV,HRGN);
200     BOOL     (CDECL *pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD);
201     BOOL     (CDECL *pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
202     BOOL     (CDECL *pPolyBezier)(PHYSDEV,const POINT*,DWORD);
203     BOOL     (CDECL *pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
204     BOOL     (CDECL *pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
205     BOOL     (CDECL *pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
206     BOOL     (CDECL *pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
207     BOOL     (CDECL *pPolygon)(PHYSDEV,const POINT*,INT);
208     BOOL     (CDECL *pPolyline)(PHYSDEV,const POINT*,INT);
209     BOOL     (CDECL *pPolylineTo)(PHYSDEV,const POINT*,INT);
210     UINT     (CDECL *pRealizeDefaultPalette)(PHYSDEV);
211     UINT     (CDECL *pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
212     BOOL     (CDECL *pRectangle)(PHYSDEV,INT,INT,INT,INT);
213     HDC      (CDECL *pResetDC)(PHYSDEV,const DEVMODEW*);
214     BOOL     (CDECL *pRestoreDC)(PHYSDEV,INT);
215     BOOL     (CDECL *pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
216     INT      (CDECL *pSaveDC)(PHYSDEV);
217     BOOL     (CDECL *pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
218     BOOL     (CDECL *pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
219     HBITMAP  (CDECL *pSelectBitmap)(PHYSDEV,HBITMAP);
220     HBRUSH   (CDECL *pSelectBrush)(PHYSDEV,HBRUSH);
221     BOOL     (CDECL *pSelectClipPath)(PHYSDEV,INT);
222     HFONT    (CDECL *pSelectFont)(PHYSDEV,HFONT,HANDLE);
223     HPALETTE (CDECL *pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
224     HPEN     (CDECL *pSelectPen)(PHYSDEV,HPEN);
225     INT      (CDECL *pSetArcDirection)(PHYSDEV,INT);
226     LONG     (CDECL *pSetBitmapBits)(HBITMAP,const void*,LONG);
227     COLORREF (CDECL *pSetBkColor)(PHYSDEV,COLORREF);
228     INT      (CDECL *pSetBkMode)(PHYSDEV,INT);
229     COLORREF (CDECL *pSetDCBrushColor)(PHYSDEV, COLORREF);
230     COLORREF (CDECL *pSetDCPenColor)(PHYSDEV, COLORREF);
231     UINT     (CDECL *pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
232     INT      (CDECL *pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
233     INT      (CDECL *pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
234                                            const BITMAPINFO*,UINT);
235     VOID     (CDECL *pSetDeviceClipping)(PHYSDEV,HRGN,HRGN);
236     BOOL     (CDECL *pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
237     DWORD    (CDECL *pSetLayout)(PHYSDEV,DWORD);
238     INT      (CDECL *pSetMapMode)(PHYSDEV,INT);
239     DWORD    (CDECL *pSetMapperFlags)(PHYSDEV,DWORD);
240     COLORREF (CDECL *pSetPixel)(PHYSDEV,INT,INT,COLORREF);
241     BOOL     (CDECL *pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
242     INT      (CDECL *pSetPolyFillMode)(PHYSDEV,INT);
243     INT      (CDECL *pSetROP2)(PHYSDEV,INT);
244     INT      (CDECL *pSetRelAbs)(PHYSDEV,INT);
245     INT      (CDECL *pSetStretchBltMode)(PHYSDEV,INT);
246     UINT     (CDECL *pSetTextAlign)(PHYSDEV,UINT);
247     INT      (CDECL *pSetTextCharacterExtra)(PHYSDEV,INT);
248     COLORREF (CDECL *pSetTextColor)(PHYSDEV,COLORREF);
249     BOOL     (CDECL *pSetTextJustification)(PHYSDEV,INT,INT);
250     BOOL     (CDECL *pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*);
251     BOOL     (CDECL *pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
252     BOOL     (CDECL *pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*);
253     BOOL     (CDECL *pSetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
254     BOOL     (CDECL *pSetWorldTransform)(PHYSDEV,const XFORM*);
255     INT      (CDECL *pStartDoc)(PHYSDEV,const DOCINFOW*);
256     INT      (CDECL *pStartPage)(PHYSDEV);
257     BOOL     (CDECL *pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
258     INT      (CDECL *pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
259                                        const BITMAPINFO*,UINT,DWORD);
260     BOOL     (CDECL *pStrokeAndFillPath)(PHYSDEV);
261     BOOL     (CDECL *pStrokePath)(PHYSDEV);
262     BOOL     (CDECL *pSwapBuffers)(PHYSDEV);
263     BOOL     (CDECL *pUnrealizePalette)(HPALETTE);
264     BOOL     (CDECL *pWidenPath)(PHYSDEV);
265
266     /* OpenGL32 */
267     BOOL     (CDECL *pwglCopyContext)(HGLRC, HGLRC, UINT);
268     HGLRC    (CDECL *pwglCreateContext)(PHYSDEV);
269     HGLRC    (CDECL *pwglCreateContextAttribsARB)(PHYSDEV, HGLRC, const int*);
270     BOOL     (CDECL *pwglDeleteContext)(HGLRC);
271     PROC     (CDECL *pwglGetProcAddress)(LPCSTR);
272     HDC      (CDECL *pwglGetPbufferDCARB)(PHYSDEV, void*);
273     BOOL     (CDECL *pwglMakeCurrent)(PHYSDEV, HGLRC);
274     BOOL     (CDECL *pwglMakeContextCurrentARB)(PHYSDEV, PHYSDEV, HGLRC);
275     BOOL     (CDECL *pwglSetPixelFormatWINE)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
276     BOOL     (CDECL *pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
277     BOOL     (CDECL *pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD);
278     BOOL     (CDECL *pwglUseFontBitmapsW)(PHYSDEV, DWORD, DWORD, DWORD);
279 } DC_FUNCTIONS;
280
281 /* It should not be necessary to access the contents of the GdiPath
282  * structure directly; if you find that the exported functions don't
283  * allow you to do what you want, then please place a new exported
284  * function that does this job in path.c.
285  */
286 typedef enum tagGdiPathState
287 {
288    PATH_Null,
289    PATH_Open,
290    PATH_Closed
291 } GdiPathState;
292
293 typedef struct tagGdiPath
294 {
295    GdiPathState state;
296    POINT      *pPoints;
297    BYTE         *pFlags;
298    int          numEntriesUsed, numEntriesAllocated;
299    BOOL       newStroke;
300 } GdiPath;
301
302 typedef struct tagGdiFont GdiFont;
303
304 typedef struct tagDC
305 {
306     GDIOBJHDR    header;
307     HDC          hSelf;            /* Handle to this DC */
308     struct gdi_physdev nulldrv;    /* physdev for the null driver */
309     struct dibdrv_physdev dibdrv;  /* physdev for the dib driver */
310     PHYSDEV      physDev;         /* Physical device (driver-specific) */
311     DWORD        thread;          /* thread owning the DC */
312     LONG         refcount;        /* thread refcount */
313     LONG         dirty;           /* dirty flag */
314     INT          saveLevel;
315     struct tagDC *saved_dc;
316     DWORD_PTR    dwHookData;
317     DCHOOKPROC   hookProc;         /* DC hook */
318
319     INT          wndOrgX;          /* Window origin */
320     INT          wndOrgY;
321     INT          wndExtX;          /* Window extent */
322     INT          wndExtY;
323     INT          vportOrgX;        /* Viewport origin */
324     INT          vportOrgY;
325     INT          vportExtX;        /* Viewport extent */
326     INT          vportExtY;
327     SIZE         virtual_res;      /* Initially HORZRES,VERTRES. Changed by SetVirtualResolution */
328     SIZE         virtual_size;     /* Initially HORZSIZE,VERTSIZE. Changed by SetVirtualResolution */
329     RECT         vis_rect;         /* visible rectangle in screen coords */
330     FLOAT        miterLimit;
331
332     int           flags;
333     DWORD         layout;
334     HRGN          hClipRgn;      /* Clip region (may be 0) */
335     HRGN          hMetaRgn;      /* Meta region (may be 0) */
336     HRGN          hMetaClipRgn;  /* Intersection of meta and clip regions (may be 0) */
337     HRGN          hVisRgn;       /* Visible region (must never be 0) */
338     HPEN          hPen;
339     HBRUSH        hBrush;
340     HFONT         hFont;
341     HBITMAP       hBitmap;
342     HANDLE        hDevice;
343     HPALETTE      hPalette;
344
345     GdiFont      *gdiFont;
346     GdiPath       path;
347
348     UINT          font_code_page;
349     WORD          ROPmode;
350     WORD          polyFillMode;
351     WORD          stretchBltMode;
352     WORD          relAbsMode;
353     WORD          backgroundMode;
354     COLORREF      backgroundColor;
355     COLORREF      textColor;
356     COLORREF      dcBrushColor;
357     COLORREF      dcPenColor;
358     short         brushOrgX;
359     short         brushOrgY;
360
361     DWORD         mapperFlags;       /* Font mapper flags */
362     WORD          textAlign;         /* Text alignment from SetTextAlign() */
363     INT           charExtra;         /* Spacing from SetTextCharacterExtra() */
364     INT           breakExtra;        /* breakTotalExtra / breakCount */
365     INT           breakRem;          /* breakTotalExtra % breakCount */
366     INT           MapMode;
367     INT           GraphicsMode;      /* Graphics mode */
368     ABORTPROC     pAbortProc;        /* AbortProc for Printing */
369     INT           CursPosX;          /* Current position */
370     INT           CursPosY;
371     INT           ArcDirection;
372     XFORM         xformWorld2Wnd;    /* World-to-window transformation */
373     XFORM         xformWorld2Vport;  /* World-to-viewport transformation */
374     XFORM         xformVport2World;  /* Inverse of the above transformation */
375     BOOL          vport2WorldValid;  /* Is xformVport2World valid? */
376     RECT          BoundsRect;        /* Current bounding rect */
377 } DC;
378
379   /* DC flags */
380 #define DC_BOUNDS_ENABLE 0x0008   /* Bounding rectangle tracking is enabled */
381 #define DC_BOUNDS_SET    0x0010   /* Bounding rectangle has been set */
382
383 /* Certain functions will do no further processing if the driver returns this.
384    Used by mfdrv for example. */
385 #define GDI_NO_MORE_WORK 2
386
387 /* Rounds a floating point number to integer. The world-to-viewport
388  * transformation process is done in floating point internally. This function
389  * is then used to round these coordinates to integer values.
390  */
391 static inline INT GDI_ROUND(double val)
392 {
393    return (int)floor(val + 0.5);
394 }
395
396 /* bitmap object */
397
398 typedef struct tagBITMAPOBJ
399 {
400     GDIOBJHDR           header;
401     BITMAP              bitmap;
402     SIZE                size;   /* For SetBitmapDimension() */
403     const DC_FUNCTIONS *funcs; /* DC function table */
404     /* For device-independent bitmaps: */
405     DIBSECTION         *dib;
406     RGBQUAD            *color_table;  /* DIB color table if <= 8bpp */
407     UINT                nb_colors;    /* number of colors in table */
408 } BITMAPOBJ;
409
410 /* bidi.c */
411
412 /* Wine_GCPW Flags */
413 /* Directionality -
414  * LOOSE means taking the directionality of the first strong character, if there is found one.
415  * FORCE means the paragraph direction is forced. (RLE/LRE)
416  */
417 #define WINE_GCPW_FORCE_LTR 0
418 #define WINE_GCPW_FORCE_RTL 1
419 #define WINE_GCPW_LOOSE_LTR 2
420 #define WINE_GCPW_LOOSE_RTL 3
421 #define WINE_GCPW_DIR_MASK 3
422 #define WINE_GCPW_LOOSE_MASK 2
423
424 extern BOOL BIDI_Reorder( HDC hDC, LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
425                           LPWSTR lpOutString, INT uCountOut, UINT *lpOrder, WORD **lpGlyphs, INT* cGlyphs ) DECLSPEC_HIDDEN;
426
427 /* bitmap.c */
428 extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN;
429 extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) DECLSPEC_HIDDEN;
430 extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN;
431
432 /* clipping.c */
433 extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN;
434
435 /* Return the total clip region (if any) */
436 static inline HRGN get_clip_region( DC * dc )
437 {
438     if (dc->hMetaClipRgn) return dc->hMetaClipRgn;
439     if (dc->hMetaRgn) return dc->hMetaRgn;
440     return dc->hClipRgn;
441 }
442
443 /* dc.c */
444 extern DC *alloc_dc_ptr( WORD magic ) DECLSPEC_HIDDEN;
445 extern void free_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
446 extern DC *get_dc_ptr( HDC hdc ) DECLSPEC_HIDDEN;
447 extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
448 extern void update_dc( DC *dc ) DECLSPEC_HIDDEN;
449 extern void push_dc_driver( DC * dc, PHYSDEV physdev, const DC_FUNCTIONS *funcs ) DECLSPEC_HIDDEN;
450 extern void pop_dc_driver( DC * dc, PHYSDEV physdev ) DECLSPEC_HIDDEN;
451 extern void DC_InitDC( DC * dc ) DECLSPEC_HIDDEN;
452 extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
453
454 /* dib.c */
455 extern int DIB_GetDIBWidthBytes( int width, int depth ) DECLSPEC_HIDDEN;
456 extern int DIB_GetDIBImageBytes( int width, int height, int depth ) DECLSPEC_HIDDEN;
457 extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
458 extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
459                               LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN;
460
461 /* driver.c */
462 extern const DC_FUNCTIONS null_driver DECLSPEC_HIDDEN;
463 extern const DC_FUNCTIONS dib_driver DECLSPEC_HIDDEN;
464 extern const DC_FUNCTIONS *DRIVER_get_display_driver(void) DECLSPEC_HIDDEN;
465 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
466 extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN;
467
468 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
469 {
470     while (!((void **)dev->funcs)[offset / sizeof(void *)]) dev = dev->next;
471     return dev;
472 }
473
474 #define GET_DC_PHYSDEV(dc,func) get_physdev_entry_point( (dc)->physDev, FIELD_OFFSET(DC_FUNCTIONS,func))
475 #define GET_NEXT_PHYSDEV(dev,func) get_physdev_entry_point( (dev)->next, FIELD_OFFSET(DC_FUNCTIONS,func))
476
477 /* enhmetafile.c */
478 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
479
480 /* freetype.c */
481
482 /* Undocumented structure filled in by GdiRealizationInfo */
483 typedef struct
484 {
485     DWORD flags;       /* 1 for bitmap fonts, 3 for scalable fonts */
486     DWORD cache_num;   /* keeps incrementing - num of fonts that have been created allowing for caching?? */
487     DWORD unknown2;    /* fixed for a given font - looks like it could be the order of the face in the font list or the order
488                           in which the face was first rendered. */
489 } realization_info_t;
490
491
492 extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
493 extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
494 extern GdiFont* WineEngCreateFontInstance(DC*, HFONT) DECLSPEC_HIDDEN;
495 extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
496 extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM) DECLSPEC_HIDDEN;
497 extern BOOL WineEngGetCharABCWidths(GdiFont *font, UINT firstChar,
498                                     UINT lastChar, LPABC buffer) DECLSPEC_HIDDEN;
499 extern BOOL WineEngGetCharABCWidthsFloat(GdiFont *font, UINT firstChar,
500                                          UINT lastChar, LPABCFLOAT buffer) DECLSPEC_HIDDEN;
501 extern BOOL WineEngGetCharABCWidthsI(GdiFont *font, UINT firstChar,
502                                     UINT count, LPWORD pgi, LPABC buffer) DECLSPEC_HIDDEN;
503 extern BOOL WineEngGetCharWidth(GdiFont*, UINT, UINT, LPINT) DECLSPEC_HIDDEN;
504 extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
505 extern DWORD WineEngGetFontUnicodeRanges(GdiFont *, LPGLYPHSET) DECLSPEC_HIDDEN;
506 extern DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
507                                     LPWORD pgi, DWORD flags) DECLSPEC_HIDDEN;
508 extern DWORD WineEngGetGlyphOutline(GdiFont*, UINT glyph, UINT format,
509                                     LPGLYPHMETRICS, DWORD buflen, LPVOID buf,
510                                     const MAT2*) DECLSPEC_HIDDEN;
511 extern DWORD WineEngGetKerningPairs(GdiFont*, DWORD, KERNINGPAIR *) DECLSPEC_HIDDEN;
512 extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN;
513 extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) DECLSPEC_HIDDEN;
514 extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;
515 extern BOOL WineEngGetTextExtentExPoint(GdiFont*, LPCWSTR, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
516 extern BOOL WineEngGetTextExtentExPointI(GdiFont*, const WORD *, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
517 extern INT  WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
518 extern BOOL WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW) DECLSPEC_HIDDEN;
519 extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
520 extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
521 extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN;
522 extern BOOL WineEngRemoveFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
523
524 /* gdiobj.c */
525 extern HGDIOBJ alloc_gdi_handle( GDIOBJHDR *obj, WORD type, const struct gdi_obj_funcs *funcs ) DECLSPEC_HIDDEN;
526 extern void *free_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN;
527 extern void *GDI_GetObjPtr( HGDIOBJ, WORD ) DECLSPEC_HIDDEN;
528 extern void GDI_ReleaseObj( HGDIOBJ ) DECLSPEC_HIDDEN;
529 extern void GDI_CheckNotLock(void) DECLSPEC_HIDDEN;
530 extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
531 extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
532 extern BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
533 extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
534
535 /* metafile.c */
536 extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
537 extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN;
538
539 /* path.c */
540
541 #define PATH_IsPathOpen(path) ((path).state==PATH_Open)
542 /* Returns TRUE if the specified path is in the open state, i.e. in the
543  * state where points will be added to the path, or FALSE otherwise. This
544  * function is implemented as a macro for performance reasons.
545  */
546
547 extern void PATH_InitGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN;
548 extern void PATH_DestroyGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN;
549 extern BOOL PATH_AssignGdiPath(GdiPath *pPathDest, const GdiPath *pPathSrc) DECLSPEC_HIDDEN;
550
551 extern BOOL PATH_MoveTo(DC *dc) DECLSPEC_HIDDEN;
552 extern BOOL PATH_LineTo(DC *dc, INT x, INT y) DECLSPEC_HIDDEN;
553 extern BOOL PATH_Rectangle(DC *dc, INT x1, INT y1, INT x2, INT y2) DECLSPEC_HIDDEN;
554 extern BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc,
555                             LPCWSTR str, UINT count, const INT *dx) DECLSPEC_HIDDEN;
556 extern BOOL PATH_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2) DECLSPEC_HIDDEN;
557 extern BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
558                      INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines) DECLSPEC_HIDDEN;
559 extern BOOL PATH_PolyBezierTo(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
560 extern BOOL PATH_PolyBezier(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
561 extern BOOL PATH_PolyDraw(DC *dc, const POINT *pts, const BYTE *types, DWORD cbCount) DECLSPEC_HIDDEN;
562 extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
563 extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
564 extern BOOL PATH_Polygon(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
565 extern BOOL PATH_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines) DECLSPEC_HIDDEN;
566 extern BOOL PATH_PolyPolygon(DC *dc, const POINT *pt, const INT *counts, UINT polygons) DECLSPEC_HIDDEN;
567 extern BOOL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height) DECLSPEC_HIDDEN;
568
569 /* painting.c */
570 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN;
571
572 /* palette.c */
573 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) DECLSPEC_HIDDEN;
574 extern UINT WINAPI GDIRealizePalette( HDC hdc ) DECLSPEC_HIDDEN;
575 extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN;
576
577 /* region.c */
578 extern INT mirror_region( HRGN dst, HRGN src, INT width ) DECLSPEC_HIDDEN;
579 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ) DECLSPEC_HIDDEN;
580
581 typedef struct
582 {
583     INT size;
584     INT numRects;
585     RECT *rects;
586     RECT extents;
587 } WINEREGION;
588 extern const WINEREGION *get_wine_region(HRGN rgn) DECLSPEC_HIDDEN;
589 static inline void release_wine_region(HRGN rgn)
590 {
591     GDI_ReleaseObj(rgn);
592 }
593
594 /* null driver entry points */
595 extern BOOL CDECL nulldrv_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
596 extern BOOL CDECL nulldrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep ) DECLSPEC_HIDDEN;
597 extern BOOL CDECL nulldrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
598 extern BOOL CDECL nulldrv_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
599 extern BOOL CDECL nulldrv_CloseFigure( PHYSDEV dev ) DECLSPEC_HIDDEN;
600 extern BOOL CDECL nulldrv_EndPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
601 extern INT  CDECL nulldrv_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
602 extern INT  CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) DECLSPEC_HIDDEN;
603 extern BOOL CDECL nulldrv_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
604 extern BOOL CDECL nulldrv_FillRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush ) DECLSPEC_HIDDEN;
605 extern BOOL CDECL nulldrv_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
606 extern BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, INT height ) DECLSPEC_HIDDEN;
607 extern LONG CDECL nulldrv_GetBitmapBits( HBITMAP bitmap, void *bits, LONG size ) DECLSPEC_HIDDEN;
608 extern INT  CDECL nulldrv_GetDIBits( PHYSDEV dev, HBITMAP bitmap, UINT start, UINT lines, LPVOID bits, BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
609 extern COLORREF CDECL nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
610 extern INT  CDECL nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
611 extern BOOL CDECL nulldrv_InvertRgn( PHYSDEV dev, HRGN rgn ) DECLSPEC_HIDDEN;
612 extern BOOL CDECL nulldrv_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD mode ) DECLSPEC_HIDDEN;
613 extern INT  CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
614 extern BOOL CDECL nulldrv_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
615 extern BOOL CDECL nulldrv_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
616 extern BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count ) DECLSPEC_HIDDEN;
617 extern BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) DECLSPEC_HIDDEN;
618 extern BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWORD count ) DECLSPEC_HIDDEN;
619 extern BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) DECLSPEC_HIDDEN;
620 extern BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN;
621 extern INT  CDECL nulldrv_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
622 extern BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
623 extern BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
624 extern BOOL CDECL nulldrv_SelectClipPath( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
625 extern LONG CDECL nulldrv_SetBitmapBits( HBITMAP bitmap, const void *bits, LONG size ) DECLSPEC_HIDDEN;
626 extern INT  CDECL nulldrv_SetDIBits( PHYSDEV dev, HBITMAP bitmap, UINT start, UINT lines, const void *bits, const BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
627 extern INT  CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
628 extern BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN;
629 extern BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
630 extern BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN;
631 extern BOOL CDECL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
632 extern BOOL CDECL nulldrv_SetWorldTransform( PHYSDEV dev, const XFORM *xform ) DECLSPEC_HIDDEN;
633 extern BOOL CDECL nulldrv_StretchBlt( PHYSDEV dst_dev, INT xDst, INT yDst, INT widthDst, INT heightDst,
634                                       PHYSDEV src_dev, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop ) DECLSPEC_HIDDEN;
635 extern INT  CDECL nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT heightDst,
636                                          INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, const void *bits,
637                                          const BITMAPINFO *info, UINT coloruse, DWORD rop ) DECLSPEC_HIDDEN;
638 extern BOOL CDECL nulldrv_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
639 extern BOOL CDECL nulldrv_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
640 extern BOOL CDECL nulldrv_WidenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
641
642 static inline DC *get_nulldrv_dc( PHYSDEV dev )
643 {
644     return CONTAINING_RECORD( dev, DC, nulldrv );
645 }
646
647 /* Undocumented value for DIB's iUsage: Indicates a mono DIB w/o pal entries */
648 #define DIB_PAL_MONO 2
649
650 BOOL WINAPI FontIsLinked(HDC);
651
652 BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res, DWORD horz_size, DWORD vert_size);
653
654 #endif /* __WINE_GDI_PRIVATE_H */