source: trunk/include/win/gdi.h@ 6682

Last change on this file since 6682 was 6682, checked in by sandervl, 24 years ago

header updates

File size: 9.7 KB
Line 
1/* $Id: gdi.h,v 1.3 2001-09-09 12:23:31 sandervl Exp $ */
2
3/*
4 * GDI definitions
5 *
6 * Copyright 1993 Alexandre Julliard
7 */
8
9#ifndef __WINE_GDI_H
10#define __WINE_GDI_H
11
12#include "windef.h"
13#include "wingdi.h"
14#include "ldt.h"
15#include "path.h"
16#include <math.h>
17#include "local.h"
18
19 /* GDI objects magic numbers */
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
34#define MAGIC_DONTCARE 0xffff
35
36typedef struct tagGDIOBJHDR
37{
38 HANDLE16 hNext;
39 WORD wMagic;
40 DWORD dwCount;
41} GDIOBJHDR;
42
43
44typedef struct tagDeviceCaps
45{
46 WORD version; /* 0: driver version */
47 WORD technology; /* 2: device technology */
48 WORD horzSize; /* 4: width of display in mm */
49 WORD vertSize; /* 6: height of display in mm */
50 WORD horzRes; /* 8: width of display in pixels */
51 WORD vertRes; /* 10: width of display in pixels */
52 WORD bitsPixel; /* 12: bits per pixel */
53 WORD planes; /* 14: color planes */
54 WORD numBrushes; /* 16: device-specific brushes */
55 WORD numPens; /* 18: device-specific pens */
56 WORD numMarkers; /* 20: device-specific markers */
57 WORD numFonts; /* 22: device-specific fonts */
58 WORD numColors; /* 24: size of color table */
59 WORD pdeviceSize; /* 26: size of PDEVICE structure */
60 WORD curveCaps; /* 28: curve capabilities */
61 WORD lineCaps; /* 30: line capabilities */
62 WORD polygonalCaps; /* 32: polygon capabilities */
63 WORD textCaps; /* 34: text capabilities */
64 WORD clipCaps; /* 36: clipping capabilities */
65 WORD rasterCaps; /* 38: raster capabilities */
66 WORD aspectX; /* 40: relative width of device pixel */
67 WORD aspectY; /* 42: relative height of device pixel */
68 WORD aspectXY; /* 44: relative diagonal width of device pixel */
69 WORD pad1[21]; /* 46-86: reserved */
70 WORD logPixelsX; /* 88: pixels / logical X inch */
71 WORD logPixelsY; /* 90: pixels / logical Y inch */
72 WORD pad2[6]; /* 92-102: reserved */
73 WORD sizePalette; /* 104: entries in system palette */
74 WORD numReserved; /* 106: reserved entries */
75 WORD colorRes; /* 108: color resolution */
76} DeviceCaps;
77
78typedef struct tagGDI_DRIVER
79{
80 BOOL (*pInitialize)(void);
81 void (*pFinalize)(void);
82} GDI_DRIVER;
83
84extern GDI_DRIVER *GDI_Driver;
85
86 /* Device independent DC information */
87typedef struct
88{
89 int flags;
90 const DeviceCaps *devCaps;
91
92 HRGN16 hClipRgn; /* Clip region (may be 0) */
93 HRGN16 hVisRgn; /* Visible region (must never be 0) */
94 HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
95 HPEN16 hPen;
96 HBRUSH16 hBrush;
97 HFONT16 hFont;
98 HBITMAP16 hBitmap;
99 HBITMAP16 hFirstBitmap; /* Bitmap selected at creation of the DC */
100 HANDLE16 hDevice;
101 HPALETTE16 hPalette;
102
103 GdiPath path;
104
105 WORD ROPmode;
106 WORD polyFillMode;
107 WORD stretchBltMode;
108 WORD relAbsMode;
109 WORD backgroundMode;
110 COLORREF backgroundColor;
111 COLORREF textColor;
112 short brushOrgX;
113 short brushOrgY;
114
115 WORD textAlign; /* Text alignment from SetTextAlign() */
116 short charExtra; /* Spacing from SetTextCharacterExtra() */
117 short breakTotalExtra; /* Total extra space for justification */
118 short breakCount; /* Break char. count */
119 short breakExtra; /* breakTotalExtra / breakCount */
120 short breakRem; /* breakTotalExtra % breakCount */
121
122 RECT totalExtent;
123 BYTE bitsPerPixel;
124
125 INT MapMode;
126 INT GraphicsMode; /* Graphics mode */
127 INT DCOrgX; /* DC origin */
128 INT DCOrgY;
129 FARPROC16 lpfnPrint; /* AbortProc for Printing */
130 INT CursPosX; /* Current position */
131 INT CursPosY;
132 INT ArcDirection;
133 XFORM xformWorld2Wnd; /* World-to-window transformation */
134 XFORM xformWorld2Vport; /* World-to-viewport transformation */
135 XFORM xformVport2World; /* Inverse of the above transformation */
136 BOOL vport2WorldValid; /* Is xformVport2World valid? */
137} WIN_DC_INFO;
138
139typedef struct tagDC
140{
141 GDIOBJHDR header;
142 HDC hSelf; /* Handle to this DC */
143 const struct tagDC_FUNCS *funcs; /* DC function table */
144 void *physDev; /* Physical device (driver-specific) */
145 INT saveLevel;
146 DWORD dwHookData;
147 FARPROC16 hookProc;
148
149 INT wndOrgX; /* Window origin */
150 INT wndOrgY;
151 INT wndExtX; /* Window extent */
152 INT wndExtY;
153 INT vportOrgX; /* Viewport origin */
154 INT vportOrgY;
155 INT vportExtX; /* Viewport extent */
156 INT vportExtY;
157
158 WIN_DC_INFO w;
159} DC;
160
161
162 /* LoadOEMResource types */
163#define OEM_BITMAP 1
164#define OEM_CURSOR 2
165#define OEM_ICON 3
166
167 /* DC hook codes */
168#define DCHC_INVALIDVISRGN 0x0001
169#define DCHC_DELETEDC 0x0002
170
171#define DCHF_INVALIDATEVISRGN 0x0001
172#define DCHF_VALIDATEVISRGN 0x0002
173
174 /* DC flags */
175#define DC_MEMORY 0x0001 /* It is a memory DC */
176#define DC_SAVED 0x0002 /* It is a saved DC */
177#define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
178#define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
179
180 /* Last 32 bytes are reserved for stock object handles */
181#define GDI_HEAP_SIZE 0xffe0
182
183 /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
184#define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
185
186 /* Stock objects handles */
187
188#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
189
190#define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
191#define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
192#define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
193#define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
194#define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
195#define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH))
196#define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
197#define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
198#define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
199#define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
200#define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
201#define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
202#define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
203#define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
204#define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
205#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
206#define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
207#define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
208
209#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
210#define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
211
212#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
213
214 /* Device <-> logical coords conversion */
215
216/* A floating point version of the POINT structure */
217typedef struct tagFLOAT_POINT
218{
219 FLOAT x, y;
220} FLOAT_POINT;
221
222
223#define XDPTOLP(dc,x) \
224 (((x)-(dc)->vportOrgX) * (dc)->wndExtX / (dc)->vportExtX+(dc)->wndOrgX)
225#define YDPTOLP(dc,y) \
226 (((y)-(dc)->vportOrgY) * (dc)->wndExtY / (dc)->vportExtY+(dc)->wndOrgY)
227#define XLPTODP(dc,x) \
228 (((x)-(dc)->wndOrgX) * (dc)->vportExtX / (dc)->wndExtX+(dc)->vportOrgX)
229#define YLPTODP(dc,y) \
230 (((y)-(dc)->wndOrgY) * (dc)->vportExtY / (dc)->wndExtY+(dc)->vportOrgY)
231
232 /* Device <-> logical size conversion */
233
234#define XDSTOLS(dc,x) \
235 ((x) * (dc)->wndExtX / (dc)->vportExtX)
236#define YDSTOLS(dc,y) \
237 ((y) * (dc)->wndExtY / (dc)->vportExtY)
238#define XLSTODS(dc,x) \
239 ((x) * (dc)->vportExtX / (dc)->wndExtX)
240#define YLSTODS(dc,y) \
241 ((y) * (dc)->vportExtY / (dc)->wndExtY)
242
243 /* GDI local heap */
244
245extern WORD GDI_HeapSel;
246
247#define GDI_HEAP_ALLOC(size) \
248 LOCAL_Alloc( GDI_HeapSel, LMEM_FIXED, (size) )
249#define GDI_HEAP_ALLOC_MOVEABLE(size) \
250 LOCAL_Alloc( GDI_HeapSel, LMEM_MOVEABLE, (size) )
251#define GDI_HEAP_REALLOC(handle,size) \
252 LOCAL_ReAlloc( GDI_HeapSel, (handle), (size), LMEM_FIXED )
253#define GDI_HEAP_FREE(handle) \
254 LOCAL_Free( GDI_HeapSel, (handle) )
255
256#define GDI_HEAP_LOCK(handle) \
257 LOCAL_Lock( GDI_HeapSel, (handle) )
258#define GDI_HEAP_LOCK_SEGPTR(handle) \
259 LOCAL_LockSegptr( GDI_HeapSel, (handle) )
260#define GDI_HEAP_UNLOCK(handle) \
261 ((((HGDIOBJ16)(handle) >= FIRST_STOCK_HANDLE) && \
262 ((HGDIOBJ16)(handle)<=LAST_STOCK_HANDLE)) ? \
263 0 : LOCAL_Unlock( GDI_HeapSel, (handle) ))
264
265extern BOOL GDI_Init(void);
266extern HGDIOBJ16 GDI_AllocObject( WORD, WORD );
267extern BOOL GDI_FreeObject( HGDIOBJ16 );
268extern GDIOBJHDR * GDI_GetObjPtr( HGDIOBJ16, WORD );
269
270
271#endif /* __WINE_GDI_H */
Note: See TracBrowser for help on using the repository browser.