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))
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
70 const struct gdi_obj_funcs *funcs;
74 typedef struct tagGdiFont *GdiFont;
76 typedef struct { int opaque; } *PHYSDEV; /* PHYSDEV is an opaque pointer */
81 HDC hSelf; /* Handle to this DC */
82 const struct tagDC_FUNCS *funcs; /* DC function table */
83 PHYSDEV physDev; /* Physical device (driver-specific) */
86 FARPROC16 hookProc; /* the original SEGPTR ... */
87 DCHOOKPROC hookThunk; /* ... and the thunk to call it */
89 INT wndOrgX; /* Window origin */
91 INT wndExtX; /* Window extent */
93 INT vportOrgX; /* Viewport origin */
95 INT vportExtX; /* Viewport extent */
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) */
117 COLORREF backgroundColor;
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 */
133 INT GraphicsMode; /* Graphics mode */
134 ABORTPROC pAbortProc; /* AbortProc for Printing */
135 ABORTPROC16 pAbortProc16;
136 INT CursPosX; /* Current position */
139 XFORM xformWorld2Wnd; /* World-to-window transformation */
140 XFORM xformWorld2Vport; /* World-to-viewport transformation */
141 XFORM xformVport2World; /* Inverse of the above transformation */
142 BOOL vport2WorldValid; /* Is xformVport2World valid? */
145 /* Device functions for the Wine driver interface */
147 typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,LPNEWTEXTMETRICEXW,DWORD,
150 typedef struct tagDC_FUNCS
152 INT (*pAbortDoc)(PHYSDEV);
153 BOOL (*pAbortPath)(PHYSDEV);
154 BOOL (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
155 BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
156 BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
157 BOOL (*pBeginPath)(PHYSDEV);
158 BOOL (*pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
159 INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
160 BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
161 BOOL (*pCloseFigure)(PHYSDEV);
162 BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP);
163 BOOL (*pCreateDC)(DC *,PHYSDEV *,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
164 HBITMAP (*pCreateDIBSection)(PHYSDEV,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD,DWORD);
165 BOOL (*pDeleteBitmap)(HBITMAP);
166 BOOL (*pDeleteDC)(PHYSDEV);
167 INT (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
168 DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
169 BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
170 INT (*pEndDoc)(PHYSDEV);
171 INT (*pEndPage)(PHYSDEV);
172 BOOL (*pEndPath)(PHYSDEV);
173 BOOL (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
174 INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
175 INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
176 INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
177 BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
178 INT (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
179 BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
180 BOOL (*pFillPath)(PHYSDEV);
181 BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
182 BOOL (*pFlattenPath)(PHYSDEV);
183 BOOL (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
184 LONG (*pGetBitmapBits)(HBITMAP,void*,LONG);
185 BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
186 BOOL (*pGetDCOrgEx)(PHYSDEV,LPPOINT);
187 UINT (*pGetDIBColorTable)(PHYSDEV,UINT,UINT,RGBQUAD*);
188 INT (*pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
189 INT (*pGetDeviceCaps)(PHYSDEV,INT);
190 BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
191 COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
192 COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
193 INT (*pGetPixelFormat)(PHYSDEV);
194 UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
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 (*pRealizeDefaultPalette)(PHYSDEV);
216 UINT (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
217 BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
218 HDC (*pResetDC)(PHYSDEV,const DEVMODEA*);
219 BOOL (*pRestoreDC)(PHYSDEV,INT);
220 BOOL (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
221 INT (*pSaveDC)(PHYSDEV);
222 BOOL (*pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT);
223 BOOL (*pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT);
224 HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
225 HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH);
226 BOOL (*pSelectClipPath)(PHYSDEV,INT);
227 HFONT (*pSelectFont)(PHYSDEV,HFONT);
228 HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
229 HPEN (*pSelectPen)(PHYSDEV,HPEN);
230 LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
231 COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
232 INT (*pSetBkMode)(PHYSDEV,INT);
233 DWORD (*pSetDCOrg)(PHYSDEV,INT,INT);
234 UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
235 INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
236 INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
237 const BITMAPINFO*,UINT);
238 VOID (*pSetDeviceClipping)(PHYSDEV,HRGN);
239 BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
240 INT (*pSetMapMode)(PHYSDEV,INT);
241 DWORD (*pSetMapperFlags)(PHYSDEV,DWORD);
242 COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
243 BOOL (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
244 INT (*pSetPolyFillMode)(PHYSDEV,INT);
245 INT (*pSetROP2)(PHYSDEV,INT);
246 INT (*pSetRelAbs)(PHYSDEV,INT);
247 INT (*pSetStretchBltMode)(PHYSDEV,INT);
248 UINT (*pSetTextAlign)(PHYSDEV,UINT);
249 INT (*pSetTextCharacterExtra)(PHYSDEV,INT);
250 DWORD (*pSetTextColor)(PHYSDEV,DWORD);
251 INT (*pSetTextJustification)(PHYSDEV,INT,INT);
252 BOOL (*pSetViewportExt)(PHYSDEV,INT,INT);
253 BOOL (*pSetViewportOrg)(PHYSDEV,INT,INT);
254 BOOL (*pSetWindowExt)(PHYSDEV,INT,INT);
255 BOOL (*pSetWindowOrg)(PHYSDEV,INT,INT);
256 INT (*pStartDoc)(PHYSDEV,const DOCINFOA*);
257 INT (*pStartPage)(PHYSDEV);
258 BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
259 INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
260 const BITMAPINFO*,UINT,DWORD);
261 BOOL (*pStrokeAndFillPath)(PHYSDEV);
262 BOOL (*pStrokePath)(PHYSDEV);
263 BOOL (*pSwapBuffers)(PHYSDEV);
264 BOOL (*pWidenPath)(PHYSDEV);
268 #define DCHC_INVALIDVISRGN 0x0001
269 #define DCHC_DELETEDC 0x0002
271 #define DCHF_INVALIDATEVISRGN 0x0001
272 #define DCHF_VALIDATEVISRGN 0x0002
275 #define DC_MEMORY 0x0001 /* It is a memory DC */
276 #define DC_SAVED 0x0002 /* It is a saved DC */
277 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
278 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
280 #define GDI_HEAP_SIZE 0xffe0
282 /* extra stock object: default 1x1 bitmap for memory DCs */
283 #define DEFAULT_BITMAP (STOCK_LAST+1)
285 /* Metafile defines */
287 #define META_EOF 0x0000
288 /* values of mtType in METAHEADER. Note however that the disk image of a disk
289 based metafile has mtType == 1 */
290 #define METAFILE_MEMORY 1
291 #define METAFILE_DISK 2
293 /* Device <-> logical coords conversion */
295 /* A floating point version of the POINT structure */
296 typedef struct tagFLOAT_POINT
301 /* Rounds a floating point number to integer. The world-to-viewport
302 * transformation process is done in floating point internally. This function
303 * is then used to round these coordinates to integer values.
305 static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
307 return (int)floor(val + 0.5);
310 /* Performs a viewport-to-world transformation on the specified point (which
311 * is in floating point format). Returns TRUE if successful, else FALSE.
313 static inline BOOL WINE_UNUSED INTERNAL_DPTOLP_FLOAT(DC *dc, FLOAT_POINT *point)
317 /* Check that the viewport-to-world transformation is valid */
318 if (!dc->vport2WorldValid)
321 /* Perform the transformation */
324 point->x = x * dc->xformVport2World.eM11 +
325 y * dc->xformVport2World.eM21 +
326 dc->xformVport2World.eDx;
327 point->y = x * dc->xformVport2World.eM12 +
328 y * dc->xformVport2World.eM22 +
329 dc->xformVport2World.eDy;
334 /* Performs a viewport-to-world transformation on the specified point (which
335 * is in integer format). Returns TRUE if successful, else FALSE.
337 static inline BOOL WINE_UNUSED INTERNAL_DPTOLP(DC *dc, LPPOINT point)
339 FLOAT_POINT floatPoint;
341 /* Perform operation with floating point */
342 floatPoint.x=(FLOAT)point->x;
343 floatPoint.y=(FLOAT)point->y;
344 if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
347 /* Round to integers */
348 point->x = GDI_ROUND(floatPoint.x);
349 point->y = GDI_ROUND(floatPoint.y);
354 /* Performs a world-to-viewport transformation on the specified point (which
355 * is in floating point format).
357 static inline void WINE_UNUSED INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
361 /* Perform the transformation */
364 point->x = x * dc->xformWorld2Vport.eM11 +
365 y * dc->xformWorld2Vport.eM21 +
366 dc->xformWorld2Vport.eDx;
367 point->y = x * dc->xformWorld2Vport.eM12 +
368 y * dc->xformWorld2Vport.eM22 +
369 dc->xformWorld2Vport.eDy;
372 /* Performs a world-to-viewport transformation on the specified point (which
373 * is in integer format).
375 static inline void WINE_UNUSED INTERNAL_LPTODP(DC *dc, LPPOINT point)
377 FLOAT_POINT floatPoint;
379 /* Perform operation with floating point */
380 floatPoint.x=(FLOAT)point->x;
381 floatPoint.y=(FLOAT)point->y;
382 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
384 /* Round to integers */
385 point->x = GDI_ROUND(floatPoint.x);
386 point->y = GDI_ROUND(floatPoint.y);
390 /* Performs a world-to-viewport transformation on the specified point (which
391 * is in integer format).
393 static inline INT WINE_UNUSED INTERNAL_XWPTODP(DC *dc, INT x, INT y)
395 FLOAT_POINT floatPoint;
397 /* Perform operation with floating point */
398 floatPoint.x=(FLOAT)x;
399 floatPoint.y=(FLOAT)y;
400 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
402 /* Round to integers */
403 return GDI_ROUND(floatPoint.x);
406 /* Performs a world-to-viewport transformation on the specified point (which
407 * is in integer format).
409 static inline INT WINE_UNUSED INTERNAL_YWPTODP(DC *dc, INT x, INT y)
411 FLOAT_POINT floatPoint;
413 /* Perform operation with floating point */
414 floatPoint.x=(FLOAT)x;
415 floatPoint.y=(FLOAT)y;
416 INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
418 /* Round to integers */
419 return GDI_ROUND(floatPoint.y);
423 /* Performs a viewport-to-world transformation on the specified point (which
424 * is in integer format).
426 static inline INT WINE_UNUSED INTERNAL_XDPTOWP(DC *dc, INT x, INT y)
428 FLOAT_POINT floatPoint;
430 /* Perform operation with floating point */
431 floatPoint.x=(FLOAT)x;
432 floatPoint.y=(FLOAT)y;
433 INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
435 /* Round to integers */
436 return GDI_ROUND(floatPoint.x);
439 /* Performs a viewport-to-world transformation on the specified point (which
440 * is in integer format).
442 static inline INT WINE_UNUSED INTERNAL_YDPTOWP(DC *dc, INT x, INT y)
444 FLOAT_POINT floatPoint;
446 /* Perform operation with floating point */
447 floatPoint.x=(FLOAT)x;
448 floatPoint.y=(FLOAT)y;
449 INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
451 /* Round to integers */
452 return GDI_ROUND(floatPoint.y);
456 #define XDPTOLP(dc,x) \
457 (MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
458 #define YDPTOLP(dc,y) \
459 (MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) + (dc)->wndOrgY)
460 #define XLPTODP(dc,x) \
461 (MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) + (dc)->vportOrgX)
462 #define YLPTODP(dc,y) \
463 (MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) + (dc)->vportOrgY)
467 /* World -> Device size conversion */
469 /* Performs a world-to-viewport transformation on the specified width (which
470 * is in floating point format).
472 static inline void WINE_UNUSED INTERNAL_XWSTODS_FLOAT(DC *dc, FLOAT *width)
474 /* Perform the transformation */
475 *width = *width * dc->xformWorld2Vport.eM11;
478 /* Performs a world-to-viewport transformation on the specified width (which
479 * is in integer format).
481 static inline INT WINE_UNUSED INTERNAL_XWSTODS(DC *dc, INT width)
485 /* Perform operation with floating point */
486 floatWidth = (FLOAT)width;
487 INTERNAL_XWSTODS_FLOAT(dc, &floatWidth);
489 /* Round to integers */
490 return GDI_ROUND(floatWidth);
494 /* Performs a world-to-viewport transformation on the specified size (which
495 * is in floating point format).
497 static inline void WINE_UNUSED INTERNAL_YWSTODS_FLOAT(DC *dc, FLOAT *height)
499 /* Perform the transformation */
500 *height = *height * dc->xformWorld2Vport.eM22;
503 /* Performs a world-to-viewport transformation on the specified size (which
504 * is in integer format).
506 static inline INT WINE_UNUSED INTERNAL_YWSTODS(DC *dc, INT height)
510 /* Perform operation with floating point */
511 floatHeight = (FLOAT)height;
512 INTERNAL_YWSTODS_FLOAT(dc, &floatHeight);
514 /* Round to integers */
515 return GDI_ROUND(floatHeight);
519 /* Device -> World size conversion */
521 /* Performs a device to world transformation on the specified width (which
522 * is in floating point format).
524 static inline void INTERNAL_XDSTOWS_FLOAT(DC *dc, FLOAT *width)
526 /* Perform the transformation */
527 *width = *width * dc->xformVport2World.eM11;
530 /* Performs a device to world transformation on the specified width (which
531 * is in integer format).
533 static inline INT INTERNAL_XDSTOWS(DC *dc, INT width)
537 /* Perform operation with floating point */
538 floatWidth = (FLOAT)width;
539 INTERNAL_XDSTOWS_FLOAT(dc, &floatWidth);
541 /* Round to integers */
542 return GDI_ROUND(floatWidth);
546 /* Performs a device to world transformation on the specified size (which
547 * is in floating point format).
549 static inline void INTERNAL_YDSTOWS_FLOAT(DC *dc, FLOAT *height)
551 /* Perform the transformation */
552 *height = *height * dc->xformVport2World.eM22;
555 /* Performs a device to world transformation on the specified size (which
556 * is in integer format).
558 static inline INT INTERNAL_YDSTOWS(DC *dc, INT height)
562 /* Perform operation with floating point */
563 floatHeight = (FLOAT)height;
564 INTERNAL_YDSTOWS_FLOAT(dc, &floatHeight);
566 /* Round to integers */
567 return GDI_ROUND(floatHeight);
571 /* Device <-> logical size conversion */
573 #define XDSTOLS(dc,x) \
574 MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
575 #define YDSTOLS(dc,y) \
576 MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
577 #define XLSTODS(dc,x) \
578 MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
579 #define YLSTODS(dc,y) \
580 MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
584 extern BOOL GDI_Init(void);
585 extern void *GDI_AllocObject( WORD, WORD, HGDIOBJ *, const struct gdi_obj_funcs *funcs );
586 extern void *GDI_ReallocObject( WORD, HGDIOBJ, void *obj );
587 extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
588 extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
589 extern void GDI_ReleaseObj( HGDIOBJ );
590 extern void GDI_CheckNotLock(void);
592 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name );
593 extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
594 extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
595 extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
597 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
599 extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs );
600 extern DC * DC_GetDCPtr( HDC hdc );
601 extern DC * DC_GetDCUpdate( HDC hdc );
602 extern void DC_InitDC( DC * dc );
603 extern void DC_UpdateXforms( DC * dc );
606 extern void CLIPPING_UpdateGCRegion( DC * dc );
609 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
612 extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh);
613 extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh);
614 extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCSTR filename);
617 extern HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt );
618 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y );
620 #define WINE_GGO_GRAY16_BITMAP 0x7f
622 #endif /* __WINE_GDI_H */