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