gdi32: Don't hold the GDI lock while calling the UnrealizeObject method for GDI objects.
[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 "wine/wingdi16.h"
26
27 /* Metafile defines */
28 #define META_EOF 0x0000
29 /* values of mtType in METAHEADER.  Note however that the disk image of a disk
30    based metafile has mtType == 1 */
31 #define METAFILE_MEMORY 1
32 #define METAFILE_DISK   2
33 #define MFHEADERSIZE (sizeof(METAHEADER))
34 #define MFVERSION 0x300
35
36 typedef struct {
37     EMR   emr;
38     INT   nBreakExtra;
39     INT   nBreakCount;
40 } EMRSETTEXTJUSTIFICATION, *PEMRSETTEXTJUSTIFICATION;
41
42 /* extra stock object: default 1x1 bitmap for memory DCs */
43 #define DEFAULT_BITMAP (STOCK_LAST+1)
44
45   /* GDI objects magic numbers */
46 #define FIRST_MAGIC           0x4f47
47 #define PEN_MAGIC             0x4f47
48 #define BRUSH_MAGIC           0x4f48
49 #define FONT_MAGIC            0x4f49
50 #define PALETTE_MAGIC         0x4f4a
51 #define BITMAP_MAGIC          0x4f4b
52 #define REGION_MAGIC          0x4f4c
53 #define DC_MAGIC              0x4f4d
54 #define DISABLED_DC_MAGIC     0x4f4e
55 #define META_DC_MAGIC         0x4f4f
56 #define METAFILE_MAGIC        0x4f50
57 #define METAFILE_DC_MAGIC     0x4f51
58 #define ENHMETAFILE_MAGIC     0x4f52
59 #define ENHMETAFILE_DC_MAGIC  0x4f53
60 #define MEMORY_DC_MAGIC       0x4f54
61 #define EXT_PEN_MAGIC         0x4f55
62 #define LAST_MAGIC            0x4f55
63
64 #define MAGIC_DONTCARE        0xffff
65
66 /* GDI constants for making objects private/system (naming undoc. !) */
67 #define OBJECT_PRIVATE        0x2000
68 #define OBJECT_NOSYSTEM       0x8000
69
70 #define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
71
72 struct gdi_obj_funcs
73 {
74     HGDIOBJ (*pSelectObject)( HGDIOBJ handle, HDC hdc );
75     INT     (*pGetObjectA)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
76     INT     (*pGetObjectW)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
77     BOOL    (*pUnrealizeObject)( HGDIOBJ handle );
78     BOOL    (*pDeleteObject)( HGDIOBJ handle );
79 };
80
81 struct hdc_list
82 {
83     HDC hdc;
84     struct hdc_list *next;
85 };
86
87 typedef struct tagGDIOBJHDR
88 {
89     WORD        wMagic;
90     DWORD       dwCount;
91     const struct gdi_obj_funcs *funcs;
92     struct hdc_list *hdcs;
93 } GDIOBJHDR;
94
95 /* Device functions for the Wine driver interface */
96
97 typedef struct { int opaque; } *PHYSDEV;  /* PHYSDEV is an opaque pointer */
98
99 typedef struct tagDC_FUNCS
100 {
101     INT      (CDECL *pAbortDoc)(PHYSDEV);
102     BOOL     (CDECL *pAbortPath)(PHYSDEV);
103     BOOL     (CDECL *pAlphaBlend)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,BLENDFUNCTION);
104     BOOL     (CDECL *pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
105     BOOL     (CDECL *pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
106     BOOL     (CDECL *pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
107     BOOL     (CDECL *pBeginPath)(PHYSDEV);
108     BOOL     (CDECL *pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
109     INT      (CDECL *pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
110     BOOL     (CDECL *pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
111     BOOL     (CDECL *pCloseFigure)(PHYSDEV);
112     BOOL     (CDECL *pCreateBitmap)(PHYSDEV,HBITMAP,LPVOID);
113     BOOL     (CDECL *pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
114     HBITMAP  (CDECL *pCreateDIBSection)(PHYSDEV,HBITMAP,const BITMAPINFO *,UINT);
115     BOOL     (CDECL *pDeleteBitmap)(HBITMAP);
116     BOOL     (CDECL *pDeleteDC)(PHYSDEV);
117     BOOL     (CDECL *pDeleteObject)(PHYSDEV,HGDIOBJ);
118     INT      (CDECL *pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
119     DWORD    (CDECL *pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
120     BOOL     (CDECL *pEllipse)(PHYSDEV,INT,INT,INT,INT);
121     INT      (CDECL *pEndDoc)(PHYSDEV);
122     INT      (CDECL *pEndPage)(PHYSDEV);
123     BOOL     (CDECL *pEndPath)(PHYSDEV);
124     BOOL     (CDECL *pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
125     INT      (CDECL *pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
126     INT      (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
127     INT      (CDECL *pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
128     BOOL     (CDECL *pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
129     INT      (CDECL *pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
130     BOOL     (CDECL *pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
131     BOOL     (CDECL *pFillPath)(PHYSDEV);
132     BOOL     (CDECL *pFillRgn)(PHYSDEV,HRGN,HBRUSH);
133     BOOL     (CDECL *pFlattenPath)(PHYSDEV);
134     BOOL     (CDECL *pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
135     BOOL     (CDECL *pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
136     LONG     (CDECL *pGetBitmapBits)(HBITMAP,void*,LONG);
137     BOOL     (CDECL *pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
138     BOOL     (CDECL *pGetDCOrgEx)(PHYSDEV,LPPOINT);
139     UINT     (CDECL *pGetDIBColorTable)(PHYSDEV,UINT,UINT,RGBQUAD*);
140     INT      (CDECL *pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
141     INT      (CDECL *pGetDeviceCaps)(PHYSDEV,INT);
142     BOOL     (CDECL *pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
143     BOOL     (CDECL *pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR);
144     COLORREF (CDECL *pGetNearestColor)(PHYSDEV,COLORREF);
145     COLORREF (CDECL *pGetPixel)(PHYSDEV,INT,INT);
146     INT      (CDECL *pGetPixelFormat)(PHYSDEV);
147     UINT     (CDECL *pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
148     BOOL     (CDECL *pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE);
149     BOOL     (CDECL *CDECL pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
150     INT      (CDECL *pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
151     BOOL     (CDECL *pInvertRgn)(PHYSDEV,HRGN);
152     BOOL     (CDECL *pLineTo)(PHYSDEV,INT,INT);
153     BOOL     (CDECL *pModifyWorldTransform)(PHYSDEV,const XFORM*,INT);
154     BOOL     (CDECL *pMoveTo)(PHYSDEV,INT,INT);
155     INT      (CDECL *pOffsetClipRgn)(PHYSDEV,INT,INT);
156     INT      (CDECL *pOffsetViewportOrg)(PHYSDEV,INT,INT);
157     INT      (CDECL *pOffsetWindowOrg)(PHYSDEV,INT,INT);
158     BOOL     (CDECL *pPaintRgn)(PHYSDEV,HRGN);
159     BOOL     (CDECL *pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD);
160     BOOL     (CDECL *pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
161     BOOL     (CDECL *pPolyBezier)(PHYSDEV,const POINT*,DWORD);
162     BOOL     (CDECL *pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
163     BOOL     (CDECL *pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
164     BOOL     (CDECL *pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
165     BOOL     (CDECL *pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
166     BOOL     (CDECL *pPolygon)(PHYSDEV,const POINT*,INT);
167     BOOL     (CDECL *pPolyline)(PHYSDEV,const POINT*,INT);
168     BOOL     (CDECL *pPolylineTo)(PHYSDEV,const POINT*,INT);
169     UINT     (CDECL *pRealizeDefaultPalette)(PHYSDEV);
170     UINT     (CDECL *pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
171     BOOL     (CDECL *pRectangle)(PHYSDEV,INT,INT,INT,INT);
172     HDC      (CDECL *pResetDC)(PHYSDEV,const DEVMODEW*);
173     BOOL     (CDECL *pRestoreDC)(PHYSDEV,INT);
174     BOOL     (CDECL *pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
175     INT      (CDECL *pSaveDC)(PHYSDEV);
176     INT      (CDECL *pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT);
177     INT      (CDECL *pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT);
178     HBITMAP  (CDECL *pSelectBitmap)(PHYSDEV,HBITMAP);
179     HBRUSH   (CDECL *pSelectBrush)(PHYSDEV,HBRUSH);
180     BOOL     (CDECL *pSelectClipPath)(PHYSDEV,INT);
181     HFONT    (CDECL *pSelectFont)(PHYSDEV,HFONT,HANDLE);
182     HPALETTE (CDECL *pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
183     HPEN     (CDECL *pSelectPen)(PHYSDEV,HPEN);
184     INT      (CDECL *pSetArcDirection)(PHYSDEV,INT);
185     LONG     (CDECL *pSetBitmapBits)(HBITMAP,const void*,LONG);
186     COLORREF (CDECL *pSetBkColor)(PHYSDEV,COLORREF);
187     INT      (CDECL *pSetBkMode)(PHYSDEV,INT);
188     COLORREF (CDECL *pSetDCBrushColor)(PHYSDEV, COLORREF);
189     DWORD    (CDECL *pSetDCOrg)(PHYSDEV,INT,INT);
190     COLORREF (CDECL *pSetDCPenColor)(PHYSDEV, COLORREF);
191     UINT     (CDECL *pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
192     INT      (CDECL *pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
193     INT      (CDECL *pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
194                                            const BITMAPINFO*,UINT);
195     VOID     (CDECL *pSetDeviceClipping)(PHYSDEV,HRGN,HRGN);
196     BOOL     (CDECL *pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
197     INT      (CDECL *pSetMapMode)(PHYSDEV,INT);
198     DWORD    (CDECL *pSetMapperFlags)(PHYSDEV,DWORD);
199     COLORREF (CDECL *pSetPixel)(PHYSDEV,INT,INT,COLORREF);
200     BOOL     (CDECL *pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
201     INT      (CDECL *pSetPolyFillMode)(PHYSDEV,INT);
202     INT      (CDECL *pSetROP2)(PHYSDEV,INT);
203     INT      (CDECL *pSetRelAbs)(PHYSDEV,INT);
204     INT      (CDECL *pSetStretchBltMode)(PHYSDEV,INT);
205     UINT     (CDECL *pSetTextAlign)(PHYSDEV,UINT);
206     INT      (CDECL *pSetTextCharacterExtra)(PHYSDEV,INT);
207     DWORD    (CDECL *pSetTextColor)(PHYSDEV,DWORD);
208     INT      (CDECL *pSetTextJustification)(PHYSDEV,INT,INT);
209     INT      (CDECL *pSetViewportExt)(PHYSDEV,INT,INT);
210     INT      (CDECL *pSetViewportOrg)(PHYSDEV,INT,INT);
211     INT      (CDECL *pSetWindowExt)(PHYSDEV,INT,INT);
212     INT      (CDECL *pSetWindowOrg)(PHYSDEV,INT,INT);
213     BOOL     (CDECL *pSetWorldTransform)(PHYSDEV,const XFORM*);
214     INT      (CDECL *pStartDoc)(PHYSDEV,const DOCINFOW*);
215     INT      (CDECL *pStartPage)(PHYSDEV);
216     BOOL     (CDECL *pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
217     INT      (CDECL *pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
218                                        const BITMAPINFO*,UINT,DWORD);
219     BOOL     (CDECL *pStrokeAndFillPath)(PHYSDEV);
220     BOOL     (CDECL *pStrokePath)(PHYSDEV);
221     BOOL     (CDECL *pSwapBuffers)(PHYSDEV);
222     BOOL     (CDECL *pUnrealizePalette)(HPALETTE);
223     BOOL     (CDECL *pWidenPath)(PHYSDEV);
224
225     /* OpenGL32 */
226     BOOL     (CDECL *pwglCopyContext)(HGLRC, HGLRC, UINT);
227     HGLRC    (CDECL *pwglCreateContext)(PHYSDEV);
228     BOOL     (CDECL *pwglDeleteContext)(HGLRC);
229     PROC     (CDECL *pwglGetProcAddress)(LPCSTR);
230     HDC      (CDECL *pwglGetPbufferDCARB)(PHYSDEV, void*);
231     BOOL     (CDECL *pwglMakeCurrent)(PHYSDEV, HGLRC);
232     BOOL     (CDECL *pwglMakeContextCurrentARB)(PHYSDEV, PHYSDEV, HGLRC);
233     BOOL     (CDECL *pwglSetPixelFormatWINE)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
234     BOOL     (CDECL *pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
235     BOOL     (CDECL *pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD);
236     BOOL     (CDECL *pwglUseFontBitmapsW)(PHYSDEV, DWORD, DWORD, DWORD);
237 } DC_FUNCTIONS;
238
239 /* It should not be necessary to access the contents of the GdiPath
240  * structure directly; if you find that the exported functions don't
241  * allow you to do what you want, then please place a new exported
242  * function that does this job in path.c.
243  */
244 typedef enum tagGdiPathState
245 {
246    PATH_Null,
247    PATH_Open,
248    PATH_Closed
249 } GdiPathState;
250
251 typedef struct tagGdiPath
252 {
253    GdiPathState state;
254    POINT      *pPoints;
255    BYTE         *pFlags;
256    int          numEntriesUsed, numEntriesAllocated;
257    BOOL       newStroke;
258 } GdiPath;
259
260 typedef struct tagGdiFont GdiFont;
261
262 struct saved_visrgn
263 {
264     struct saved_visrgn *next;
265     HRGN                 hrgn;
266 };
267
268 typedef struct tagDC
269 {
270     GDIOBJHDR    header;
271     HDC          hSelf;            /* Handle to this DC */
272     const struct tagDC_FUNCS *funcs; /* DC function table */
273     PHYSDEV      physDev;         /* Physical device (driver-specific) */
274     DWORD        thread;          /* thread owning the DC */
275     LONG         refcount;        /* thread refcount */
276     LONG         dirty;           /* dirty flag */
277     INT          saveLevel;
278     HDC          saved_dc;
279     DWORD_PTR    dwHookData;
280     FARPROC16    hookProc;         /* the original SEGPTR ... */
281     DCHOOKPROC   hookThunk;        /* ... and the thunk to call it */
282
283     INT          wndOrgX;          /* Window origin */
284     INT          wndOrgY;
285     INT          wndExtX;          /* Window extent */
286     INT          wndExtY;
287     INT          vportOrgX;        /* Viewport origin */
288     INT          vportOrgY;
289     INT          vportExtX;        /* Viewport extent */
290     INT          vportExtY;
291     FLOAT        miterLimit;
292
293     int           flags;
294     DWORD         layout;
295     HRGN          hClipRgn;      /* Clip region (may be 0) */
296     HRGN          hMetaRgn;      /* Meta region (may be 0) */
297     HRGN          hMetaClipRgn;  /* Intersection of meta and clip regions (may be 0) */
298     HRGN          hVisRgn;       /* Visible region (must never be 0) */
299     HPEN          hPen;
300     HBRUSH        hBrush;
301     HFONT         hFont;
302     HBITMAP       hBitmap;
303     HANDLE        hDevice;
304     HPALETTE      hPalette;
305
306     GdiFont      *gdiFont;
307     GdiPath       path;
308
309     WORD          ROPmode;
310     WORD          polyFillMode;
311     WORD          stretchBltMode;
312     WORD          relAbsMode;
313     WORD          backgroundMode;
314     COLORREF      backgroundColor;
315     COLORREF      textColor;
316     COLORREF      dcBrushColor;
317     COLORREF      dcPenColor;
318     short         brushOrgX;
319     short         brushOrgY;
320
321     WORD          textAlign;         /* Text alignment from SetTextAlign() */
322     INT           charExtra;         /* Spacing from SetTextCharacterExtra() */
323     INT           breakExtra;        /* breakTotalExtra / breakCount */
324     INT           breakRem;          /* breakTotalExtra % breakCount */
325     INT           MapMode;
326     INT           GraphicsMode;      /* Graphics mode */
327     ABORTPROC     pAbortProc;        /* AbortProc for Printing */
328     ABORTPROC16   pAbortProc16;
329     INT           CursPosX;          /* Current position */
330     INT           CursPosY;
331     INT           ArcDirection;
332     XFORM         xformWorld2Wnd;    /* World-to-window transformation */
333     XFORM         xformWorld2Vport;  /* World-to-viewport transformation */
334     XFORM         xformVport2World;  /* Inverse of the above transformation */
335     BOOL          vport2WorldValid;  /* Is xformVport2World valid? */
336     RECT          BoundsRect;        /* Current bounding rect */
337
338     struct saved_visrgn *saved_visrgn;
339 } DC;
340
341   /* DC flags */
342 #define DC_SAVED         0x0002   /* It is a saved DC */
343 #define DC_BOUNDS_ENABLE 0x0008   /* Bounding rectangle tracking is enabled */
344 #define DC_BOUNDS_SET    0x0010   /* Bounding rectangle has been set */
345
346 /* Certain functions will do no further processing if the driver returns this.
347    Used by mfdrv for example. */
348 #define GDI_NO_MORE_WORK 2
349
350 /* Rounds a floating point number to integer. The world-to-viewport
351  * transformation process is done in floating point internally. This function
352  * is then used to round these coordinates to integer values.
353  */
354 static inline INT GDI_ROUND(double val)
355 {
356    return (int)floor(val + 0.5);
357 }
358
359 /* bitmap object */
360
361 typedef struct tagBITMAPOBJ
362 {
363     GDIOBJHDR           header;
364     BITMAP              bitmap;
365     SIZE                size;   /* For SetBitmapDimension() */
366     const DC_FUNCTIONS *funcs; /* DC function table */
367     /* For device-independent bitmaps: */
368     DIBSECTION         *dib;
369     SEGPTR              segptr_bits;  /* segptr to DIB bits */
370     RGBQUAD            *color_table;  /* DIB color table if <= 8bpp */
371     UINT                nb_colors;    /* number of colors in table */
372 } BITMAPOBJ;
373
374 /* bidi.c */
375
376 /* Wine_GCPW Flags */
377 /* Directionality -
378  * LOOSE means taking the directionality of the first strong character, if there is found one.
379  * FORCE means the paragraph direction is forced. (RLE/LRE)
380  */
381 #define WINE_GCPW_FORCE_LTR 0
382 #define WINE_GCPW_FORCE_RTL 1
383 #define WINE_GCPW_LOOSE_LTR 2
384 #define WINE_GCPW_LOOSE_RTL 3
385 #define WINE_GCPW_DIR_MASK 3
386 #define WINE_GCPW_LOOSE_MASK 2
387
388 extern BOOL BIDI_Reorder( LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
389                           LPWSTR lpOutString, INT uCountOut, UINT *lpOrder ) DECLSPEC_HIDDEN;
390
391 /* bitmap.c */
392 extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN;
393 extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc ) DECLSPEC_HIDDEN;
394 extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN;
395
396 /* clipping.c */
397 extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN;
398
399 /* dc.c */
400 extern DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic ) DECLSPEC_HIDDEN;
401 extern BOOL free_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
402 extern DC *get_dc_ptr( HDC hdc ) DECLSPEC_HIDDEN;
403 extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
404 extern void update_dc( DC *dc ) DECLSPEC_HIDDEN;
405 extern void DC_InitDC( DC * dc ) DECLSPEC_HIDDEN;
406 extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
407
408 /* dib.c */
409 extern int DIB_GetDIBWidthBytes( int width, int depth ) DECLSPEC_HIDDEN;
410 extern int DIB_GetDIBImageBytes( int width, int height, int depth ) DECLSPEC_HIDDEN;
411 extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
412
413 /* driver.c */
414 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
415 extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs ) DECLSPEC_HIDDEN;
416 extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs ) DECLSPEC_HIDDEN;
417 extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN;
418
419 /* enhmetafile.c */
420 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
421
422 /* freetype.c */
423
424 /* Undocumented structure filled in by GdiRealizationInfo */
425 typedef struct
426 {
427     DWORD flags;       /* 1 for bitmap fonts, 3 for scalable fonts */
428     DWORD cache_num;   /* keeps incrementing - num of fonts that have been created allowing for caching?? */
429     DWORD unknown2;    /* fixed for a given font - looks like it could be the order of the face in the font list or the order
430                           in which the face was first rendered. */
431 } realization_info_t;
432
433
434 extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
435 extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
436 extern GdiFont* WineEngCreateFontInstance(DC*, HFONT) DECLSPEC_HIDDEN;
437 extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
438 extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM) DECLSPEC_HIDDEN;
439 extern BOOL WineEngGetCharABCWidths(GdiFont *font, UINT firstChar,
440                                     UINT lastChar, LPABC buffer) DECLSPEC_HIDDEN;
441 extern BOOL WineEngGetCharABCWidthsI(GdiFont *font, UINT firstChar,
442                                     UINT count, LPWORD pgi, LPABC buffer) DECLSPEC_HIDDEN;
443 extern BOOL WineEngGetCharWidth(GdiFont*, UINT, UINT, LPINT) DECLSPEC_HIDDEN;
444 extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
445 extern DWORD WineEngGetFontUnicodeRanges(GdiFont *, LPGLYPHSET) DECLSPEC_HIDDEN;
446 extern DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
447                                     LPWORD pgi, DWORD flags) DECLSPEC_HIDDEN;
448 extern DWORD WineEngGetGlyphOutline(GdiFont*, UINT glyph, UINT format,
449                                     LPGLYPHMETRICS, DWORD buflen, LPVOID buf,
450                                     const MAT2*) DECLSPEC_HIDDEN;
451 extern DWORD WineEngGetKerningPairs(GdiFont*, DWORD, KERNINGPAIR *) DECLSPEC_HIDDEN;
452 extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN;
453 extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) DECLSPEC_HIDDEN;
454 extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;
455 extern BOOL WineEngGetTextExtentExPoint(GdiFont*, LPCWSTR, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
456 extern BOOL WineEngGetTextExtentExPointI(GdiFont*, const WORD *, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
457 extern INT  WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
458 extern BOOL WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW) DECLSPEC_HIDDEN;
459 extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
460 extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
461 extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN;
462 extern BOOL WineEngRemoveFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
463
464 /* gdiobj.c */
465 extern BOOL GDI_Init(void) DECLSPEC_HIDDEN;
466 extern void *GDI_AllocObject( WORD, WORD, HGDIOBJ *, const struct gdi_obj_funcs *funcs ) DECLSPEC_HIDDEN;
467 extern void *GDI_ReallocObject( WORD, HGDIOBJ, void *obj ) DECLSPEC_HIDDEN;
468 extern BOOL GDI_FreeObject( HGDIOBJ, void *obj ) DECLSPEC_HIDDEN;
469 extern void *GDI_GetObjPtr( HGDIOBJ, WORD ) DECLSPEC_HIDDEN;
470 extern void GDI_ReleaseObj( HGDIOBJ ) DECLSPEC_HIDDEN;
471 extern void GDI_CheckNotLock(void) DECLSPEC_HIDDEN;
472 extern BOOL GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
473 extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
474 extern BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
475 extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
476
477 /* metafile.c */
478 extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
479 extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) DECLSPEC_HIDDEN;
480 extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN;
481 extern METAHEADER *MF_ReadMetaFile(HANDLE hfile) DECLSPEC_HIDDEN;
482 extern METAHEADER *MF_LoadDiskBasedMetaFile(METAHEADER *mh) DECLSPEC_HIDDEN;
483 extern BOOL MF_PlayMetaFile( HDC hdc, METAHEADER *mh) DECLSPEC_HIDDEN;
484
485 /* path.c */
486
487 #define PATH_IsPathOpen(path) ((path).state==PATH_Open)
488 /* Returns TRUE if the specified path is in the open state, i.e. in the
489  * state where points will be added to the path, or FALSE otherwise. This
490  * function is implemented as a macro for performance reasons.
491  */
492
493 extern void PATH_InitGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN;
494 extern void PATH_DestroyGdiPath(GdiPath *pPath) DECLSPEC_HIDDEN;
495 extern BOOL PATH_AssignGdiPath(GdiPath *pPathDest, const GdiPath *pPathSrc) DECLSPEC_HIDDEN;
496
497 extern BOOL PATH_MoveTo(DC *dc) DECLSPEC_HIDDEN;
498 extern BOOL PATH_LineTo(DC *dc, INT x, INT y) DECLSPEC_HIDDEN;
499 extern BOOL PATH_Rectangle(DC *dc, INT x1, INT y1, INT x2, INT y2) DECLSPEC_HIDDEN;
500 extern BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc,
501                             LPCWSTR str, UINT count, const INT *dx) DECLSPEC_HIDDEN;
502 extern BOOL PATH_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2) DECLSPEC_HIDDEN;
503 extern BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
504                      INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines) DECLSPEC_HIDDEN;
505 extern BOOL PATH_PolyBezierTo(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
506 extern BOOL PATH_PolyBezier(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
507 extern BOOL PATH_PolyDraw(DC *dc, const POINT *pts, const BYTE *types, DWORD cbCount) DECLSPEC_HIDDEN;
508 extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
509 extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
510 extern BOOL PATH_Polygon(DC *dc, const POINT *pt, DWORD cbCount) DECLSPEC_HIDDEN;
511 extern BOOL PATH_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines) DECLSPEC_HIDDEN;
512 extern BOOL PATH_PolyPolygon(DC *dc, const POINT *pt, const INT *counts, UINT polygons) DECLSPEC_HIDDEN;
513 extern BOOL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height) DECLSPEC_HIDDEN;
514
515 /* painting.c */
516 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN;
517
518 /* palette.c */
519 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg);
520 extern UINT WINAPI GDIRealizePalette( HDC hdc );
521 extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN;
522
523 /* region.c */
524 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ) DECLSPEC_HIDDEN;
525
526 /* Undocumented value for DIB's iUsage: Indicates a mono DIB w/o pal entries */
527 #define DIB_PAL_MONO 2
528
529 BOOL WINAPI FontIsLinked(HDC);
530
531 #endif /* __WINE_GDI_PRIVATE_H */