Added function table to GDI objects for better encapsulation.
[wine.git] / include / gdi.h
blob9fd05503cd0f69085a0bd74730caf208d455a35b
1 /*
2 * GDI definitions
4 * Copyright 1993 Alexandre Julliard
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.
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.
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
21 #ifndef __WINE_GDI_H
22 #define __WINE_GDI_H
24 #include "windef.h"
25 #include "wingdi.h"
26 #include "wine/wingdi16.h"
27 #include "path.h"
28 #include <math.h>
30 /* GDI objects magic numbers */
31 #define FIRST_MAGIC 0x4f47
32 #define PEN_MAGIC 0x4f47
33 #define BRUSH_MAGIC 0x4f48
34 #define FONT_MAGIC 0x4f49
35 #define PALETTE_MAGIC 0x4f4a
36 #define BITMAP_MAGIC 0x4f4b
37 #define REGION_MAGIC 0x4f4c
38 #define DC_MAGIC 0x4f4d
39 #define DISABLED_DC_MAGIC 0x4f4e
40 #define META_DC_MAGIC 0x4f4f
41 #define METAFILE_MAGIC 0x4f50
42 #define METAFILE_DC_MAGIC 0x4f51
43 #define ENHMETAFILE_MAGIC 0x4f52
44 #define ENHMETAFILE_DC_MAGIC 0x4f53
45 #define LAST_MAGIC 0x4f53
47 #define MAGIC_DONTCARE 0xffff
49 /* GDI constants for making objects private/system (naming undoc. !) */
50 #define OBJECT_PRIVATE 0x2000
51 #define OBJECT_NOSYSTEM 0x8000
53 #define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
55 struct gdi_obj_funcs
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 );
65 typedef struct tagGDIOBJHDR
67 HANDLE16 hNext;
68 WORD wMagic;
69 DWORD dwCount;
70 const struct gdi_obj_funcs *funcs;
71 } GDIOBJHDR;
74 typedef struct tagGdiFont *GdiFont;
76 typedef struct { int opaque; } *PHYSDEV; /* PHYSDEV is an opaque pointer */
78 typedef struct tagDC
80 GDIOBJHDR header;
81 HDC hSelf; /* Handle to this DC */
82 const struct tagDC_FUNCS *funcs; /* DC function table */
83 PHYSDEV physDev; /* Physical device (driver-specific) */
84 INT saveLevel;
85 DWORD dwHookData;
86 FARPROC16 hookProc; /* the original SEGPTR ... */
87 DCHOOKPROC hookThunk; /* ... and the thunk to call it */
89 INT wndOrgX; /* Window origin */
90 INT wndOrgY;
91 INT wndExtX; /* Window extent */
92 INT wndExtY;
93 INT vportOrgX; /* Viewport origin */
94 INT vportOrgY;
95 INT vportExtX; /* Viewport extent */
96 INT vportExtY;
98 int flags;
99 HRGN16 hClipRgn; /* Clip region (may be 0) */
100 HRGN16 hVisRgn; /* Visible region (must never be 0) */
101 HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
102 HPEN16 hPen;
103 HBRUSH16 hBrush;
104 HFONT16 hFont;
105 HBITMAP16 hBitmap;
106 HANDLE16 hDevice;
107 HPALETTE16 hPalette;
109 GdiFont gdiFont;
110 GdiPath path;
112 WORD ROPmode;
113 WORD polyFillMode;
114 WORD stretchBltMode;
115 WORD relAbsMode;
116 WORD backgroundMode;
117 COLORREF backgroundColor;
118 COLORREF textColor;
119 short brushOrgX;
120 short brushOrgY;
122 WORD textAlign; /* Text alignment from SetTextAlign() */
123 short charExtra; /* Spacing from SetTextCharacterExtra() */
124 short breakTotalExtra; /* Total extra space for justification */
125 short breakCount; /* Break char. count */
126 short breakExtra; /* breakTotalExtra / breakCount */
127 short breakRem; /* breakTotalExtra % breakCount */
129 RECT totalExtent;
130 BYTE bitsPerPixel;
132 INT MapMode;
133 INT GraphicsMode; /* Graphics mode */
134 INT DCOrgX; /* DC origin */
135 INT DCOrgY;
136 ABORTPROC pAbortProc; /* AbortProc for Printing */
137 ABORTPROC16 pAbortProc16;
138 INT CursPosX; /* Current position */
139 INT CursPosY;
140 INT ArcDirection;
141 XFORM xformWorld2Wnd; /* World-to-window transformation */
142 XFORM xformWorld2Vport; /* World-to-viewport transformation */
143 XFORM xformVport2World; /* Inverse of the above transformation */
144 BOOL vport2WorldValid; /* Is xformVport2World valid? */
145 } DC;
147 /* Device functions for the Wine driver interface */
149 typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,LPNEWTEXTMETRICEXW,DWORD,
150 LPARAM);
152 typedef struct tagDC_FUNCS
154 INT (*pAbortDoc)(PHYSDEV);
155 BOOL (*pAbortPath)(PHYSDEV);
156 BOOL (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
157 BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
158 BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
159 BOOL (*pBeginPath)(PHYSDEV);
160 BOOL (*pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
161 INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
162 BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
163 BOOL (*pCloseFigure)(PHYSDEV);
164 BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP);
165 BOOL (*pCreateDC)(DC *,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
166 HBITMAP (*pCreateDIBSection)(PHYSDEV,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD,DWORD);
167 BOOL (*pDeleteBitmap)(HBITMAP);
168 BOOL (*pDeleteDC)(PHYSDEV);
169 INT (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
170 DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
171 BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
172 INT (*pEndDoc)(PHYSDEV);
173 INT (*pEndPage)(PHYSDEV);
174 BOOL (*pEndPath)(PHYSDEV);
175 BOOL (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
176 INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
177 INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
178 INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
179 BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
180 INT (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
181 BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
182 BOOL (*pFillPath)(PHYSDEV);
183 BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
184 BOOL (*pFlattenPath)(PHYSDEV);
185 BOOL (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
186 LONG (*pGetBitmapBits)(HBITMAP,void*,LONG);
187 BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
188 BOOL (*pGetDCOrgEx)(PHYSDEV,LPPOINT);
189 UINT (*pGetDIBColorTable)(PHYSDEV,UINT,UINT,RGBQUAD*);
190 INT (*pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
191 INT (*pGetDeviceCaps)(PHYSDEV,INT);
192 BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
193 COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
194 INT (*pGetPixelFormat)(PHYSDEV);
195 BOOL (*pGetTextExtentPoint)(PHYSDEV,LPCWSTR,INT,LPSIZE);
196 BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
197 INT (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
198 BOOL (*pInvertRgn)(PHYSDEV,HRGN);
199 BOOL (*pLineTo)(PHYSDEV,INT,INT);
200 BOOL (*pMoveTo)(PHYSDEV,INT,INT);
201 INT (*pOffsetClipRgn)(PHYSDEV,INT,INT);
202 BOOL (*pOffsetViewportOrg)(PHYSDEV,INT,INT);
203 BOOL (*pOffsetWindowOrg)(PHYSDEV,INT,INT);
204 BOOL (*pPaintRgn)(PHYSDEV,HRGN);
205 BOOL (*pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD);
206 BOOL (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
207 BOOL (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
208 BOOL (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
209 BOOL (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
210 BOOL (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
211 BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
212 BOOL (*pPolygon)(PHYSDEV,const POINT*,INT);
213 BOOL (*pPolyline)(PHYSDEV,const POINT*,INT);
214 BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT);
215 UINT (*pRealizePalette)(PHYSDEV);
216 BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
217 HDC (*pResetDC)(PHYSDEV,const DEVMODEA*);
218 BOOL (*pRestoreDC)(PHYSDEV,INT);
219 BOOL (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
220 INT (*pSaveDC)(PHYSDEV);
221 BOOL (*pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT);
222 BOOL (*pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT);
223 HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
224 HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH);
225 BOOL (*pSelectClipPath)(PHYSDEV,INT);
226 HFONT (*pSelectFont)(PHYSDEV,HFONT);
227 HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
228 HPEN (*pSelectPen)(PHYSDEV,HPEN);
229 LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
230 COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
231 INT (*pSetBkMode)(PHYSDEV,INT);
232 UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
233 INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
234 INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
235 const BITMAPINFO*,UINT);
236 VOID (*pSetDeviceClipping)(PHYSDEV,HRGN);
237 BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
238 INT (*pSetMapMode)(PHYSDEV,INT);
239 DWORD (*pSetMapperFlags)(PHYSDEV,DWORD);
240 COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
241 BOOL (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
242 INT (*pSetPolyFillMode)(PHYSDEV,INT);
243 INT (*pSetROP2)(PHYSDEV,INT);
244 INT (*pSetRelAbs)(PHYSDEV,INT);
245 INT (*pSetStretchBltMode)(PHYSDEV,INT);
246 UINT (*pSetTextAlign)(PHYSDEV,UINT);
247 INT (*pSetTextCharacterExtra)(PHYSDEV,INT);
248 DWORD (*pSetTextColor)(PHYSDEV,DWORD);
249 INT (*pSetTextJustification)(PHYSDEV,INT,INT);
250 BOOL (*pSetViewportExt)(PHYSDEV,INT,INT);
251 BOOL (*pSetViewportOrg)(PHYSDEV,INT,INT);
252 BOOL (*pSetWindowExt)(PHYSDEV,INT,INT);
253 BOOL (*pSetWindowOrg)(PHYSDEV,INT,INT);
254 INT (*pStartDoc)(PHYSDEV,const DOCINFOA*);
255 INT (*pStartPage)(PHYSDEV);
256 BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
257 INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
258 const BITMAPINFO*,UINT,DWORD);
259 BOOL (*pStrokeAndFillPath)(PHYSDEV);
260 BOOL (*pStrokePath)(PHYSDEV);
261 BOOL (*pSwapBuffers)(PHYSDEV);
262 BOOL (*pWidenPath)(PHYSDEV);
263 } DC_FUNCTIONS;
265 /* DC hook codes */
266 #define DCHC_INVALIDVISRGN 0x0001
267 #define DCHC_DELETEDC 0x0002
269 #define DCHF_INVALIDATEVISRGN 0x0001
270 #define DCHF_VALIDATEVISRGN 0x0002
272 /* DC flags */
273 #define DC_MEMORY 0x0001 /* It is a memory DC */
274 #define DC_SAVED 0x0002 /* It is a saved DC */
275 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
276 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
278 #define GDI_HEAP_SIZE 0xffe0
280 /* extra stock object: default 1x1 bitmap for memory DCs */
281 #define DEFAULT_BITMAP (STOCK_LAST+1)
283 /* Device <-> logical coords conversion */
285 /* A floating point version of the POINT structure */
286 typedef struct tagFLOAT_POINT
288 FLOAT x, y;
289 } FLOAT_POINT;
291 /* Rounds a floating point number to integer. The world-to-viewport
292 * transformation process is done in floating point internally. This function
293 * is then used to round these coordinates to integer values.
295 static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
297 return (int)floor(val + 0.5);
300 /* Performs a viewport-to-world transformation on the specified point (which
301 * is in floating point format). Returns TRUE if successful, else FALSE.
303 static inline BOOL WINE_UNUSED INTERNAL_DPTOLP_FLOAT(DC *dc, FLOAT_POINT *point)
305 FLOAT x, y;
307 /* Check that the viewport-to-world transformation is valid */
308 if (!dc->vport2WorldValid)
309 return FALSE;
311 /* Perform the transformation */
312 x = point->x;
313 y = point->y;
314 point->x = x * dc->xformVport2World.eM11 +
315 y * dc->xformVport2World.eM21 +
316 dc->xformVport2World.eDx;
317 point->y = x * dc->xformVport2World.eM12 +
318 y * dc->xformVport2World.eM22 +
319 dc->xformVport2World.eDy;
321 return TRUE;
324 /* Performs a viewport-to-world transformation on the specified point (which
325 * is in integer format). Returns TRUE if successful, else FALSE.
327 static inline BOOL WINE_UNUSED INTERNAL_DPTOLP(DC *dc, LPPOINT point)
329 FLOAT_POINT floatPoint;
331 /* Perform operation with floating point */
332 floatPoint.x=(FLOAT)point->x;
333 floatPoint.y=(FLOAT)point->y;
334 if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
335 return FALSE;
337 /* Round to integers */
338 point->x = GDI_ROUND(floatPoint.x);
339 point->y = GDI_ROUND(floatPoint.y);
341 return TRUE;
344 /* Performs a world-to-viewport transformation on the specified point (which
345 * is in floating point format).
347 static inline void WINE_UNUSED INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
349 FLOAT x, y;
351 /* Perform the transformation */
352 x = point->x;
353 y = point->y;
354 point->x = x * dc->xformWorld2Vport.eM11 +
355 y * dc->xformWorld2Vport.eM21 +
356 dc->xformWorld2Vport.eDx;
357 point->y = x * dc->xformWorld2Vport.eM12 +
358 y * dc->xformWorld2Vport.eM22 +
359 dc->xformWorld2Vport.eDy;
362 /* Performs a world-to-viewport transformation on the specified point (which
363 * is in integer format).
365 static inline void WINE_UNUSED INTERNAL_LPTODP(DC *dc, LPPOINT point)
367 FLOAT_POINT floatPoint;
369 /* Perform operation with floating point */
370 floatPoint.x=(FLOAT)point->x;
371 floatPoint.y=(FLOAT)point->y;
372 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
374 /* Round to integers */
375 point->x = GDI_ROUND(floatPoint.x);
376 point->y = GDI_ROUND(floatPoint.y);
380 /* Performs a world-to-viewport transformation on the specified point (which
381 * is in integer format).
383 static inline INT WINE_UNUSED INTERNAL_XWPTODP(DC *dc, INT x, INT y)
385 FLOAT_POINT floatPoint;
387 /* Perform operation with floating point */
388 floatPoint.x=(FLOAT)x;
389 floatPoint.y=(FLOAT)y;
390 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
392 /* Round to integers */
393 return GDI_ROUND(floatPoint.x);
396 /* Performs a world-to-viewport transformation on the specified point (which
397 * is in integer format).
399 static inline INT WINE_UNUSED INTERNAL_YWPTODP(DC *dc, INT x, INT y)
401 FLOAT_POINT floatPoint;
403 /* Perform operation with floating point */
404 floatPoint.x=(FLOAT)x;
405 floatPoint.y=(FLOAT)y;
406 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
408 /* Round to integers */
409 return GDI_ROUND(floatPoint.y);
413 /* Performs a viewport-to-world transformation on the specified point (which
414 * is in integer format).
416 static inline INT WINE_UNUSED INTERNAL_XDPTOWP(DC *dc, INT x, INT y)
418 FLOAT_POINT floatPoint;
420 /* Perform operation with floating point */
421 floatPoint.x=(FLOAT)x;
422 floatPoint.y=(FLOAT)y;
423 INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
425 /* Round to integers */
426 return GDI_ROUND(floatPoint.x);
429 /* Performs a viewport-to-world transformation on the specified point (which
430 * is in integer format).
432 static inline INT WINE_UNUSED INTERNAL_YDPTOWP(DC *dc, INT x, INT y)
434 FLOAT_POINT floatPoint;
436 /* Perform operation with floating point */
437 floatPoint.x=(FLOAT)x;
438 floatPoint.y=(FLOAT)y;
439 INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
441 /* Round to integers */
442 return GDI_ROUND(floatPoint.y);
446 #define XDPTOLP(dc,x) \
447 (MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
448 #define YDPTOLP(dc,y) \
449 (MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) + (dc)->wndOrgY)
450 #define XLPTODP(dc,x) \
451 (MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) + (dc)->vportOrgX)
452 #define YLPTODP(dc,y) \
453 (MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) + (dc)->vportOrgY)
457 /* World -> Device size conversion */
459 /* Performs a world-to-viewport transformation on the specified width (which
460 * is in floating point format).
462 static inline void WINE_UNUSED INTERNAL_XWSTODS_FLOAT(DC *dc, FLOAT *width)
464 /* Perform the transformation */
465 *width = *width * dc->xformWorld2Vport.eM11;
468 /* Performs a world-to-viewport transformation on the specified width (which
469 * is in integer format).
471 static inline INT WINE_UNUSED INTERNAL_XWSTODS(DC *dc, INT width)
473 FLOAT floatWidth;
475 /* Perform operation with floating point */
476 floatWidth = (FLOAT)width;
477 INTERNAL_XWSTODS_FLOAT(dc, &floatWidth);
479 /* Round to integers */
480 return GDI_ROUND(floatWidth);
484 /* Performs a world-to-viewport transformation on the specified size (which
485 * is in floating point format).
487 static inline void WINE_UNUSED INTERNAL_YWSTODS_FLOAT(DC *dc, FLOAT *height)
489 /* Perform the transformation */
490 *height = *height * dc->xformWorld2Vport.eM22;
493 /* Performs a world-to-viewport transformation on the specified size (which
494 * is in integer format).
496 static inline INT WINE_UNUSED INTERNAL_YWSTODS(DC *dc, INT height)
498 FLOAT floatHeight;
500 /* Perform operation with floating point */
501 floatHeight = (FLOAT)height;
502 INTERNAL_YWSTODS_FLOAT(dc, &floatHeight);
504 /* Round to integers */
505 return GDI_ROUND(floatHeight);
509 /* Device -> World size conversion */
511 /* Performs a device to world transformation on the specified width (which
512 * is in floating point format).
514 static inline void INTERNAL_XDSTOWS_FLOAT(DC *dc, FLOAT *width)
516 /* Perform the transformation */
517 *width = *width * dc->xformVport2World.eM11;
520 /* Performs a device to world transformation on the specified width (which
521 * is in integer format).
523 static inline INT INTERNAL_XDSTOWS(DC *dc, INT width)
525 FLOAT floatWidth;
527 /* Perform operation with floating point */
528 floatWidth = (FLOAT)width;
529 INTERNAL_XDSTOWS_FLOAT(dc, &floatWidth);
531 /* Round to integers */
532 return GDI_ROUND(floatWidth);
536 /* Performs a device to world transformation on the specified size (which
537 * is in floating point format).
539 static inline void INTERNAL_YDSTOWS_FLOAT(DC *dc, FLOAT *height)
541 /* Perform the transformation */
542 *height = *height * dc->xformVport2World.eM22;
545 /* Performs a device to world transformation on the specified size (which
546 * is in integer format).
548 static inline INT INTERNAL_YDSTOWS(DC *dc, INT height)
550 FLOAT floatHeight;
552 /* Perform operation with floating point */
553 floatHeight = (FLOAT)height;
554 INTERNAL_YDSTOWS_FLOAT(dc, &floatHeight);
556 /* Round to integers */
557 return GDI_ROUND(floatHeight);
561 /* Device <-> logical size conversion */
563 #define XDSTOLS(dc,x) \
564 MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
565 #define YDSTOLS(dc,y) \
566 MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
567 #define XLSTODS(dc,x) \
568 MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
569 #define YLSTODS(dc,y) \
570 MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
572 /* GDI local heap */
574 extern BOOL GDI_Init(void);
575 extern void *GDI_AllocObject( WORD, WORD, HGDIOBJ *, const struct gdi_obj_funcs *funcs );
576 extern void *GDI_ReallocObject( WORD, HGDIOBJ, void *obj );
577 extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
578 extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
579 extern void GDI_ReleaseObj( HGDIOBJ );
580 extern void GDI_CheckNotLock(void);
582 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name );
583 extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
584 extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
585 extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
587 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
589 extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs );
590 extern DC * DC_GetDCPtr( HDC hdc );
591 extern DC * DC_GetDCUpdate( HDC hdc );
592 extern void DC_InitDC( DC * dc );
593 extern void DC_UpdateXforms( DC * dc );
595 /* objects/clipping.c */
596 extern void CLIPPING_UpdateGCRegion( DC * dc );
598 /* objects/enhmetafile.c */
599 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
601 /* region.c */
602 extern HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt );
603 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y );
605 #define WINE_GGO_GRAY16_BITMAP 0x7f
607 #endif /* __WINE_GDI_H */