Remove races from DPMI async event handling.
[wine] / include / gdi.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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_GDI_H
22 #define __WINE_GDI_H
23
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <wingdi.h>
28 #include <wine/wingdi16.h>
29 #include <math.h>
30
31   /* GDI objects magic numbers */
32 #define FIRST_MAGIC           0x4f47
33 #define PEN_MAGIC             0x4f47
34 #define BRUSH_MAGIC           0x4f48
35 #define FONT_MAGIC            0x4f49
36 #define PALETTE_MAGIC         0x4f4a
37 #define BITMAP_MAGIC          0x4f4b
38 #define REGION_MAGIC          0x4f4c
39 #define DC_MAGIC              0x4f4d
40 #define DISABLED_DC_MAGIC     0x4f4e
41 #define META_DC_MAGIC         0x4f4f
42 #define METAFILE_MAGIC        0x4f50
43 #define METAFILE_DC_MAGIC     0x4f51
44 #define ENHMETAFILE_MAGIC     0x4f52
45 #define ENHMETAFILE_DC_MAGIC  0x4f53
46 #define MEMORY_DC_MAGIC       0x4f54
47 #define LAST_MAGIC            0x4f54
48
49 #define MAGIC_DONTCARE        0xffff
50
51 /* GDI constants for making objects private/system (naming undoc. !) */
52 #define OBJECT_PRIVATE        0x2000
53 #define OBJECT_NOSYSTEM       0x8000
54
55 #define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
56
57 struct gdi_obj_funcs
58 {
59     HGDIOBJ (*pSelectObject)( HGDIOBJ handle, void *obj, HDC hdc );
60     INT     (*pGetObject16)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
61     INT     (*pGetObjectA)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
62     INT     (*pGetObjectW)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
63     BOOL    (*pUnrealizeObject)( HGDIOBJ handle, void *obj );
64     BOOL    (*pDeleteObject)( HGDIOBJ handle, void *obj );
65 };
66
67 typedef struct tagGDIOBJHDR
68 {
69     HANDLE16    hNext;
70     WORD        wMagic;
71     DWORD       dwCount;
72     const struct gdi_obj_funcs *funcs;
73 } GDIOBJHDR;
74
75
76 /* It should not be necessary to access the contents of the GdiPath
77  * structure directly; if you find that the exported functions don't
78  * allow you to do what you want, then please place a new exported
79  * function that does this job in path.c.
80  */
81 typedef enum tagGdiPathState
82 {
83    PATH_Null,
84    PATH_Open,
85    PATH_Closed
86 } GdiPathState;
87
88 typedef struct tagGdiPath
89 {
90    GdiPathState state;
91    POINT      *pPoints;
92    BYTE         *pFlags;
93    int          numEntriesUsed, numEntriesAllocated;
94    BOOL       newStroke;
95 } GdiPath;
96
97 typedef struct tagGdiFont *GdiFont;
98
99 typedef struct { int opaque; } *PHYSDEV;  /* PHYSDEV is an opaque pointer */
100
101 typedef struct tagDC
102 {
103     GDIOBJHDR    header;
104     HDC          hSelf;            /* Handle to this DC */
105     const struct tagDC_FUNCS *funcs; /* DC function table */
106     PHYSDEV      physDev;         /* Physical device (driver-specific) */
107     INT          saveLevel;
108     DWORD        dwHookData;
109     FARPROC16    hookProc;         /* the original SEGPTR ... */
110     DCHOOKPROC   hookThunk;        /* ... and the thunk to call it */
111
112     INT          wndOrgX;          /* Window origin */
113     INT          wndOrgY;
114     INT          wndExtX;          /* Window extent */
115     INT          wndExtY;
116     INT          vportOrgX;        /* Viewport origin */
117     INT          vportOrgY;
118     INT          vportExtX;        /* Viewport extent */
119     INT          vportExtY;
120
121     int           flags;
122     HRGN          hClipRgn;     /* Clip region (may be 0) */
123     HRGN          hVisRgn;      /* Visible region (must never be 0) */
124     HRGN          hGCClipRgn;   /* GC clip region (ClipRgn AND VisRgn) */
125     HPEN          hPen;
126     HBRUSH        hBrush;
127     HFONT         hFont;
128     HBITMAP       hBitmap;
129     HANDLE        hDevice;
130     HPALETTE      hPalette;
131
132     GdiFont       gdiFont;
133     GdiPath       path;
134
135     WORD          ROPmode;
136     WORD          polyFillMode;
137     WORD          stretchBltMode;
138     WORD          relAbsMode;
139     WORD          backgroundMode;
140     COLORREF      backgroundColor;
141     COLORREF      textColor;
142     short         brushOrgX;
143     short         brushOrgY;
144
145     WORD          textAlign;         /* Text alignment from SetTextAlign() */
146     short         charExtra;         /* Spacing from SetTextCharacterExtra() */
147     short         breakTotalExtra;   /* Total extra space for justification */
148     short         breakCount;        /* Break char. count */
149     short         breakExtra;        /* breakTotalExtra / breakCount */
150     short         breakRem;          /* breakTotalExtra % breakCount */
151
152     RECT          totalExtent;
153     BYTE          bitsPerPixel;
154
155     INT           MapMode;
156     INT           GraphicsMode;      /* Graphics mode */
157     ABORTPROC     pAbortProc;        /* AbortProc for Printing */
158     ABORTPROC16   pAbortProc16;
159     INT           CursPosX;          /* Current position */
160     INT           CursPosY;
161     INT           ArcDirection;
162     XFORM         xformWorld2Wnd;    /* World-to-window transformation */
163     XFORM         xformWorld2Vport;  /* World-to-viewport transformation */
164     XFORM         xformVport2World;  /* Inverse of the above transformation */
165     BOOL          vport2WorldValid;  /* Is xformVport2World valid? */
166 } DC;
167
168 /* Device functions for the Wine driver interface */
169
170 typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,NEWTEXTMETRICEXW *,DWORD,
171                                   LPARAM);
172
173 typedef struct tagDC_FUNCS
174 {
175     INT      (*pAbortDoc)(PHYSDEV);
176     BOOL     (*pAbortPath)(PHYSDEV);
177     BOOL     (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
178     BOOL     (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
179     BOOL     (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
180     BOOL     (*pBeginPath)(PHYSDEV);
181     BOOL     (*pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
182     INT      (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
183     BOOL     (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
184     BOOL     (*pCloseFigure)(PHYSDEV);
185     BOOL     (*pCreateBitmap)(PHYSDEV,HBITMAP);
186     BOOL     (*pCreateDC)(DC *,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
187     HBITMAP  (*pCreateDIBSection)(PHYSDEV,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD,DWORD);
188     BOOL     (*pDeleteBitmap)(HBITMAP);
189     BOOL     (*pDeleteDC)(PHYSDEV);
190     INT      (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
191     DWORD    (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
192     BOOL     (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
193     INT      (*pEndDoc)(PHYSDEV);
194     INT      (*pEndPage)(PHYSDEV);
195     BOOL     (*pEndPath)(PHYSDEV);
196     BOOL     (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
197     INT      (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
198     INT      (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
199     INT      (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
200     BOOL     (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
201     INT      (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
202     BOOL     (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
203     BOOL     (*pFillPath)(PHYSDEV);
204     BOOL     (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
205     BOOL     (*pFlattenPath)(PHYSDEV);
206     BOOL     (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
207     BOOL     (*pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
208     LONG     (*pGetBitmapBits)(HBITMAP,void*,LONG);
209     BOOL     (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
210     BOOL     (*pGetDCOrgEx)(PHYSDEV,LPPOINT);
211     UINT     (*pGetDIBColorTable)(PHYSDEV,UINT,UINT,RGBQUAD*);
212     INT      (*pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
213     INT      (*pGetDeviceCaps)(PHYSDEV,INT);
214     BOOL     (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
215     COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
216     COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
217     INT      (*pGetPixelFormat)(PHYSDEV);
218     UINT     (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
219     BOOL     (*pGetTextExtentPoint)(PHYSDEV,LPCWSTR,INT,LPSIZE);
220     BOOL     (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
221     INT      (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
222     BOOL     (*pInvertRgn)(PHYSDEV,HRGN);
223     BOOL     (*pLineTo)(PHYSDEV,INT,INT);
224     BOOL     (*pModifyWorldTransform)(PHYSDEV,const XFORM*,INT);
225     BOOL     (*pMoveTo)(PHYSDEV,INT,INT);
226     INT      (*pOffsetClipRgn)(PHYSDEV,INT,INT);
227     INT      (*pOffsetViewportOrg)(PHYSDEV,INT,INT);
228     INT      (*pOffsetWindowOrg)(PHYSDEV,INT,INT);
229     BOOL     (*pPaintRgn)(PHYSDEV,HRGN);
230     BOOL     (*pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD);
231     BOOL     (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
232     BOOL     (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
233     BOOL     (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
234     BOOL     (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
235     BOOL     (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
236     BOOL     (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
237     BOOL     (*pPolygon)(PHYSDEV,const POINT*,INT);
238     BOOL     (*pPolyline)(PHYSDEV,const POINT*,INT);
239     BOOL     (*pPolylineTo)(PHYSDEV,const POINT*,INT);
240     UINT     (*pRealizeDefaultPalette)(PHYSDEV);
241     UINT     (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
242     BOOL     (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
243     HDC      (*pResetDC)(PHYSDEV,const DEVMODEA*);
244     BOOL     (*pRestoreDC)(PHYSDEV,INT);
245     BOOL     (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
246     INT      (*pSaveDC)(PHYSDEV);
247     INT      (*pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT);
248     INT      (*pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT);
249     HBITMAP  (*pSelectBitmap)(PHYSDEV,HBITMAP);
250     HBRUSH   (*pSelectBrush)(PHYSDEV,HBRUSH);
251     BOOL     (*pSelectClipPath)(PHYSDEV,INT);
252     HFONT    (*pSelectFont)(PHYSDEV,HFONT);
253     HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
254     HPEN     (*pSelectPen)(PHYSDEV,HPEN);
255     INT      (*pSetArcDirection)(PHYSDEV,INT);
256     LONG     (*pSetBitmapBits)(HBITMAP,const void*,LONG);
257     COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
258     INT      (*pSetBkMode)(PHYSDEV,INT);
259     DWORD    (*pSetDCOrg)(PHYSDEV,INT,INT);
260     UINT     (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
261     INT      (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
262     INT      (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
263                                    const BITMAPINFO*,UINT);
264     VOID     (*pSetDeviceClipping)(PHYSDEV,HRGN);
265     BOOL     (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
266     INT      (*pSetMapMode)(PHYSDEV,INT);
267     DWORD    (*pSetMapperFlags)(PHYSDEV,DWORD);
268     COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
269     BOOL     (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
270     INT      (*pSetPolyFillMode)(PHYSDEV,INT);
271     INT      (*pSetROP2)(PHYSDEV,INT);
272     INT      (*pSetRelAbs)(PHYSDEV,INT);
273     INT      (*pSetStretchBltMode)(PHYSDEV,INT);
274     UINT     (*pSetTextAlign)(PHYSDEV,UINT);
275     INT      (*pSetTextCharacterExtra)(PHYSDEV,INT);
276     DWORD    (*pSetTextColor)(PHYSDEV,DWORD);
277     INT      (*pSetTextJustification)(PHYSDEV,INT,INT);
278     INT      (*pSetViewportExt)(PHYSDEV,INT,INT);
279     INT      (*pSetViewportOrg)(PHYSDEV,INT,INT);
280     INT      (*pSetWindowExt)(PHYSDEV,INT,INT);
281     INT      (*pSetWindowOrg)(PHYSDEV,INT,INT);
282     BOOL     (*pSetWorldTransform)(PHYSDEV,const XFORM*);
283     INT      (*pStartDoc)(PHYSDEV,const DOCINFOA*);
284     INT      (*pStartPage)(PHYSDEV);
285     BOOL     (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
286     INT      (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
287                                const BITMAPINFO*,UINT,DWORD);
288     BOOL     (*pStrokeAndFillPath)(PHYSDEV);
289     BOOL     (*pStrokePath)(PHYSDEV);
290     BOOL     (*pSwapBuffers)(PHYSDEV);
291     BOOL     (*pWidenPath)(PHYSDEV);
292 } DC_FUNCTIONS;
293
294 /* Certain functions will do no further processing if the driver returns this.
295    Used by mfdrv for example. */
296 #define GDI_NO_MORE_WORK 2
297
298   /* DC hook codes */
299 #define DCHC_INVALIDVISRGN      0x0001
300 #define DCHC_DELETEDC           0x0002
301
302 #define DCHF_INVALIDATEVISRGN   0x0001
303 #define DCHF_VALIDATEVISRGN     0x0002
304
305   /* DC flags */
306 #define DC_SAVED      0x0002   /* It is a saved DC */
307 #define DC_DIRTY      0x0004   /* hVisRgn has to be updated */
308 #define DC_THUNKHOOK  0x0008   /* DC hook is in the 16-bit code */
309
310 #define GDI_HEAP_SIZE 0xffe0
311
312 /* extra stock object: default 1x1 bitmap for memory DCs */
313 #define DEFAULT_BITMAP (STOCK_LAST+1)
314
315 /* Metafile defines */
316
317 #define META_EOF 0x0000
318 /* values of mtType in METAHEADER.  Note however that the disk image of a disk
319    based metafile has mtType == 1 */
320 #define METAFILE_MEMORY 1
321 #define METAFILE_DISK   2
322
323 /* Rounds a floating point number to integer. The world-to-viewport
324  * transformation process is done in floating point internally. This function
325  * is then used to round these coordinates to integer values.
326  */
327 static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
328 {
329    return (int)floor(val + 0.5);
330 }
331
332   /* World -> Device size conversion */
333
334 /* Performs a world-to-viewport transformation on the specified width (which
335  * is in floating point format).
336  */
337 static inline void WINE_UNUSED INTERNAL_XWSTODS_FLOAT(DC *dc, FLOAT *width)
338 {
339     /* Perform the transformation */
340     *width = *width * dc->xformWorld2Vport.eM11;
341 }
342
343 /* Performs a world-to-viewport transformation on the specified width (which
344  * is in integer format).
345  */
346 static inline INT WINE_UNUSED INTERNAL_XWSTODS(DC *dc, INT width)
347 {
348     FLOAT floatWidth;
349
350     /* Perform operation with floating point */
351     floatWidth = (FLOAT)width;
352     INTERNAL_XWSTODS_FLOAT(dc, &floatWidth);
353
354     /* Round to integers */
355     return GDI_ROUND(floatWidth);
356 }
357
358
359 /* Performs a world-to-viewport transformation on the specified size (which
360  * is in floating point format).
361  */
362 static inline void WINE_UNUSED INTERNAL_YWSTODS_FLOAT(DC *dc, FLOAT *height)
363 {
364     /* Perform the transformation */
365     *height = *height * dc->xformWorld2Vport.eM22;
366 }
367
368 /* Performs a world-to-viewport transformation on the specified size (which
369  * is in integer format).
370  */
371 static inline INT WINE_UNUSED INTERNAL_YWSTODS(DC *dc, INT height)
372 {
373     FLOAT floatHeight;
374
375     /* Perform operation with floating point */
376     floatHeight = (FLOAT)height;
377     INTERNAL_YWSTODS_FLOAT(dc, &floatHeight);
378
379     /* Round to integers */
380     return GDI_ROUND(floatHeight);
381 }
382
383
384   /* Device -> World size conversion */
385
386 /* Performs a device to world transformation on the specified width (which
387  * is in floating point format).
388  */
389 static inline void INTERNAL_XDSTOWS_FLOAT(DC *dc, FLOAT *width)
390 {
391     /* Perform the transformation */
392     *width = *width * dc->xformVport2World.eM11;
393 }
394
395 /* Performs a device to world transformation on the specified width (which
396  * is in integer format).
397  */
398 static inline INT INTERNAL_XDSTOWS(DC *dc, INT width)
399 {
400     FLOAT floatWidth;
401
402     /* Perform operation with floating point */
403     floatWidth = (FLOAT)width;
404     INTERNAL_XDSTOWS_FLOAT(dc, &floatWidth);
405
406     /* Round to integers */
407     return GDI_ROUND(floatWidth);
408 }
409
410
411 /* Performs a device to world transformation on the specified size (which
412  * is in floating point format).
413  */
414 static inline void INTERNAL_YDSTOWS_FLOAT(DC *dc, FLOAT *height)
415 {
416     /* Perform the transformation */
417     *height = *height * dc->xformVport2World.eM22;
418 }
419
420 /* Performs a device to world transformation on the specified size (which
421  * is in integer format).
422  */
423 static inline INT INTERNAL_YDSTOWS(DC *dc, INT height)
424 {
425     FLOAT floatHeight;
426
427     /* Perform operation with floating point */
428     floatHeight = (FLOAT)height;
429     INTERNAL_YDSTOWS_FLOAT(dc, &floatHeight);
430
431     /* Round to integers */
432     return GDI_ROUND(floatHeight);
433 }
434
435
436   /* Device <-> logical size conversion */
437
438 #define XDSTOLS(dc,x) \
439     MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
440 #define YDSTOLS(dc,y) \
441     MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
442 #define XLSTODS(dc,x) \
443     MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
444 #define YLSTODS(dc,y) \
445     MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
446
447   /* GDI local heap */
448
449 extern BOOL GDI_Init(void);
450 extern void *GDI_AllocObject( WORD, WORD, HGDIOBJ *, const struct gdi_obj_funcs *funcs );
451 extern void *GDI_ReallocObject( WORD, HGDIOBJ, void *obj );
452 extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
453 extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
454 extern void GDI_ReleaseObj( HGDIOBJ );
455 extern void GDI_CheckNotLock(void);
456
457 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name );
458 extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
459 extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
460 extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size );
461
462 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
463
464 extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic );
465 extern DC * DC_GetDCPtr( HDC hdc );
466 extern DC * DC_GetDCUpdate( HDC hdc );
467 extern void DC_InitDC( DC * dc );
468 extern void DC_UpdateXforms( DC * dc );
469
470 /* bidi.c */
471
472 /* Wine_GCPW Flags */
473 /* Directionality -
474  * LOOSE means that the paragraph dir is only set if there is no strong character.
475  * FORCE means override the characters in the paragraph.
476  */
477 #define WINE_GCPW_FORCE_LTR 0
478 #define WINE_GCPW_FORCE_RTL 1
479 #define WINE_GCPW_LOOSE_LTR 2
480 #define WINE_GCPW_LOOSE_RTL 3
481 #define WINE_GCPW_DIR_MASK 3
482 extern BOOL BIDI_Reorder( LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
483                           LPWSTR lpOutString, INT uCountOut, UINT *lpOrder );
484 extern BOOL BidiAvail;
485
486 /* clipping.c */
487 extern void CLIPPING_UpdateGCRegion( DC * dc );
488
489 /* enhmetafile.c */
490 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
491
492 /* freetype.c */
493 extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID);
494 extern GdiFont WineEngCreateFontInstance(DC*, HFONT);
495 extern BOOL WineEngDestroyFontInstance(HFONT handle);
496 extern DWORD WineEngEnumFonts(LPLOGFONTW, DEVICEFONTENUMPROC, LPARAM);
497 extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT);
498 extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD);
499 extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count,
500                                     LPWORD pgi, DWORD flags);
501 extern DWORD WineEngGetGlyphOutline(GdiFont, UINT glyph, UINT format,
502                                     LPGLYPHMETRICS, DWORD buflen, LPVOID buf,
503                                     const MAT2*);
504 extern UINT WineEngGetOutlineTextMetrics(GdiFont, UINT, LPOUTLINETEXTMETRICW);
505 extern UINT WineEngGetTextCharsetInfo(GdiFont font, LPFONTSIGNATURE fs, DWORD flags);
506 extern BOOL WineEngGetTextExtentPoint(GdiFont, LPCWSTR, INT, LPSIZE);
507 extern BOOL WineEngGetTextExtentPointI(GdiFont, const WORD *, INT, LPSIZE);
508 extern INT  WineEngGetTextFace(GdiFont, INT, LPWSTR);
509 extern BOOL WineEngGetTextMetrics(GdiFont, LPTEXTMETRICW);
510 extern BOOL WineEngInit(void);
511 extern BOOL WineEngRemoveFontResourceEx(LPCWSTR, DWORD, PVOID);
512
513 /* metafile.c */
514 extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh);
515 extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh);
516 extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCSTR filename);
517
518 /* region.c */
519 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y );
520
521 /* palette.c */
522 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg);
523 extern UINT WINAPI GDIRealizePalette( HDC hdc );
524
525 /* path.c */
526
527 #define PATH_IsPathOpen(path) ((path).state==PATH_Open)
528 /* Returns TRUE if the specified path is in the open state, i.e. in the
529  * state where points will be added to the path, or FALSE otherwise. This
530  * function is implemented as a macro for performance reasons.
531  */
532
533 extern void PATH_InitGdiPath(GdiPath *pPath);
534 extern void PATH_DestroyGdiPath(GdiPath *pPath);
535 extern BOOL PATH_AssignGdiPath(GdiPath *pPathDest, const GdiPath *pPathSrc);
536
537 extern BOOL PATH_MoveTo(DC *dc);
538 extern BOOL PATH_LineTo(DC *dc, INT x, INT y);
539 extern BOOL PATH_Rectangle(DC *dc, INT x1, INT y1, INT x2, INT y2);
540 extern BOOL PATH_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2);
541 extern BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
542                      INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines);
543 extern BOOL PATH_PolyBezierTo(DC *dc, const POINT *pt, DWORD cbCount);
544 extern BOOL PATH_PolyBezier(DC *dc, const POINT *pt, DWORD cbCount);
545 extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount);
546 extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount);
547 extern BOOL PATH_Polygon(DC *dc, const POINT *pt, DWORD cbCount);
548 extern BOOL PATH_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines);
549 extern BOOL PATH_PolyPolygon(DC *dc, const POINT *pt, const INT *counts, UINT polygons);
550 extern BOOL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height);
551 extern BOOL PATH_AddEntry(GdiPath *pPath, const POINT *pPoint, BYTE flags);
552
553 /* text.c */
554 extern LPWSTR FONT_mbtowc(HDC, LPCSTR, INT, INT*, UINT*);
555
556 #define WINE_GGO_GRAY16_BITMAP 0x7f
557
558 #endif  /* __WINE_GDI_H */