Moved a bunch of definitions from gdi.h into a new gdi_private.h to
[wine/multimedia.git] / include / gdi.h
blob6f11508be2c26daaf23f9ddf501d53df9256a8c4
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 <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <wingdi.h>
28 #include <wine/wingdi16.h>
29 #include <math.h>
31 /* GDI objects magic numbers */
32 #define FIRST_MAGIC 0x4f47
33 #define PEN_MAGIC 0x4f47
34 #define BRUSH_MAGIC 0x4f48
35 #define FONT_MAGIC 0x4f49
36 #define PALETTE_MAGIC 0x4f4a
37 #define BITMAP_MAGIC 0x4f4b
38 #define REGION_MAGIC 0x4f4c
39 #define DC_MAGIC 0x4f4d
40 #define DISABLED_DC_MAGIC 0x4f4e
41 #define META_DC_MAGIC 0x4f4f
42 #define METAFILE_MAGIC 0x4f50
43 #define METAFILE_DC_MAGIC 0x4f51
44 #define ENHMETAFILE_MAGIC 0x4f52
45 #define ENHMETAFILE_DC_MAGIC 0x4f53
46 #define MEMORY_DC_MAGIC 0x4f54
47 #define LAST_MAGIC 0x4f54
49 #define MAGIC_DONTCARE 0xffff
51 /* GDI constants for making objects private/system (naming undoc. !) */
52 #define OBJECT_PRIVATE 0x2000
53 #define OBJECT_NOSYSTEM 0x8000
55 #define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
57 struct gdi_obj_funcs;
58 struct hdc_list;
60 typedef struct tagGDIOBJHDR
62 HANDLE16 hNext;
63 WORD wMagic;
64 DWORD dwCount;
65 const struct gdi_obj_funcs *funcs;
66 struct hdc_list *hdcs;
67 } GDIOBJHDR;
70 /* It should not be necessary to access the contents of the GdiPath
71 * structure directly; if you find that the exported functions don't
72 * allow you to do what you want, then please place a new exported
73 * function that does this job in path.c.
75 typedef enum tagGdiPathState
77 PATH_Null,
78 PATH_Open,
79 PATH_Closed
80 } GdiPathState;
82 typedef struct tagGdiPath
84 GdiPathState state;
85 POINT *pPoints;
86 BYTE *pFlags;
87 int numEntriesUsed, numEntriesAllocated;
88 BOOL newStroke;
89 } GdiPath;
91 typedef struct tagGdiFont *GdiFont;
93 typedef struct { int opaque; } *PHYSDEV; /* PHYSDEV is an opaque pointer */
95 typedef struct tagDC
97 GDIOBJHDR header;
98 HDC hSelf; /* Handle to this DC */
99 const struct tagDC_FUNCS *funcs; /* DC function table */
100 PHYSDEV physDev; /* Physical device (driver-specific) */
101 INT saveLevel;
102 DWORD dwHookData;
103 FARPROC16 hookProc; /* the original SEGPTR ... */
104 DCHOOKPROC hookThunk; /* ... and the thunk to call it */
106 INT wndOrgX; /* Window origin */
107 INT wndOrgY;
108 INT wndExtX; /* Window extent */
109 INT wndExtY;
110 INT vportOrgX; /* Viewport origin */
111 INT vportOrgY;
112 INT vportExtX; /* Viewport extent */
113 INT vportExtY;
115 int flags;
116 HRGN hClipRgn; /* Clip region (may be 0) */
117 HRGN hVisRgn; /* Visible region (must never be 0) */
118 HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
119 HPEN hPen;
120 HBRUSH hBrush;
121 HFONT hFont;
122 HBITMAP hBitmap;
123 HANDLE hDevice;
124 HPALETTE hPalette;
126 GdiFont gdiFont;
127 GdiPath path;
129 WORD ROPmode;
130 WORD polyFillMode;
131 WORD stretchBltMode;
132 WORD relAbsMode;
133 WORD backgroundMode;
134 COLORREF backgroundColor;
135 COLORREF textColor;
136 COLORREF dcBrushColor;
137 COLORREF dcPenColor;
138 short brushOrgX;
139 short brushOrgY;
141 WORD textAlign; /* Text alignment from SetTextAlign() */
142 short charExtra; /* Spacing from SetTextCharacterExtra() */
143 short breakTotalExtra; /* Total extra space for justification */
144 short breakCount; /* Break char. count */
145 short breakExtra; /* breakTotalExtra / breakCount */
146 short breakRem; /* breakTotalExtra % breakCount */
148 RECT totalExtent;
149 BYTE bitsPerPixel;
151 INT MapMode;
152 INT GraphicsMode; /* Graphics mode */
153 ABORTPROC pAbortProc; /* AbortProc for Printing */
154 ABORTPROC16 pAbortProc16;
155 INT CursPosX; /* Current position */
156 INT CursPosY;
157 INT ArcDirection;
158 XFORM xformWorld2Wnd; /* World-to-window transformation */
159 XFORM xformWorld2Vport; /* World-to-viewport transformation */
160 XFORM xformVport2World; /* Inverse of the above transformation */
161 BOOL vport2WorldValid; /* Is xformVport2World valid? */
162 } DC;
164 typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,NEWTEXTMETRICEXW *,DWORD,LPARAM);
166 /* extra stock object: default 1x1 bitmap for memory DCs */
167 #define DEFAULT_BITMAP (STOCK_LAST+1)
169 /* Rounds a floating point number to integer. The world-to-viewport
170 * transformation process is done in floating point internally. This function
171 * is then used to round these coordinates to integer values.
173 static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
175 return (int)floor(val + 0.5);
178 /* World -> Device size conversion */
180 /* Performs a world-to-viewport transformation on the specified width (which
181 * is in integer format).
183 static inline INT WINE_UNUSED INTERNAL_XWSTODS(DC *dc, INT width)
185 FLOAT floatWidth;
187 /* Perform operation with floating point */
188 floatWidth = (FLOAT)width * dc->xformWorld2Vport.eM11;
189 /* Round to integers */
190 return GDI_ROUND(floatWidth);
193 /* Performs a world-to-viewport transformation on the specified size (which
194 * is in integer format).
196 static inline INT WINE_UNUSED INTERNAL_YWSTODS(DC *dc, INT height)
198 FLOAT floatHeight;
200 /* Perform operation with floating point */
201 floatHeight = (FLOAT)height * dc->xformWorld2Vport.eM22;
202 /* Round to integers */
203 return GDI_ROUND(floatHeight);
206 /* GDI local heap */
208 extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
209 extern void GDI_ReleaseObj( HGDIOBJ );
211 #define WINE_GGO_GRAY16_BITMAP 0x7f
213 #endif /* __WINE_GDI_H */