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
26 #include "wine/wingdi16.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 typedef struct tagGDIOBJHDR
63 typedef struct tagGdiFont
*GdiFont
;
65 typedef struct { int opaque
; } *PHYSDEV
; /* PHYSDEV is an opaque pointer */
70 HDC hSelf
; /* Handle to this DC */
71 const struct tagDC_FUNCS
*funcs
; /* DC function table */
72 PHYSDEV physDev
; /* Physical device (driver-specific) */
75 FARPROC16 hookProc
; /* the original SEGPTR ... */
76 DCHOOKPROC hookThunk
; /* ... and the thunk to call it */
78 INT wndOrgX
; /* Window origin */
80 INT wndExtX
; /* Window extent */
82 INT vportOrgX
; /* Viewport origin */
84 INT vportExtX
; /* Viewport extent */
88 HRGN16 hClipRgn
; /* Clip region (may be 0) */
89 HRGN16 hVisRgn
; /* Visible region (must never be 0) */
90 HRGN16 hGCClipRgn
; /* GC clip region (ClipRgn AND VisRgn) */
106 COLORREF backgroundColor
;
111 WORD textAlign
; /* Text alignment from SetTextAlign() */
112 short charExtra
; /* Spacing from SetTextCharacterExtra() */
113 short breakTotalExtra
; /* Total extra space for justification */
114 short breakCount
; /* Break char. count */
115 short breakExtra
; /* breakTotalExtra / breakCount */
116 short breakRem
; /* breakTotalExtra % breakCount */
122 INT GraphicsMode
; /* Graphics mode */
123 INT DCOrgX
; /* DC origin */
125 ABORTPROC pAbortProc
; /* AbortProc for Printing */
126 ABORTPROC16 pAbortProc16
;
127 INT CursPosX
; /* Current position */
130 XFORM xformWorld2Wnd
; /* World-to-window transformation */
131 XFORM xformWorld2Vport
; /* World-to-viewport transformation */
132 XFORM xformVport2World
; /* Inverse of the above transformation */
133 BOOL vport2WorldValid
; /* Is xformVport2World valid? */
136 /* Device functions for the Wine driver interface */
138 typedef INT (*DEVICEFONTENUMPROC
)(LPENUMLOGFONTEXW
,LPNEWTEXTMETRICEXW
,DWORD
,
141 typedef struct tagDC_FUNCS
143 INT (*pAbortDoc
)(PHYSDEV
);
144 BOOL (*pAbortPath
)(PHYSDEV
);
145 BOOL (*pAngleArc
)(PHYSDEV
,INT
,INT
,DWORD
,FLOAT
,FLOAT
);
146 BOOL (*pArc
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
147 BOOL (*pArcTo
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
148 BOOL (*pBeginPath
)(PHYSDEV
);
149 BOOL (*pBitBlt
)(PHYSDEV
,INT
,INT
,INT
,INT
,PHYSDEV
,INT
,INT
,DWORD
);
150 LONG (*pBitmapBits
)(HBITMAP
,void*,LONG
,WORD
);
151 INT (*pChoosePixelFormat
)(PHYSDEV
,const PIXELFORMATDESCRIPTOR
*);
152 BOOL (*pChord
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
153 BOOL (*pCloseFigure
)(PHYSDEV
);
154 BOOL (*pCreateBitmap
)(HBITMAP
);
155 BOOL (*pCreateDC
)(DC
*,LPCSTR
,LPCSTR
,LPCSTR
,const DEVMODEA
*);
156 HBITMAP (*pCreateDIBSection
)(PHYSDEV
,BITMAPINFO
*,UINT
,LPVOID
*,HANDLE
,DWORD
,DWORD
);
157 BOOL (*pDeleteDC
)(PHYSDEV
);
158 BOOL (*pDeleteObject
)(HGDIOBJ
);
159 INT (*pDescribePixelFormat
)(PHYSDEV
,INT
,UINT
,PIXELFORMATDESCRIPTOR
*);
160 DWORD (*pDeviceCapabilities
)(LPSTR
,LPCSTR
,LPCSTR
,WORD
,LPSTR
,LPDEVMODEA
);
161 BOOL (*pEllipse
)(PHYSDEV
,INT
,INT
,INT
,INT
);
162 INT (*pEndDoc
)(PHYSDEV
);
163 INT (*pEndPage
)(PHYSDEV
);
164 BOOL (*pEndPath
)(PHYSDEV
);
165 BOOL (*pEnumDeviceFonts
)(PHYSDEV
,LPLOGFONTW
,DEVICEFONTENUMPROC
,LPARAM
);
166 INT (*pExcludeClipRect
)(PHYSDEV
,INT
,INT
,INT
,INT
);
167 INT (*pExtDeviceMode
)(LPSTR
,HWND
,LPDEVMODEA
,LPSTR
,LPSTR
,LPDEVMODEA
,LPSTR
,DWORD
);
168 INT (*pExtEscape
)(PHYSDEV
,INT
,INT
,LPCVOID
,INT
,LPVOID
);
169 BOOL (*pExtFloodFill
)(PHYSDEV
,INT
,INT
,COLORREF
,UINT
);
170 INT (*pExtSelectClipRgn
)(PHYSDEV
,HRGN
,INT
);
171 BOOL (*pExtTextOut
)(PHYSDEV
,INT
,INT
,UINT
,const RECT
*,LPCWSTR
,UINT
,const INT
*);
172 BOOL (*pFillPath
)(PHYSDEV
);
173 BOOL (*pFillRgn
)(PHYSDEV
,HRGN
,HBRUSH
);
174 BOOL (*pFlattenPath
)(PHYSDEV
);
175 BOOL (*pFrameRgn
)(PHYSDEV
,HRGN
,HBRUSH
,INT
,INT
);
176 BOOL (*pGetCharWidth
)(PHYSDEV
,UINT
,UINT
,LPINT
);
177 BOOL (*pGetDCOrgEx
)(PHYSDEV
,LPPOINT
);
178 UINT (*pGetDIBColorTable
)(PHYSDEV
,UINT
,UINT
,RGBQUAD
*);
179 INT (*pGetDIBits
)(PHYSDEV
,HBITMAP
,UINT
,UINT
,LPVOID
,BITMAPINFO
*,UINT
);
180 INT (*pGetDeviceCaps
)(PHYSDEV
,INT
);
181 BOOL (*pGetDeviceGammaRamp
)(PHYSDEV
,LPVOID
);
182 COLORREF (*pGetPixel
)(PHYSDEV
,INT
,INT
);
183 INT (*pGetPixelFormat
)(PHYSDEV
);
184 BOOL (*pGetTextExtentPoint
)(PHYSDEV
,LPCWSTR
,INT
,LPSIZE
);
185 BOOL (*pGetTextMetrics
)(PHYSDEV
,TEXTMETRICW
*);
186 INT (*pIntersectClipRect
)(PHYSDEV
,INT
,INT
,INT
,INT
);
187 BOOL (*pInvertRgn
)(PHYSDEV
,HRGN
);
188 BOOL (*pLineTo
)(PHYSDEV
,INT
,INT
);
189 BOOL (*pMoveTo
)(PHYSDEV
,INT
,INT
);
190 INT (*pOffsetClipRgn
)(PHYSDEV
,INT
,INT
);
191 BOOL (*pOffsetViewportOrg
)(PHYSDEV
,INT
,INT
);
192 BOOL (*pOffsetWindowOrg
)(PHYSDEV
,INT
,INT
);
193 BOOL (*pPaintRgn
)(PHYSDEV
,HRGN
);
194 BOOL (*pPatBlt
)(PHYSDEV
,INT
,INT
,INT
,INT
,DWORD
);
195 BOOL (*pPie
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
);
196 BOOL (*pPolyBezier
)(PHYSDEV
,const POINT
*,DWORD
);
197 BOOL (*pPolyBezierTo
)(PHYSDEV
,const POINT
*,DWORD
);
198 BOOL (*pPolyDraw
)(PHYSDEV
,const POINT
*,const BYTE
*,DWORD
);
199 BOOL (*pPolyPolygon
)(PHYSDEV
,const POINT
*,const INT
*,UINT
);
200 BOOL (*pPolyPolyline
)(PHYSDEV
,const POINT
*,const DWORD
*,DWORD
);
201 BOOL (*pPolygon
)(PHYSDEV
,const POINT
*,INT
);
202 BOOL (*pPolyline
)(PHYSDEV
,const POINT
*,INT
);
203 BOOL (*pPolylineTo
)(PHYSDEV
,const POINT
*,INT
);
204 UINT (*pRealizePalette
)(PHYSDEV
);
205 BOOL (*pRectangle
)(PHYSDEV
,INT
,INT
,INT
,INT
);
206 HDC (*pResetDC
)(PHYSDEV
,const DEVMODEA
*);
207 BOOL (*pRestoreDC
)(PHYSDEV
,INT
);
208 BOOL (*pRoundRect
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
);
209 INT (*pSaveDC
)(PHYSDEV
);
210 BOOL (*pScaleViewportExt
)(PHYSDEV
,INT
,INT
,INT
,INT
);
211 BOOL (*pScaleWindowExt
)(PHYSDEV
,INT
,INT
,INT
,INT
);
212 HBITMAP (*pSelectBitmap
)(PHYSDEV
,HBITMAP
);
213 HBRUSH (*pSelectBrush
)(PHYSDEV
,HBRUSH
);
214 BOOL (*pSelectClipPath
)(PHYSDEV
,INT
);
215 HFONT (*pSelectFont
)(PHYSDEV
,HFONT
);
216 HPALETTE (*pSelectPalette
)(PHYSDEV
,HPALETTE
,BOOL
);
217 HPEN (*pSelectPen
)(PHYSDEV
,HPEN
);
218 COLORREF (*pSetBkColor
)(PHYSDEV
,COLORREF
);
219 INT (*pSetBkMode
)(PHYSDEV
,INT
);
220 UINT (*pSetDIBColorTable
)(PHYSDEV
,UINT
,UINT
,const RGBQUAD
*);
221 INT (*pSetDIBits
)(PHYSDEV
,HBITMAP
,UINT
,UINT
,LPCVOID
,const BITMAPINFO
*,UINT
);
222 INT (*pSetDIBitsToDevice
)(PHYSDEV
,INT
,INT
,DWORD
,DWORD
,INT
,INT
,UINT
,UINT
,LPCVOID
,
223 const BITMAPINFO
*,UINT
);
224 VOID (*pSetDeviceClipping
)(PHYSDEV
,HRGN
);
225 BOOL (*pSetDeviceGammaRamp
)(PHYSDEV
,LPVOID
);
226 INT (*pSetMapMode
)(PHYSDEV
,INT
);
227 DWORD (*pSetMapperFlags
)(PHYSDEV
,DWORD
);
228 COLORREF (*pSetPixel
)(PHYSDEV
,INT
,INT
,COLORREF
);
229 BOOL (*pSetPixelFormat
)(PHYSDEV
,INT
,const PIXELFORMATDESCRIPTOR
*);
230 INT (*pSetPolyFillMode
)(PHYSDEV
,INT
);
231 INT (*pSetROP2
)(PHYSDEV
,INT
);
232 INT (*pSetRelAbs
)(PHYSDEV
,INT
);
233 INT (*pSetStretchBltMode
)(PHYSDEV
,INT
);
234 UINT (*pSetTextAlign
)(PHYSDEV
,UINT
);
235 INT (*pSetTextCharacterExtra
)(PHYSDEV
,INT
);
236 DWORD (*pSetTextColor
)(PHYSDEV
,DWORD
);
237 INT (*pSetTextJustification
)(PHYSDEV
,INT
,INT
);
238 BOOL (*pSetViewportExt
)(PHYSDEV
,INT
,INT
);
239 BOOL (*pSetViewportOrg
)(PHYSDEV
,INT
,INT
);
240 BOOL (*pSetWindowExt
)(PHYSDEV
,INT
,INT
);
241 BOOL (*pSetWindowOrg
)(PHYSDEV
,INT
,INT
);
242 INT (*pStartDoc
)(PHYSDEV
,const DOCINFOA
*);
243 INT (*pStartPage
)(PHYSDEV
);
244 BOOL (*pStretchBlt
)(PHYSDEV
,INT
,INT
,INT
,INT
,PHYSDEV
,INT
,INT
,INT
,INT
,DWORD
);
245 INT (*pStretchDIBits
)(PHYSDEV
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,INT
,const void *,
246 const BITMAPINFO
*,UINT
,DWORD
);
247 BOOL (*pStrokeAndFillPath
)(PHYSDEV
);
248 BOOL (*pStrokePath
)(PHYSDEV
);
249 BOOL (*pSwapBuffers
)(PHYSDEV
);
250 BOOL (*pWidenPath
)(PHYSDEV
);
254 #define DCHC_INVALIDVISRGN 0x0001
255 #define DCHC_DELETEDC 0x0002
257 #define DCHF_INVALIDATEVISRGN 0x0001
258 #define DCHF_VALIDATEVISRGN 0x0002
261 #define DC_MEMORY 0x0001 /* It is a memory DC */
262 #define DC_SAVED 0x0002 /* It is a saved DC */
263 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
264 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
266 #define GDI_HEAP_SIZE 0xffe0
268 /* extra stock object: default 1x1 bitmap for memory DCs */
269 #define DEFAULT_BITMAP (STOCK_LAST+1)
271 /* Device <-> logical coords conversion */
273 /* A floating point version of the POINT structure */
274 typedef struct tagFLOAT_POINT
279 /* Rounds a floating point number to integer. The world-to-viewport
280 * transformation process is done in floating point internally. This function
281 * is then used to round these coordinates to integer values.
283 static inline INT WINE_UNUSED
GDI_ROUND(FLOAT val
)
285 return (int)floor(val
+ 0.5);
288 /* Performs a viewport-to-world transformation on the specified point (which
289 * is in floating point format). Returns TRUE if successful, else FALSE.
291 static inline BOOL WINE_UNUSED
INTERNAL_DPTOLP_FLOAT(DC
*dc
, FLOAT_POINT
*point
)
295 /* Check that the viewport-to-world transformation is valid */
296 if (!dc
->vport2WorldValid
)
299 /* Perform the transformation */
302 point
->x
= x
* dc
->xformVport2World
.eM11
+
303 y
* dc
->xformVport2World
.eM21
+
304 dc
->xformVport2World
.eDx
;
305 point
->y
= x
* dc
->xformVport2World
.eM12
+
306 y
* dc
->xformVport2World
.eM22
+
307 dc
->xformVport2World
.eDy
;
312 /* Performs a viewport-to-world transformation on the specified point (which
313 * is in integer format). Returns TRUE if successful, else FALSE.
315 static inline BOOL WINE_UNUSED
INTERNAL_DPTOLP(DC
*dc
, LPPOINT point
)
317 FLOAT_POINT floatPoint
;
319 /* Perform operation with floating point */
320 floatPoint
.x
=(FLOAT
)point
->x
;
321 floatPoint
.y
=(FLOAT
)point
->y
;
322 if (!INTERNAL_DPTOLP_FLOAT(dc
, &floatPoint
))
325 /* Round to integers */
326 point
->x
= GDI_ROUND(floatPoint
.x
);
327 point
->y
= GDI_ROUND(floatPoint
.y
);
332 /* Performs a world-to-viewport transformation on the specified point (which
333 * is in floating point format).
335 static inline void WINE_UNUSED
INTERNAL_LPTODP_FLOAT(DC
*dc
, FLOAT_POINT
*point
)
339 /* Perform the transformation */
342 point
->x
= x
* dc
->xformWorld2Vport
.eM11
+
343 y
* dc
->xformWorld2Vport
.eM21
+
344 dc
->xformWorld2Vport
.eDx
;
345 point
->y
= x
* dc
->xformWorld2Vport
.eM12
+
346 y
* dc
->xformWorld2Vport
.eM22
+
347 dc
->xformWorld2Vport
.eDy
;
350 /* Performs a world-to-viewport transformation on the specified point (which
351 * is in integer format).
353 static inline void WINE_UNUSED
INTERNAL_LPTODP(DC
*dc
, LPPOINT point
)
355 FLOAT_POINT floatPoint
;
357 /* Perform operation with floating point */
358 floatPoint
.x
=(FLOAT
)point
->x
;
359 floatPoint
.y
=(FLOAT
)point
->y
;
360 INTERNAL_LPTODP_FLOAT(dc
, &floatPoint
);
362 /* Round to integers */
363 point
->x
= GDI_ROUND(floatPoint
.x
);
364 point
->y
= GDI_ROUND(floatPoint
.y
);
368 /* Performs a world-to-viewport transformation on the specified point (which
369 * is in integer format).
371 static inline INT WINE_UNUSED
INTERNAL_XWPTODP(DC
*dc
, INT x
, INT y
)
373 FLOAT_POINT floatPoint
;
375 /* Perform operation with floating point */
376 floatPoint
.x
=(FLOAT
)x
;
377 floatPoint
.y
=(FLOAT
)y
;
378 INTERNAL_LPTODP_FLOAT(dc
, &floatPoint
);
380 /* Round to integers */
381 return GDI_ROUND(floatPoint
.x
);
384 /* Performs a world-to-viewport transformation on the specified point (which
385 * is in integer format).
387 static inline INT WINE_UNUSED
INTERNAL_YWPTODP(DC
*dc
, INT x
, INT y
)
389 FLOAT_POINT floatPoint
;
391 /* Perform operation with floating point */
392 floatPoint
.x
=(FLOAT
)x
;
393 floatPoint
.y
=(FLOAT
)y
;
394 INTERNAL_LPTODP_FLOAT(dc
, &floatPoint
);
396 /* Round to integers */
397 return GDI_ROUND(floatPoint
.y
);
401 /* Performs a viewport-to-world transformation on the specified point (which
402 * is in integer format).
404 static inline INT WINE_UNUSED
INTERNAL_XDPTOWP(DC
*dc
, INT x
, INT y
)
406 FLOAT_POINT floatPoint
;
408 /* Perform operation with floating point */
409 floatPoint
.x
=(FLOAT
)x
;
410 floatPoint
.y
=(FLOAT
)y
;
411 INTERNAL_DPTOLP_FLOAT(dc
, &floatPoint
);
413 /* Round to integers */
414 return GDI_ROUND(floatPoint
.x
);
417 /* Performs a viewport-to-world transformation on the specified point (which
418 * is in integer format).
420 static inline INT WINE_UNUSED
INTERNAL_YDPTOWP(DC
*dc
, INT x
, INT y
)
422 FLOAT_POINT floatPoint
;
424 /* Perform operation with floating point */
425 floatPoint
.x
=(FLOAT
)x
;
426 floatPoint
.y
=(FLOAT
)y
;
427 INTERNAL_DPTOLP_FLOAT(dc
, &floatPoint
);
429 /* Round to integers */
430 return GDI_ROUND(floatPoint
.y
);
434 #define XDPTOLP(dc,x) \
435 (MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
436 #define YDPTOLP(dc,y) \
437 (MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) + (dc)->wndOrgY)
438 #define XLPTODP(dc,x) \
439 (MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) + (dc)->vportOrgX)
440 #define YLPTODP(dc,y) \
441 (MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) + (dc)->vportOrgY)
445 /* World -> Device size conversion */
447 /* Performs a world-to-viewport transformation on the specified width (which
448 * is in floating point format).
450 static inline void WINE_UNUSED
INTERNAL_XWSTODS_FLOAT(DC
*dc
, FLOAT
*width
)
452 /* Perform the transformation */
453 *width
= *width
* dc
->xformWorld2Vport
.eM11
;
456 /* Performs a world-to-viewport transformation on the specified width (which
457 * is in integer format).
459 static inline INT WINE_UNUSED
INTERNAL_XWSTODS(DC
*dc
, INT width
)
463 /* Perform operation with floating point */
464 floatWidth
= (FLOAT
)width
;
465 INTERNAL_XWSTODS_FLOAT(dc
, &floatWidth
);
467 /* Round to integers */
468 return GDI_ROUND(floatWidth
);
472 /* Performs a world-to-viewport transformation on the specified size (which
473 * is in floating point format).
475 static inline void WINE_UNUSED
INTERNAL_YWSTODS_FLOAT(DC
*dc
, FLOAT
*height
)
477 /* Perform the transformation */
478 *height
= *height
* dc
->xformWorld2Vport
.eM22
;
481 /* Performs a world-to-viewport transformation on the specified size (which
482 * is in integer format).
484 static inline INT WINE_UNUSED
INTERNAL_YWSTODS(DC
*dc
, INT height
)
488 /* Perform operation with floating point */
489 floatHeight
= (FLOAT
)height
;
490 INTERNAL_YWSTODS_FLOAT(dc
, &floatHeight
);
492 /* Round to integers */
493 return GDI_ROUND(floatHeight
);
497 /* Device -> World size conversion */
499 /* Performs a device to world transformation on the specified width (which
500 * is in floating point format).
502 static inline void INTERNAL_XDSTOWS_FLOAT(DC
*dc
, FLOAT
*width
)
504 /* Perform the transformation */
505 *width
= *width
* dc
->xformVport2World
.eM11
;
508 /* Performs a device to world transformation on the specified width (which
509 * is in integer format).
511 static inline INT
INTERNAL_XDSTOWS(DC
*dc
, INT width
)
515 /* Perform operation with floating point */
516 floatWidth
= (FLOAT
)width
;
517 INTERNAL_XDSTOWS_FLOAT(dc
, &floatWidth
);
519 /* Round to integers */
520 return GDI_ROUND(floatWidth
);
524 /* Performs a device to world transformation on the specified size (which
525 * is in floating point format).
527 static inline void INTERNAL_YDSTOWS_FLOAT(DC
*dc
, FLOAT
*height
)
529 /* Perform the transformation */
530 *height
= *height
* dc
->xformVport2World
.eM22
;
533 /* Performs a device to world transformation on the specified size (which
534 * is in integer format).
536 static inline INT
INTERNAL_YDSTOWS(DC
*dc
, INT height
)
540 /* Perform operation with floating point */
541 floatHeight
= (FLOAT
)height
;
542 INTERNAL_YDSTOWS_FLOAT(dc
, &floatHeight
);
544 /* Round to integers */
545 return GDI_ROUND(floatHeight
);
549 /* Device <-> logical size conversion */
551 #define XDSTOLS(dc,x) \
552 MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
553 #define YDSTOLS(dc,y) \
554 MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
555 #define XLSTODS(dc,x) \
556 MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
557 #define YLSTODS(dc,y) \
558 MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
562 extern BOOL
GDI_Init(void);
563 extern void *GDI_AllocObject( WORD
, WORD
, HGDIOBJ
* );
564 extern void *GDI_ReallocObject( WORD
, HGDIOBJ
, void *obj
);
565 extern BOOL
GDI_FreeObject( HGDIOBJ
, void *obj
);
566 extern void *GDI_GetObjPtr( HGDIOBJ
, WORD
);
567 extern void GDI_ReleaseObj( HGDIOBJ
);
568 extern void GDI_CheckNotLock(void);
570 extern const DC_FUNCTIONS
*DRIVER_load_driver( LPCSTR name
);
571 extern const DC_FUNCTIONS
*DRIVER_get_driver( const DC_FUNCTIONS
*funcs
);
572 extern void DRIVER_release_driver( const DC_FUNCTIONS
*funcs
);
573 extern BOOL
DRIVER_GetDriverName( LPCSTR device
, LPSTR driver
, DWORD size
);
575 extern POINT
*GDI_Bezier( const POINT
*Points
, INT count
, INT
*nPtsOut
);
577 extern DC
* DC_AllocDC( const DC_FUNCTIONS
*funcs
);
578 extern DC
* DC_GetDCPtr( HDC hdc
);
579 extern DC
* DC_GetDCUpdate( HDC hdc
);
580 extern void DC_InitDC( DC
* dc
);
581 extern void DC_UpdateXforms( DC
* dc
);
583 /* objects/clipping.c */
584 extern void CLIPPING_UpdateGCRegion( DC
* dc
);
586 /* objects/enhmetafile.c */
587 extern HENHMETAFILE
EMF_Create_HENHMETAFILE(ENHMETAHEADER
*emh
, BOOL on_disk
);
589 #define WINE_GGO_GRAY16_BITMAP 0x7f
591 #endif /* __WINE_GDI_H */