GetControlBrush16: avoid potentially releasing the same pointer
[wine/multimedia.git] / include / gdi.h
blob18a5ed36a4eae723b6debe2e6b3fb60c4ce4d3c1
1 /*
2 * GDI definitions
4 * Copyright 1993 Alexandre Julliard
5 */
7 #ifndef __WINE_GDI_H
8 #define __WINE_GDI_H
10 #include "config.h"
12 #include "windef.h"
13 #include "wingdi.h"
14 #include "wine/wingdi16.h"
15 #include "path.h"
16 #include <math.h>
18 /* GDI objects magic numbers */
19 #define FIRST_MAGIC 0x4f47
20 #define PEN_MAGIC 0x4f47
21 #define BRUSH_MAGIC 0x4f48
22 #define FONT_MAGIC 0x4f49
23 #define PALETTE_MAGIC 0x4f4a
24 #define BITMAP_MAGIC 0x4f4b
25 #define REGION_MAGIC 0x4f4c
26 #define DC_MAGIC 0x4f4d
27 #define DISABLED_DC_MAGIC 0x4f4e
28 #define META_DC_MAGIC 0x4f4f
29 #define METAFILE_MAGIC 0x4f50
30 #define METAFILE_DC_MAGIC 0x4f51
31 #define ENHMETAFILE_MAGIC 0x4f52
32 #define ENHMETAFILE_DC_MAGIC 0x4f53
33 #define LAST_MAGIC 0x4f53
35 #define MAGIC_DONTCARE 0xffff
37 /* GDI constants for making objects private/system (naming undoc. !) */
38 #define OBJECT_PRIVATE 0x2000
39 #define OBJECT_NOSYSTEM 0x8000
41 #define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
43 typedef struct tagGDIOBJHDR
45 HANDLE16 hNext;
46 WORD wMagic;
47 DWORD dwCount;
48 } GDIOBJHDR;
51 typedef BOOL16 CALLBACK (*DCHOOKPROC)(HDC16,WORD,DWORD,LPARAM);
53 typedef struct tagDC
55 GDIOBJHDR header;
56 HDC hSelf; /* Handle to this DC */
57 const struct tagDC_FUNCS *funcs; /* DC function table */
58 void *physDev; /* Physical device (driver-specific) */
59 INT saveLevel;
60 DWORD dwHookData;
61 FARPROC16 hookProc; /* the original SEGPTR ... */
62 DCHOOKPROC hookThunk; /* ... and the thunk to call it */
64 INT wndOrgX; /* Window origin */
65 INT wndOrgY;
66 INT wndExtX; /* Window extent */
67 INT wndExtY;
68 INT vportOrgX; /* Viewport origin */
69 INT vportOrgY;
70 INT vportExtX; /* Viewport extent */
71 INT vportExtY;
73 int flags;
74 HRGN16 hClipRgn; /* Clip region (may be 0) */
75 HRGN16 hVisRgn; /* Visible region (must never be 0) */
76 HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
77 HPEN16 hPen;
78 HBRUSH16 hBrush;
79 HFONT16 hFont;
80 HBITMAP16 hBitmap;
81 HANDLE16 hDevice;
82 HPALETTE16 hPalette;
84 GdiPath path;
86 WORD ROPmode;
87 WORD polyFillMode;
88 WORD stretchBltMode;
89 WORD relAbsMode;
90 WORD backgroundMode;
91 COLORREF backgroundColor;
92 COLORREF textColor;
93 short brushOrgX;
94 short brushOrgY;
96 WORD textAlign; /* Text alignment from SetTextAlign() */
97 short charExtra; /* Spacing from SetTextCharacterExtra() */
98 short breakTotalExtra; /* Total extra space for justification */
99 short breakCount; /* Break char. count */
100 short breakExtra; /* breakTotalExtra / breakCount */
101 short breakRem; /* breakTotalExtra % breakCount */
103 RECT totalExtent;
104 BYTE bitsPerPixel;
106 INT MapMode;
107 INT GraphicsMode; /* Graphics mode */
108 INT DCOrgX; /* DC origin */
109 INT DCOrgY;
110 ABORTPROC pAbortProc; /* AbortProc for Printing */
111 INT CursPosX; /* Current position */
112 INT CursPosY;
113 INT ArcDirection;
114 XFORM xformWorld2Wnd; /* World-to-window transformation */
115 XFORM xformWorld2Vport; /* World-to-viewport transformation */
116 XFORM xformVport2World; /* Inverse of the above transformation */
117 BOOL vport2WorldValid; /* Is xformVport2World valid? */
118 } DC;
120 /* Device functions for the Wine driver interface */
122 typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,LPNEWTEXTMETRICEXW,DWORD,
123 LPARAM);
125 typedef struct tagDC_FUNCS
127 INT (*pAbortDoc)(DC*);
128 BOOL (*pAbortPath)(DC*);
129 BOOL (*pAngleArc)(DC*,INT,INT,DWORD,FLOAT,FLOAT);
130 BOOL (*pArc)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
131 BOOL (*pArcTo)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
132 BOOL (*pBeginPath)(DC*);
133 BOOL (*pBitBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,DWORD);
134 LONG (*pBitmapBits)(HBITMAP,void*,LONG,WORD);
135 INT (*pChoosePixelFormat)(DC*,const PIXELFORMATDESCRIPTOR *);
136 BOOL (*pChord)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
137 BOOL (*pCloseFigure)(DC*);
138 BOOL (*pCreateBitmap)(HBITMAP);
139 BOOL (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
140 HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE,
141 DWORD,DWORD);
142 BOOL (*pDeleteDC)(DC*);
143 BOOL (*pDeleteObject)(HGDIOBJ);
144 INT (*pDescribePixelFormat)(DC *,INT,UINT,PIXELFORMATDESCRIPTOR *);
145 DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
146 BOOL (*pEllipse)(DC*,INT,INT,INT,INT);
147 INT (*pEndDoc)(DC*);
148 INT (*pEndPage)(DC*);
149 BOOL (*pEndPath)(DC*);
150 BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
151 INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT);
152 INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
153 INT (*pExtEscape)(DC*,INT,INT,LPCVOID,INT,LPVOID);
154 BOOL (*pExtFloodFill)(DC*,INT,INT,COLORREF,UINT);
155 BOOL (*pExtTextOut)(DC*,INT,INT,UINT,const RECT*,LPCWSTR,UINT,
156 const INT*);
157 BOOL (*pFillPath)(DC*);
158 BOOL (*pFillRgn)(DC*,HRGN,HBRUSH);
159 BOOL (*pFlattenPath)(DC*);
160 BOOL (*pFrameRgn)(DC*,HRGN,HBRUSH,INT,INT);
161 BOOL (*pGetCharWidth)(DC*,UINT,UINT,LPINT);
162 BOOL (*pGetDCOrgEx)(DC*,LPPOINT);
163 INT (*pGetDeviceCaps)(DC*,INT);
164 BOOL (*pGetDeviceGammaRamp)(DC*,LPVOID);
165 COLORREF (*pGetPixel)(DC*,INT,INT);
166 INT (*pGetPixelFormat)(DC*);
167 BOOL (*pGetTextExtentPoint)(DC*,LPCWSTR,INT,LPSIZE);
168 BOOL (*pGetTextMetrics)(DC*,TEXTMETRICW*);
169 INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT);
170 BOOL (*pInvertRgn)(DC*,HRGN);
171 BOOL (*pLineTo)(DC*,INT,INT);
172 BOOL (*pMoveTo)(DC*,INT,INT);
173 INT (*pOffsetClipRgn)(DC*,INT,INT);
174 BOOL (*pOffsetViewportOrg)(DC*,INT,INT);
175 BOOL (*pOffsetWindowOrg)(DC*,INT,INT);
176 BOOL (*pPaintRgn)(DC*,HRGN);
177 BOOL (*pPatBlt)(DC*,INT,INT,INT,INT,DWORD);
178 BOOL (*pPie)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
179 BOOL (*pPolyBezier)(DC*,const POINT*,DWORD);
180 BOOL (*pPolyBezierTo)(DC*,const POINT*,DWORD);
181 BOOL (*pPolyDraw)(DC*,const POINT*,const BYTE *,DWORD);
182 BOOL (*pPolyPolygon)(DC*,const POINT*,const INT*,UINT);
183 BOOL (*pPolyPolyline)(DC*,const POINT*,const DWORD*,DWORD);
184 BOOL (*pPolygon)(DC*,const POINT*,INT);
185 BOOL (*pPolyline)(DC*,const POINT*,INT);
186 BOOL (*pPolylineTo)(DC*,const POINT*,INT);
187 UINT (*pRealizePalette)(DC*);
188 BOOL (*pRectangle)(DC*,INT,INT,INT,INT);
189 BOOL (*pRestoreDC)(DC*,INT);
190 BOOL (*pRoundRect)(DC*,INT,INT,INT,INT,INT,INT);
191 INT (*pSaveDC)(DC*);
192 BOOL (*pScaleViewportExt)(DC*,INT,INT,INT,INT);
193 BOOL (*pScaleWindowExt)(DC*,INT,INT,INT,INT);
194 BOOL (*pSelectClipPath)(DC*,INT);
195 INT (*pSelectClipRgn)(DC*,HRGN);
196 HANDLE (*pSelectObject)(DC*,HANDLE);
197 HPALETTE (*pSelectPalette)(DC*,HPALETTE,BOOL);
198 COLORREF (*pSetBkColor)(DC*,COLORREF);
199 INT (*pSetBkMode)(DC*,INT);
200 VOID (*pSetDeviceClipping)(DC*);
201 BOOL (*pSetDeviceGammaRamp)(DC*,LPVOID);
202 INT (*pSetDIBitsToDevice)(DC*,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,
203 LPCVOID,const BITMAPINFO*,UINT);
204 INT (*pSetMapMode)(DC*,INT);
205 DWORD (*pSetMapperFlags)(DC*,DWORD);
206 COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF);
207 BOOL (*pSetPixelFormat)(DC*,INT,const PIXELFORMATDESCRIPTOR *);
208 INT (*pSetPolyFillMode)(DC*,INT);
209 INT (*pSetROP2)(DC*,INT);
210 INT (*pSetRelAbs)(DC*,INT);
211 INT (*pSetStretchBltMode)(DC*,INT);
212 UINT (*pSetTextAlign)(DC*,UINT);
213 INT (*pSetTextCharacterExtra)(DC*,INT);
214 DWORD (*pSetTextColor)(DC*,DWORD);
215 INT (*pSetTextJustification)(DC*,INT,INT);
216 BOOL (*pSetViewportExt)(DC*,INT,INT);
217 BOOL (*pSetViewportOrg)(DC*,INT,INT);
218 BOOL (*pSetWindowExt)(DC*,INT,INT);
219 BOOL (*pSetWindowOrg)(DC*,INT,INT);
220 INT (*pStartDoc)(DC*,const DOCINFOA*);
221 INT (*pStartPage)(DC*);
222 BOOL (*pStretchBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,INT,INT,DWORD);
223 INT (*pStretchDIBits)(DC*,INT,INT,INT,INT,INT,INT,INT,INT,
224 const void *,const BITMAPINFO *,UINT,DWORD);
225 BOOL (*pStrokeAndFillPath)(DC*);
226 BOOL (*pStrokePath)(DC*);
227 BOOL (*pSwapBuffers)(DC*);
228 BOOL (*pWidenPath)(DC*);
229 } DC_FUNCTIONS;
231 /* LoadOEMResource types */
232 #define OEM_BITMAP 1
233 #define OEM_CURSOR 2
234 #define OEM_ICON 3
236 /* DC hook codes */
237 #define DCHC_INVALIDVISRGN 0x0001
238 #define DCHC_DELETEDC 0x0002
240 #define DCHF_INVALIDATEVISRGN 0x0001
241 #define DCHF_VALIDATEVISRGN 0x0002
243 /* DC flags */
244 #define DC_MEMORY 0x0001 /* It is a memory DC */
245 #define DC_SAVED 0x0002 /* It is a saved DC */
246 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
247 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
249 /* Last 32 bytes are reserved for stock object handles */
250 #define GDI_HEAP_SIZE 0xffe0
252 /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
253 #define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
255 /* Stock objects handles */
257 #define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
259 #define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
260 #define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
261 #define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
262 #define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
263 #define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
264 #define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH))
265 #define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
266 #define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
267 #define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
268 #define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
269 #define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
270 #define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
271 #define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
272 #define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
273 #define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
274 #define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
275 #define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
276 #define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
278 #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
279 #define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
281 #define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
283 extern HBITMAP hPseudoStockBitmap;
285 /* Device <-> logical coords conversion */
287 /* A floating point version of the POINT structure */
288 typedef struct tagFLOAT_POINT
290 FLOAT x, y;
291 } FLOAT_POINT;
293 /* Rounds a floating point number to integer. The world-to-viewport
294 * transformation process is done in floating point internally. This function
295 * is then used to round these coordinates to integer values.
297 static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
299 return (int)floor(val + 0.5);
302 /* Performs a viewport-to-world transformation on the specified point (which
303 * is in floating point format). Returns TRUE if successful, else FALSE.
305 static inline BOOL WINE_UNUSED INTERNAL_DPTOLP_FLOAT(DC *dc, FLOAT_POINT *point)
307 FLOAT x, y;
309 /* Check that the viewport-to-world transformation is valid */
310 if (!dc->vport2WorldValid)
311 return FALSE;
313 /* Perform the transformation */
314 x = point->x;
315 y = point->y;
316 point->x = x * dc->xformVport2World.eM11 +
317 y * dc->xformVport2World.eM21 +
318 dc->xformVport2World.eDx;
319 point->y = x * dc->xformVport2World.eM12 +
320 y * dc->xformVport2World.eM22 +
321 dc->xformVport2World.eDy;
323 return TRUE;
326 /* Performs a viewport-to-world transformation on the specified point (which
327 * is in integer format). Returns TRUE if successful, else FALSE.
329 static inline BOOL WINE_UNUSED INTERNAL_DPTOLP(DC *dc, LPPOINT point)
331 FLOAT_POINT floatPoint;
333 /* Perform operation with floating point */
334 floatPoint.x=(FLOAT)point->x;
335 floatPoint.y=(FLOAT)point->y;
336 if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
337 return FALSE;
339 /* Round to integers */
340 point->x = GDI_ROUND(floatPoint.x);
341 point->y = GDI_ROUND(floatPoint.y);
343 return TRUE;
346 /* Performs a world-to-viewport transformation on the specified point (which
347 * is in floating point format).
349 static inline void WINE_UNUSED INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
351 FLOAT x, y;
353 /* Perform the transformation */
354 x = point->x;
355 y = point->y;
356 point->x = x * dc->xformWorld2Vport.eM11 +
357 y * dc->xformWorld2Vport.eM21 +
358 dc->xformWorld2Vport.eDx;
359 point->y = x * dc->xformWorld2Vport.eM12 +
360 y * dc->xformWorld2Vport.eM22 +
361 dc->xformWorld2Vport.eDy;
364 /* Performs a world-to-viewport transformation on the specified point (which
365 * is in integer format).
367 static inline void WINE_UNUSED INTERNAL_LPTODP(DC *dc, LPPOINT point)
369 FLOAT_POINT floatPoint;
371 /* Perform operation with floating point */
372 floatPoint.x=(FLOAT)point->x;
373 floatPoint.y=(FLOAT)point->y;
374 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
376 /* Round to integers */
377 point->x = GDI_ROUND(floatPoint.x);
378 point->y = GDI_ROUND(floatPoint.y);
382 /* Performs a world-to-viewport transformation on the specified point (which
383 * is in integer format).
385 static inline INT WINE_UNUSED INTERNAL_XWPTODP(DC *dc, INT x, INT y)
387 FLOAT_POINT floatPoint;
389 /* Perform operation with floating point */
390 floatPoint.x=(FLOAT)x;
391 floatPoint.y=(FLOAT)y;
392 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
394 /* Round to integers */
395 return GDI_ROUND(floatPoint.x);
398 /* Performs a world-to-viewport transformation on the specified point (which
399 * is in integer format).
401 static inline INT WINE_UNUSED INTERNAL_YWPTODP(DC *dc, INT x, INT y)
403 FLOAT_POINT floatPoint;
405 /* Perform operation with floating point */
406 floatPoint.x=(FLOAT)x;
407 floatPoint.y=(FLOAT)y;
408 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
410 /* Round to integers */
411 return GDI_ROUND(floatPoint.y);
415 /* Performs a viewport-to-world transformation on the specified point (which
416 * is in integer format).
418 static inline INT WINE_UNUSED INTERNAL_XDPTOWP(DC *dc, INT x, INT y)
420 FLOAT_POINT floatPoint;
422 /* Perform operation with floating point */
423 floatPoint.x=(FLOAT)x;
424 floatPoint.y=(FLOAT)y;
425 INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
427 /* Round to integers */
428 return GDI_ROUND(floatPoint.x);
431 /* Performs a viewport-to-world transformation on the specified point (which
432 * is in integer format).
434 static inline INT WINE_UNUSED INTERNAL_YDPTOWP(DC *dc, INT x, INT y)
436 FLOAT_POINT floatPoint;
438 /* Perform operation with floating point */
439 floatPoint.x=(FLOAT)x;
440 floatPoint.y=(FLOAT)y;
441 INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
443 /* Round to integers */
444 return GDI_ROUND(floatPoint.y);
448 #define XDPTOLP(dc,x) \
449 (MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
450 #define YDPTOLP(dc,y) \
451 (MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) + (dc)->wndOrgY)
452 #define XLPTODP(dc,x) \
453 (MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) + (dc)->vportOrgX)
454 #define YLPTODP(dc,y) \
455 (MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) + (dc)->vportOrgY)
459 /* World -> Device size conversion */
461 /* Performs a world-to-viewport transformation on the specified width (which
462 * is in floating point format).
464 static inline void WINE_UNUSED INTERNAL_XWSTODS_FLOAT(DC *dc, FLOAT *width)
466 /* Perform the transformation */
467 *width = *width * dc->xformWorld2Vport.eM11;
470 /* Performs a world-to-viewport transformation on the specified width (which
471 * is in integer format).
473 static inline INT WINE_UNUSED INTERNAL_XWSTODS(DC *dc, INT width)
475 FLOAT floatWidth;
477 /* Perform operation with floating point */
478 floatWidth = (FLOAT)width;
479 INTERNAL_XWSTODS_FLOAT(dc, &floatWidth);
481 /* Round to integers */
482 return GDI_ROUND(floatWidth);
486 /* Performs a world-to-viewport transformation on the specified size (which
487 * is in floating point format).
489 static inline void WINE_UNUSED INTERNAL_YWSTODS_FLOAT(DC *dc, FLOAT *height)
491 /* Perform the transformation */
492 *height = *height * dc->xformWorld2Vport.eM22;
495 /* Performs a world-to-viewport transformation on the specified size (which
496 * is in integer format).
498 static inline INT WINE_UNUSED INTERNAL_YWSTODS(DC *dc, INT height)
500 FLOAT floatHeight;
502 /* Perform operation with floating point */
503 floatHeight = (FLOAT)height;
504 INTERNAL_YWSTODS_FLOAT(dc, &floatHeight);
506 /* Round to integers */
507 return GDI_ROUND(floatHeight);
511 /* Device <-> logical size conversion */
513 #define XDSTOLS(dc,x) \
514 MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
515 #define YDSTOLS(dc,y) \
516 MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
517 #define XLSTODS(dc,x) \
518 MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
519 #define YLSTODS(dc,y) \
520 MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
522 /* GDI local heap */
524 extern BOOL GDI_Init(void);
525 extern void *GDI_AllocObject( WORD, WORD, HGDIOBJ * );
526 extern void *GDI_ReallocObject( WORD, HGDIOBJ, void *obj );
527 extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
528 extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
529 extern void GDI_ReleaseObj( HGDIOBJ );
531 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name );
532 extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
533 extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
534 extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
536 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
538 extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs );
539 extern DC * DC_GetDCPtr( HDC hdc );
540 extern DC * DC_GetDCUpdate( HDC hdc );
541 extern void DC_InitDC( DC * dc );
542 extern void DC_UpdateXforms( DC * dc );
545 #define CLIP_INTERSECT 0x0001
546 #define CLIP_EXCLUDE 0x0002
547 #define CLIP_KEEPRGN 0x0004
549 /* objects/clipping.c */
550 INT CLIPPING_IntersectClipRect( DC * dc, INT left, INT top,
551 INT right, INT bottom, UINT flags );
552 INT CLIPPING_IntersectVisRect( DC * dc, INT left, INT top,
553 INT right, INT bottom, BOOL exclude );
554 extern void CLIPPING_UpdateGCRegion( DC * dc );
556 /* objects/enhmetafile.c */
557 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
559 #endif /* __WINE_GDI_H */