9af8e5e338dc9e250e0271258c442cbc17f15620
[reactos.git] / reactos / include / win32k / dc.h
1
2 #ifndef __WIN32K_DC_H
3 #define __WIN32K_DC_H
4
5 #include <windows.h>
6 #include <win32k/driver.h>
7 #include <win32k/gdiobj.h>
8
9 /* (RJJ) Taken from WINE */
10 typedef struct _DEVICECAPS
11 {
12 WORD version; /* 0: driver version */
13 WORD technology; /* 2: device technology */
14 WORD horzSize; /* 4: width of display in mm */
15 WORD vertSize; /* 6: height of display in mm */
16 WORD horzRes; /* 8: width of display in pixels */
17 WORD vertRes; /* 10: width of display in pixels */
18 WORD bitsPixel; /* 12: bits per pixel */
19 WORD planes; /* 14: color planes */
20 WORD numBrushes; /* 16: device-specific brushes */
21 WORD numPens; /* 18: device-specific pens */
22 WORD numMarkers; /* 20: device-specific markers */
23 WORD numFonts; /* 22: device-specific fonts */
24 WORD numColors; /* 24: size of color table */
25 WORD pdeviceSize; /* 26: size of PDEVICE structure */
26 WORD curveCaps; /* 28: curve capabilities */
27 WORD lineCaps; /* 30: line capabilities */
28 WORD polygonalCaps; /* 32: polygon capabilities */
29 WORD textCaps; /* 34: text capabilities */
30 WORD clipCaps; /* 36: clipping capabilities */
31 WORD rasterCaps; /* 38: raster capabilities */
32 WORD aspectX; /* 40: relative width of device pixel */
33 WORD aspectY; /* 42: relative height of device pixel */
34 WORD aspectXY; /* 44: relative diagonal width of device pixel */
35 WORD pad1[21]; /* 46-86: reserved */
36 WORD logPixelsX; /* 88: pixels / logical X inch */
37 WORD logPixelsY; /* 90: pixels / logical Y inch */
38 WORD pad2[6]; /* 92-102: reserved */
39 WORD sizePalette; /* 104: entries in system palette */
40 WORD numReserved; /* 106: reserved entries */
41 WORD colorRes; /* 108: color resolution */
42 } DEVICECAPS, *PDEVICECAPS;
43
44 typedef struct _WIN_DC_INFO
45 {
46 int flags;
47 const PDEVICECAPS devCaps;
48
49 HRGN hClipRgn; /* Clip region (may be 0) */
50
51 #if 0
52 HRGN hVisRgn; /* Visible region (must never be 0) */
53 HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
54 #endif
55
56 HPEN hPen;
57 HBRUSH hBrush;
58 HFONT hFont;
59 HBITMAP hBitmap;
60 HBITMAP hFirstBitmap; /* Bitmap selected at creation of the DC */
61
62 #if 0
63 HANDLE hDevice;
64 HPALETTE hPalette;
65
66 GdiPath path;
67 #endif
68
69 WORD ROPmode;
70 WORD polyFillMode;
71 WORD stretchBltMode;
72 WORD relAbsMode;
73 WORD backgroundMode;
74 COLORREF backgroundColor;
75 COLORREF textColor;
76
77 short brushOrgX;
78 short brushOrgY;
79
80 WORD textAlign; /* Text alignment from SetTextAlign() */
81 short charExtra; /* Spacing from SetTextCharacterExtra() */
82 short breakTotalExtra; /* Total extra space for justification */
83 short breakCount; /* Break char. count */
84 short breakExtra; /* breakTotalExtra / breakCount */
85 short breakRem; /* breakTotalExtra % breakCount */
86
87 RECT totalExtent;
88 BYTE bitsPerPixel;
89
90 INT MapMode;
91 INT GraphicsMode; /* Graphics mode */
92 INT DCOrgX; /* DC origin */
93 INT DCOrgY;
94
95 #if 0
96 FARPROC lpfnPrint; /* AbortProc for Printing */
97 #endif
98
99 INT CursPosX; /* Current position */
100 INT CursPosY;
101 INT ArcDirection;
102
103 XFORM xformWorld2Wnd; /* World-to-window transformation */
104 XFORM xformWorld2Vport; /* World-to-viewport transformation */
105 XFORM xformVport2World; /* Inverse of the above transformation */
106 BOOL vport2WorldValid; /* Is xformVport2World valid? */
107 } WIN_DC_INFO;
108
109 /* DC flags */
110 #define DC_MEMORY 0x0001 /* It is a memory DC */
111 #define DC_SAVED 0x0002 /* It is a saved DC */
112 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
113 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
114
115 #define GDI_DC_TYPE (1)
116
117 typedef struct _DC
118 {
119 GDIOBJHDR header;
120 HDC hSelf;
121 DHPDEV PDev;
122 DEVMODEW DMW;
123 HSURF FillPatternSurfaces[HS_DDI_MAX];
124 GDIINFO GDIInfo;
125 DEVINFO DevInfo;
126 HSURF Surface;
127
128 DRIVER_FUNCTIONS DriverFunctions;
129 PWSTR DriverName;
130 HANDLE DeviceDriver;
131
132 INT wndOrgX; /* Window origin */
133 INT wndOrgY;
134 INT wndExtX; /* Window extent */
135 INT wndExtY;
136 INT vportOrgX; /* Viewport origin */
137 INT vportOrgY;
138 INT vportExtX; /* Viewport extent */
139 INT vportExtY;
140
141 INT saveLevel;
142
143 WIN_DC_INFO w;
144 } DC, *PDC;
145
146 /* Internal functions */
147
148 #define DC_PtrToHandle(pDC) \
149 ((HDC) GDIOBJ_PtrToHandle((PGDIOBJ)pDC, GO_DC_MAGIC))
150 #define DC_HandleToPtr(hDC) \
151 ((PDC) GDIOBJ_HandleToPtr((HGDIOBJ)hDC, GO_DC_MAGIC))
152 #define DC_LockDC(hDC) GDIOBJ_LockObject((HGDIOBJ)hDC)
153 #define DC_UnlockDC(hDC) GDIOBJ_UnlockObject((HGDIOBJ)hDC)
154 PDC DC_AllocDC(LPCWSTR Driver);
155 void DC_InitDC(PDC DCToInit);
156 PDC DC_FindOpenDC(LPCWSTR Driver);
157 void DC_FreeDC(PDC DCToFree);
158 void DC_UpdateXforms(PDC dc);
159 BOOL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
160
161 /* User entry points */
162
163 BOOL STDCALL W32kCancelDC(HDC hDC);
164 HDC STDCALL W32kCreateCompatableDC(HDC hDC);
165 HDC STDCALL W32kCreateDC(LPCWSTR Driver,
166 LPCWSTR Device,
167 LPCWSTR Output,
168 CONST PDEVMODEW InitData);
169 HDC STDCALL W32kCreateIC(LPCWSTR Driver,
170 LPCWSTR Device,
171 LPCWSTR Output,
172 CONST PDEVMODEW DevMode);
173 BOOL STDCALL W32kDeleteDC(HDC hDC);
174 BOOL STDCALL W32kDeleteObject(HGDIOBJ hObject);
175 INT STDCALL W32kDrawEscape(HDC hDC,
176 INT nEscape,
177 INT cbInput,
178 LPCSTR lpszInData);
179
180 /* FIXME: this typedef should go somewhere else... */
181 typedef VOID (*GOBJENUMPROC)(PVOID, LPARAM);
182
183 INT STDCALL W32kEnumObjects(HDC hDC,
184 INT ObjectType,
185 GOBJENUMPROC ObjectFunc,
186 LPARAM lParam);
187
188 COLORREF STDCALL W32kGetBkColor(HDC hDC);
189 INT STDCALL W32kGetBkMode(HDC hDC);
190 BOOL STDCALL W32kGetBrushOrgEx(HDC hDC, LPPOINT brushOrg);
191 HRGN STDCALL W32kGetClipRgn(HDC hDC);
192 HGDIOBJ STDCALL W32kGetCurrentObject(HDC hDC, UINT ObjectType);
193 BOOL STDCALL W32kGetCurrentPositionEx(HDC hDC, LPPOINT currentPosition);
194 BOOL STDCALL W32kGetDCOrgEx(HDC hDC, LPPOINT Point);
195 HDC STDCALL W32kGetDCState16(HDC hDC);
196 INT STDCALL W32kGetDeviceCaps(HDC hDC, INT Index);
197 INT STDCALL W32kGetMapMode(HDC hDC);
198 INT STDCALL W32kGetObject(HGDIOBJ hGDIObj,
199 INT BufSize,
200 LPVOID Object);
201 DWORD STDCALL W32kGetObjectType(HGDIOBJ hGDIObj);
202 INT STDCALL W32kGetPolyFillMode(HDC hDC);
203 INT STDCALL W32kGetRelAbs(HDC hDC);
204 INT STDCALL W32kGetROP2(HDC hDC);
205 HGDIOBJ STDCALL W32kGetStockObject(INT Object);
206 INT STDCALL W32kGetStretchBltMode(HDC hDC);
207 COLORREF STDCALL W32kGetTextColor(HDC hDC);
208 UINT STDCALL W32kGetTextAlign(HDC hDC);
209 BOOL STDCALL W32kGetViewportExtEx(HDC hDC, LPSIZE viewportExt);
210 BOOL STDCALL W32kGetViewportOrgEx(HDC hDC, LPPOINT viewportOrg);
211 BOOL STDCALL W32kGetWindowExtEx(HDC hDC, LPSIZE windowExt);
212 BOOL STDCALL W32kGetWindowOrgEx(HDC hDC, LPPOINT windowOrg);
213 HDC STDCALL W32kResetDC(HDC hDC, CONST DEVMODE *InitData);
214 BOOL STDCALL W32kRestoreDC(HDC hDC, INT SavedDC);
215 INT STDCALL W32kSaveDC(HDC hDC);
216 HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ GDIObj);
217 INT STDCALL W32kSetBkMode(HDC hDC, INT backgroundMode);
218 INT STDCALL W32kSetPolyFillMode(HDC hDC, INT polyFillMode);
219 INT STDCALL W32kSetRelAbs(HDC hDC, INT relAbsMode);
220 INT STDCALL W32kSetROP2(HDC hDC, INT ROPmode);
221 INT STDCALL W32kSetStretchBltMode(HDC hDC, INT stretchBltMode);
222 COLORREF STDCALL W32kSetTextColor(HDC hDC, COLORREF color);
223
224 #endif
225