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