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