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