4 * Copyright 1993 Alexandre Julliard
14 #include "wine/wingdi16.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
51 typedef struct tagDeviceCaps
53 WORD version
; /* 0: driver version */
54 WORD technology
; /* 2: device technology */
55 WORD horzSize
; /* 4: width of display in mm */
56 WORD vertSize
; /* 6: height of display in mm */
57 WORD horzRes
; /* 8: width of display in pixels */
58 WORD vertRes
; /* 10: width of display in pixels */
59 WORD bitsPixel
; /* 12: bits per pixel */
60 WORD planes
; /* 14: color planes */
61 WORD numBrushes
; /* 16: device-specific brushes */
62 WORD numPens
; /* 18: device-specific pens */
63 WORD numMarkers
; /* 20: device-specific markers */
64 WORD numFonts
; /* 22: device-specific fonts */
65 WORD numColors
; /* 24: size of color table */
66 WORD pdeviceSize
; /* 26: size of PDEVICE structure */
67 WORD curveCaps
; /* 28: curve capabilities */
68 WORD lineCaps
; /* 30: line capabilities */
69 WORD polygonalCaps
; /* 32: polygon capabilities */
70 WORD textCaps
; /* 34: text capabilities */
71 WORD clipCaps
; /* 36: clipping capabilities */
72 WORD rasterCaps
; /* 38: raster capabilities */
73 WORD aspectX
; /* 40: relative width of device pixel */
74 WORD aspectY
; /* 42: relative height of device pixel */
75 WORD aspectXY
; /* 44: relative diagonal width of device pixel */
76 WORD pad1
[21]; /* 46-86: reserved */
77 WORD logPixelsX
; /* 88: pixels / logical X inch */
78 WORD logPixelsY
; /* 90: pixels / logical Y inch */
79 WORD pad2
[6]; /* 92-102: reserved */
80 WORD sizePalette
; /* 104: entries in system palette */
81 WORD numReserved
; /* 106: reserved entries */
82 WORD colorRes
; /* 108: color resolution */
85 typedef BOOL16
CALLBACK (*DCHOOKPROC
)(HDC16
,WORD
,DWORD
,LPARAM
);
90 HDC hSelf
; /* Handle to this DC */
91 const struct tagDC_FUNCS
*funcs
; /* DC function table */
92 void *physDev
; /* Physical device (driver-specific) */
95 FARPROC16 hookProc
; /* the original SEGPTR ... */
96 DCHOOKPROC hookThunk
; /* ... and the thunk to call it */
98 INT wndOrgX
; /* Window origin */
100 INT wndExtX
; /* Window extent */
102 INT vportOrgX
; /* Viewport origin */
104 INT vportExtX
; /* Viewport extent */
108 const DeviceCaps
*devCaps
;
110 HRGN16 hClipRgn
; /* Clip region (may be 0) */
111 HRGN16 hVisRgn
; /* Visible region (must never be 0) */
112 HRGN16 hGCClipRgn
; /* GC clip region (ClipRgn AND VisRgn) */
127 COLORREF backgroundColor
;
132 WORD textAlign
; /* Text alignment from SetTextAlign() */
133 short charExtra
; /* Spacing from SetTextCharacterExtra() */
134 short breakTotalExtra
; /* Total extra space for justification */
135 short breakCount
; /* Break char. count */
136 short breakExtra
; /* breakTotalExtra / breakCount */
137 short breakRem
; /* breakTotalExtra % breakCount */
143 INT GraphicsMode
; /* Graphics mode */
144 INT DCOrgX
; /* DC origin */
146 ABORTPROC pAbortProc
; /* AbortProc for Printing */
147 INT CursPosX
; /* Current position */
150 XFORM xformWorld2Wnd
; /* World-to-window transformation */
151 XFORM xformWorld2Vport
; /* World-to-viewport transformation */
152 XFORM xformVport2World
; /* Inverse of the above transformation */
153 BOOL vport2WorldValid
; /* Is xformVport2World valid? */
156 /* Device functions for the Wine driver interface */
158 typedef INT (*DEVICEFONTENUMPROC
)(LPENUMLOGFONTEXW
,LPNEWTEXTMETRICEXW
,DWORD
,
161 typedef struct tagDC_FUNCS
163 INT (*pAbortDoc
)(DC
*);
164 BOOL (*pAbortPath
)(DC
*);
165 BOOL (*pAngleArc
)(DC
*,INT
,INT
,DWORD
,FLOAT
,FLOAT
);
166 BOOL (*pArc
)(DC
*,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
167 BOOL (*pArcTo
)(DC
*,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
168 BOOL (*pBeginPath
)(DC
*);
169 BOOL (*pBitBlt
)(DC
*,INT
,INT
,INT
,INT
,DC
*,INT
,INT
,DWORD
);
170 LONG (*pBitmapBits
)(HBITMAP
,void*,LONG
,WORD
);
171 INT (*pChoosePixelFormat
)(DC
*,const PIXELFORMATDESCRIPTOR
*);
172 BOOL (*pChord
)(DC
*,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
173 BOOL (*pCloseFigure
)(DC
*);
174 BOOL (*pCreateBitmap
)(HBITMAP
);
175 BOOL (*pCreateDC
)(DC
*,LPCSTR
,LPCSTR
,LPCSTR
,const DEVMODEA
*);
176 HBITMAP (*pCreateDIBSection
)(DC
*,BITMAPINFO
*,UINT
,LPVOID
*,HANDLE
,
178 HBITMAP16 (*pCreateDIBSection16
)(DC
*,BITMAPINFO
*,UINT16
,SEGPTR
*,HANDLE
,
180 BOOL (*pDeleteDC
)(DC
*);
181 BOOL (*pDeleteObject
)(HGDIOBJ
);
182 INT (*pDescribePixelFormat
)(DC
*,INT
,UINT
,PIXELFORMATDESCRIPTOR
*);
183 DWORD (*pDeviceCapabilities
)(LPSTR
,LPCSTR
,LPCSTR
,WORD
,LPSTR
,LPDEVMODEA
);
184 BOOL (*pEllipse
)(DC
*,INT
,INT
,INT
,INT
);
186 INT (*pEndPage
)(DC
*);
187 BOOL (*pEndPath
)(DC
*);
188 BOOL (*pEnumDeviceFonts
)(HDC
,LPLOGFONTW
,DEVICEFONTENUMPROC
,LPARAM
);
189 INT (*pEscape
)(DC
*,INT
,INT
,SEGPTR
,SEGPTR
);
190 INT (*pExcludeClipRect
)(DC
*,INT
,INT
,INT
,INT
);
191 INT (*pExtDeviceMode
)(LPSTR
,HWND
,LPDEVMODEA
,LPSTR
,LPSTR
,LPDEVMODEA
,
193 BOOL (*pExtFloodFill
)(DC
*,INT
,INT
,COLORREF
,UINT
);
194 BOOL (*pExtTextOut
)(DC
*,INT
,INT
,UINT
,const RECT
*,LPCWSTR
,UINT
,
196 BOOL (*pFillPath
)(DC
*);
197 BOOL (*pFillRgn
)(DC
*,HRGN
,HBRUSH
);
198 BOOL (*pFlattenPath
)(DC
*);
199 BOOL (*pFrameRgn
)(DC
*,HRGN
,HBRUSH
,INT
,INT
);
200 BOOL (*pGetCharWidth
)(DC
*,UINT
,UINT
,LPINT
);
201 BOOL (*pGetDCOrgEx
)(DC
*,LPPOINT
);
202 COLORREF (*pGetPixel
)(DC
*,INT
,INT
);
203 INT (*pGetPixelFormat
)(DC
*);
204 BOOL (*pGetTextExtentPoint
)(DC
*,LPCWSTR
,INT
,LPSIZE
);
205 BOOL (*pGetTextMetrics
)(DC
*,TEXTMETRICA
*);
206 INT (*pIntersectClipRect
)(DC
*,INT
,INT
,INT
,INT
);
207 BOOL (*pInvertRgn
)(DC
*,HRGN
);
208 BOOL (*pLineTo
)(DC
*,INT
,INT
);
209 BOOL (*pMoveTo
)(DC
*,INT
,INT
);
210 INT (*pOffsetClipRgn
)(DC
*,INT
,INT
);
211 BOOL (*pOffsetViewportOrg
)(DC
*,INT
,INT
);
212 BOOL (*pOffsetWindowOrg
)(DC
*,INT
,INT
);
213 BOOL (*pPaintRgn
)(DC
*,HRGN
);
214 BOOL (*pPatBlt
)(DC
*,INT
,INT
,INT
,INT
,DWORD
);
215 BOOL (*pPie
)(DC
*,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
216 BOOL (*pPolyBezier
)(DC
*,const POINT
*,DWORD
);
217 BOOL (*pPolyBezierTo
)(DC
*,const POINT
*,DWORD
);
218 BOOL (*pPolyDraw
)(DC
*,const POINT
*,const BYTE
*,DWORD
);
219 BOOL (*pPolyPolygon
)(DC
*,const POINT
*,const INT
*,UINT
);
220 BOOL (*pPolyPolyline
)(DC
*,const POINT
*,const DWORD
*,DWORD
);
221 BOOL (*pPolygon
)(DC
*,const POINT
*,INT
);
222 BOOL (*pPolyline
)(DC
*,const POINT
*,INT
);
223 BOOL (*pPolylineTo
)(DC
*,const POINT
*,INT
);
224 UINT (*pRealizePalette
)(DC
*);
225 BOOL (*pRectangle
)(DC
*,INT
,INT
,INT
,INT
);
226 BOOL (*pRestoreDC
)(DC
*,INT
);
227 BOOL (*pRoundRect
)(DC
*,INT
,INT
,INT
,INT
,INT
,INT
);
229 BOOL (*pScaleViewportExt
)(DC
*,INT
,INT
,INT
,INT
);
230 BOOL (*pScaleWindowExt
)(DC
*,INT
,INT
,INT
,INT
);
231 BOOL (*pSelectClipPath
)(DC
*,INT
);
232 INT (*pSelectClipRgn
)(DC
*,HRGN
);
233 HANDLE (*pSelectObject
)(DC
*,HANDLE
);
234 HPALETTE (*pSelectPalette
)(DC
*,HPALETTE
,BOOL
);
235 COLORREF (*pSetBkColor
)(DC
*,COLORREF
);
236 INT (*pSetBkMode
)(DC
*,INT
);
237 VOID (*pSetDeviceClipping
)(DC
*);
238 INT (*pSetDIBitsToDevice
)(DC
*,INT
,INT
,DWORD
,DWORD
,INT
,INT
,UINT
,UINT
,
239 LPCVOID
,const BITMAPINFO
*,UINT
);
240 INT (*pSetMapMode
)(DC
*,INT
);
241 DWORD (*pSetMapperFlags
)(DC
*,DWORD
);
242 COLORREF (*pSetPixel
)(DC
*,INT
,INT
,COLORREF
);
243 BOOL (*pSetPixelFormat
)(DC
*,INT
,const PIXELFORMATDESCRIPTOR
*);
244 INT (*pSetPolyFillMode
)(DC
*,INT
);
245 INT (*pSetROP2
)(DC
*,INT
);
246 INT (*pSetRelAbs
)(DC
*,INT
);
247 INT (*pSetStretchBltMode
)(DC
*,INT
);
248 UINT (*pSetTextAlign
)(DC
*,UINT
);
249 INT (*pSetTextCharacterExtra
)(DC
*,INT
);
250 DWORD (*pSetTextColor
)(DC
*,DWORD
);
251 INT (*pSetTextJustification
)(DC
*,INT
,INT
);
252 BOOL (*pSetViewportExt
)(DC
*,INT
,INT
);
253 BOOL (*pSetViewportOrg
)(DC
*,INT
,INT
);
254 BOOL (*pSetWindowExt
)(DC
*,INT
,INT
);
255 BOOL (*pSetWindowOrg
)(DC
*,INT
,INT
);
256 INT (*pStartDoc
)(DC
*,const DOCINFOA
*);
257 INT (*pStartPage
)(DC
*);
258 BOOL (*pStretchBlt
)(DC
*,INT
,INT
,INT
,INT
,DC
*,INT
,INT
,INT
,INT
,DWORD
);
259 INT (*pStretchDIBits
)(DC
*,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,
260 const void *,const BITMAPINFO
*,UINT
,DWORD
);
261 BOOL (*pStrokeAndFillPath
)(DC
*);
262 BOOL (*pStrokePath
)(DC
*);
263 BOOL (*pSwapBuffers
)(DC
*);
264 BOOL (*pWidenPath
)(DC
*);
267 /* LoadOEMResource types */
273 #define DCHC_INVALIDVISRGN 0x0001
274 #define DCHC_DELETEDC 0x0002
276 #define DCHF_INVALIDATEVISRGN 0x0001
277 #define DCHF_VALIDATEVISRGN 0x0002
280 #define DC_MEMORY 0x0001 /* It is a memory DC */
281 #define DC_SAVED 0x0002 /* It is a saved DC */
282 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
283 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
285 /* Last 32 bytes are reserved for stock object handles */
286 #define GDI_HEAP_SIZE 0xffe0
288 /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
289 #define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
291 /* Stock objects handles */
293 #define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
295 #define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
296 #define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
297 #define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
298 #define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
299 #define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
300 #define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH))
301 #define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
302 #define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
303 #define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
304 #define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
305 #define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
306 #define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
307 #define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
308 #define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
309 #define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
310 #define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
311 #define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
312 #define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
314 #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
315 #define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
317 #define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
319 extern HBITMAP hPseudoStockBitmap
;
321 /* Device <-> logical coords conversion */
323 /* A floating point version of the POINT structure */
324 typedef struct tagFLOAT_POINT
329 /* Rounds a floating point number to integer. The world-to-viewport
330 * transformation process is done in floating point internally. This function
331 * is then used to round these coordinates to integer values.
333 static inline INT WINE_UNUSED
GDI_ROUND(FLOAT val
)
335 return (int)floor(val
+ 0.5);
338 /* Performs a viewport-to-world transformation on the specified point (which
339 * is in floating point format). Returns TRUE if successful, else FALSE.
341 static inline BOOL WINE_UNUSED
INTERNAL_DPTOLP_FLOAT(DC
*dc
, FLOAT_POINT
*point
)
345 /* Check that the viewport-to-world transformation is valid */
346 if (!dc
->vport2WorldValid
)
349 /* Perform the transformation */
352 point
->x
= x
* dc
->xformVport2World
.eM11
+
353 y
* dc
->xformVport2World
.eM21
+
354 dc
->xformVport2World
.eDx
;
355 point
->y
= x
* dc
->xformVport2World
.eM12
+
356 y
* dc
->xformVport2World
.eM22
+
357 dc
->xformVport2World
.eDy
;
362 /* Performs a viewport-to-world transformation on the specified point (which
363 * is in integer format). Returns TRUE if successful, else FALSE.
365 static inline BOOL WINE_UNUSED
INTERNAL_DPTOLP(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 if (!INTERNAL_DPTOLP_FLOAT(dc
, &floatPoint
))
375 /* Round to integers */
376 point
->x
= GDI_ROUND(floatPoint
.x
);
377 point
->y
= GDI_ROUND(floatPoint
.y
);
382 /* Performs a world-to-viewport transformation on the specified point (which
383 * is in floating point format).
385 static inline void WINE_UNUSED
INTERNAL_LPTODP_FLOAT(DC
*dc
, FLOAT_POINT
*point
)
389 /* Perform the transformation */
392 point
->x
= x
* dc
->xformWorld2Vport
.eM11
+
393 y
* dc
->xformWorld2Vport
.eM21
+
394 dc
->xformWorld2Vport
.eDx
;
395 point
->y
= x
* dc
->xformWorld2Vport
.eM12
+
396 y
* dc
->xformWorld2Vport
.eM22
+
397 dc
->xformWorld2Vport
.eDy
;
400 /* Performs a world-to-viewport transformation on the specified point (which
401 * is in integer format).
403 static inline void WINE_UNUSED
INTERNAL_LPTODP(DC
*dc
, LPPOINT point
)
405 FLOAT_POINT floatPoint
;
407 /* Perform operation with floating point */
408 floatPoint
.x
=(FLOAT
)point
->x
;
409 floatPoint
.y
=(FLOAT
)point
->y
;
410 INTERNAL_LPTODP_FLOAT(dc
, &floatPoint
);
412 /* Round to integers */
413 point
->x
= GDI_ROUND(floatPoint
.x
);
414 point
->y
= GDI_ROUND(floatPoint
.y
);
418 /* Performs a world-to-viewport transformation on the specified point (which
419 * is in integer format).
421 static inline INT WINE_UNUSED
INTERNAL_XWPTODP(DC
*dc
, INT x
, INT y
)
423 FLOAT_POINT floatPoint
;
425 /* Perform operation with floating point */
426 floatPoint
.x
=(FLOAT
)x
;
427 floatPoint
.y
=(FLOAT
)y
;
428 INTERNAL_LPTODP_FLOAT(dc
, &floatPoint
);
430 /* Round to integers */
431 return GDI_ROUND(floatPoint
.x
);
434 /* Performs a world-to-viewport transformation on the specified point (which
435 * is in integer format).
437 static inline INT WINE_UNUSED
INTERNAL_YWPTODP(DC
*dc
, INT x
, INT y
)
439 FLOAT_POINT floatPoint
;
441 /* Perform operation with floating point */
442 floatPoint
.x
=(FLOAT
)x
;
443 floatPoint
.y
=(FLOAT
)y
;
444 INTERNAL_LPTODP_FLOAT(dc
, &floatPoint
);
446 /* Round to integers */
447 return GDI_ROUND(floatPoint
.y
);
451 /* Performs a viewport-to-world transformation on the specified point (which
452 * is in integer format).
454 static inline INT WINE_UNUSED
INTERNAL_XDPTOWP(DC
*dc
, INT x
, INT y
)
456 FLOAT_POINT floatPoint
;
458 /* Perform operation with floating point */
459 floatPoint
.x
=(FLOAT
)x
;
460 floatPoint
.y
=(FLOAT
)y
;
461 INTERNAL_DPTOLP_FLOAT(dc
, &floatPoint
);
463 /* Round to integers */
464 return GDI_ROUND(floatPoint
.x
);
467 /* Performs a viewport-to-world transformation on the specified point (which
468 * is in integer format).
470 static inline INT WINE_UNUSED
INTERNAL_YDPTOWP(DC
*dc
, INT x
, INT y
)
472 FLOAT_POINT floatPoint
;
474 /* Perform operation with floating point */
475 floatPoint
.x
=(FLOAT
)x
;
476 floatPoint
.y
=(FLOAT
)y
;
477 INTERNAL_DPTOLP_FLOAT(dc
, &floatPoint
);
479 /* Round to integers */
480 return GDI_ROUND(floatPoint
.y
);
484 #define XDPTOLP(dc,x) \
485 (MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
486 #define YDPTOLP(dc,y) \
487 (MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) + (dc)->wndOrgY)
488 #define XLPTODP(dc,x) \
489 (MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) + (dc)->vportOrgX)
490 #define YLPTODP(dc,y) \
491 (MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) + (dc)->vportOrgY)
495 /* World -> Device size conversion */
497 /* Performs a world-to-viewport transformation on the specified width (which
498 * is in floating point format).
500 static inline void WINE_UNUSED
INTERNAL_XWSTODS_FLOAT(DC
*dc
, FLOAT
*width
)
502 /* Perform the transformation */
503 *width
= *width
* dc
->xformWorld2Vport
.eM11
;
506 /* Performs a world-to-viewport transformation on the specified width (which
507 * is in integer format).
509 static inline INT WINE_UNUSED
INTERNAL_XWSTODS(DC
*dc
, INT width
)
513 /* Perform operation with floating point */
514 floatWidth
= (FLOAT
)width
;
515 INTERNAL_XWSTODS_FLOAT(dc
, &floatWidth
);
517 /* Round to integers */
518 return GDI_ROUND(floatWidth
);
522 /* Performs a world-to-viewport transformation on the specified size (which
523 * is in floating point format).
525 static inline void WINE_UNUSED
INTERNAL_YWSTODS_FLOAT(DC
*dc
, FLOAT
*height
)
527 /* Perform the transformation */
528 *height
= *height
* dc
->xformWorld2Vport
.eM22
;
531 /* Performs a world-to-viewport transformation on the specified size (which
532 * is in integer format).
534 static inline INT WINE_UNUSED
INTERNAL_YWSTODS(DC
*dc
, INT height
)
538 /* Perform operation with floating point */
539 floatHeight
= (FLOAT
)height
;
540 INTERNAL_XWSTODS_FLOAT(dc
, &floatHeight
);
542 /* Round to integers */
543 return GDI_ROUND(floatHeight
);
547 /* Device <-> logical size conversion */
549 #define XDSTOLS(dc,x) \
550 MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
551 #define YDSTOLS(dc,y) \
552 MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
553 #define XLSTODS(dc,x) \
554 MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
555 #define YLSTODS(dc,y) \
556 MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
560 extern BOOL
GDI_Init(void);
561 extern void *GDI_AllocObject( WORD
, WORD
, HGDIOBJ
* );
562 extern void *GDI_ReallocObject( WORD
, HGDIOBJ
, void *obj
);
563 extern BOOL
GDI_FreeObject( HGDIOBJ
, void *obj
);
564 extern void *GDI_GetObjPtr( HGDIOBJ
, WORD
);
565 extern void GDI_ReleaseObj( HGDIOBJ
);
567 extern BOOL
DRIVER_RegisterDriver( LPCSTR name
, const DC_FUNCTIONS
*funcs
);
568 extern const DC_FUNCTIONS
*DRIVER_FindDriver( LPCSTR name
);
569 extern BOOL
DRIVER_UnregisterDriver( LPCSTR name
);
570 extern BOOL
DRIVER_GetDriverName( LPCSTR device
, LPSTR driver
, DWORD size
);
572 extern POINT
*GDI_Bezier( const POINT
*Points
, INT count
, INT
*nPtsOut
);
574 extern DC
* DC_AllocDC( const DC_FUNCTIONS
*funcs
);
575 extern DC
* DC_GetDCPtr( HDC hdc
);
576 extern DC
* DC_GetDCUpdate( HDC hdc
);
577 extern void DC_InitDC( DC
* dc
);
578 extern void DC_UpdateXforms( DC
* dc
);
581 #define CLIP_INTERSECT 0x0001
582 #define CLIP_EXCLUDE 0x0002
583 #define CLIP_KEEPRGN 0x0004
585 /* objects/clipping.c */
586 INT
CLIPPING_IntersectClipRect( DC
* dc
, INT left
, INT top
,
587 INT right
, INT bottom
, UINT flags
);
588 INT
CLIPPING_IntersectVisRect( DC
* dc
, INT left
, INT top
,
589 INT right
, INT bottom
, BOOL exclude
);
590 extern void CLIPPING_UpdateGCRegion( DC
* dc
);
592 #endif /* __WINE_GDI_H */