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