9b14a355cc462bf734016898320a2ccc484d59c4
[reactos.git] / reactos / dll / win32 / gdi32 / include / gdi32p.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS System Libraries
4 * FILE: lib/gdi32/include/gdi32p.h
5 * PURPOSE: User-Mode Win32 GDI Library Private Header
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9
10 /* DATA **********************************************************************/
11
12 extern PGDI_TABLE_ENTRY GdiHandleTable;
13 extern PGDI_SHARED_HANDLE_TABLE GdiSharedHandleTable;
14 extern HANDLE hProcessHeap;
15 extern HANDLE CurrentProcessId;
16 extern DWORD GDI_BatchLimit;
17 extern PDEVCAPS GdiDevCaps;
18 extern BOOL gbLpk; // Global bool LanguagePack
19 extern HANDLE ghSpooler;
20 extern RTL_CRITICAL_SECTION semLocal;
21
22 typedef INT
23 (CALLBACK* EMFPLAYPROC)(
24 HDC hdc,
25 INT iFunction,
26 HANDLE hPageQuery
27 );
28
29 /* DEFINES *******************************************************************/
30
31 #define HANDLE_LIST_INC 20
32
33 #define METAFILE_MEMORY 1
34 #define METAFILE_DISK 2
35
36 #define SAPCALLBACKDELAY 244
37
38 /* MACRO ********************************************************************/
39
40 #define ROP_USES_SOURCE(Rop) (((Rop) << 2 ^ Rop) & 0xCC0000)
41
42 /* TYPES *********************************************************************/
43
44 // Based on wmfapi.h and Wine.
45 typedef struct tagMETAFILEDC {
46 PVOID pvMetaBuffer;
47 HANDLE hFile;
48 DWORD Size;
49 METAHEADER mh;
50 UINT handles_size, cur_handles;
51 HGDIOBJ *handles;
52
53 // more DC object stuff.
54 HGDIOBJ Pen;
55 HGDIOBJ Brush;
56 HGDIOBJ Palette;
57 HGDIOBJ Font;
58
59 WCHAR Filename[MAX_PATH+2];
60 // Add more later.
61 } METAFILEDC,*PMETAFILEDC;
62
63 // Metafile Entry handle
64 typedef struct tagMF_ENTRY {
65 LIST_ENTRY List;
66 HGDIOBJ hmDC; // Handle return from NtGdiCreateClientObj.
67 PMETAFILEDC pmfDC;
68 } MF_ENTRY, *PMF_ENTRY;
69
70 typedef struct tagENHMETAFILE {
71 PVOID pvMetaBuffer;
72 HANDLE hFile; /* Handle for disk based MetaFile */
73 DWORD Size;
74 INT iType;
75 PENHMETAHEADER emf;
76 UINT handles_size, cur_handles;
77 HGDIOBJ *handles;
78 INT horzres, vertres;
79 INT horzsize, vertsize;
80 INT logpixelsx, logpixelsy;
81 INT bitspixel;
82 INT textcaps;
83 INT rastercaps;
84 INT technology;
85 INT planes;
86 } ENHMETAFILE,*PENHMETAFILE;
87
88
89 #define PDEV_UMPD_ID 0xFEDCBA98
90 // UMPDEV flags
91 #define UMPDEV_NO_ESCAPE 0x0002
92 #define UMPDEV_SUPPORT_ESCAPE 0x0004
93 typedef struct _UMPDEV
94 {
95 DWORD Sig; // Init with PDEV_UMPD_ID
96 struct _UMPDEV *pumpdNext;
97 PDRIVER_INFO_5W pdi5Info;
98 HMODULE hModule;
99 DWORD dwFlags;
100 DWORD dwDriverAttributes;
101 DWORD dwConfigVersion; // Number of times the configuration
102 // file for this driver has been upgraded
103 // or downgraded since the last spooler restart.
104 DWORD dwDriverCount; // After init should be 2
105 DWORD WOW64_UMPDev;
106 DWORD WOW64_hMod;
107 DWORD Unknown;
108 PVOID apfn[INDEX_LAST]; // Print Driver pfn
109 } UMPDEV, *PUMPDEV;
110
111 #define LOCALFONT_COUNT 10
112 typedef struct _LOCALFONT
113 {
114 FONT_ATTR lfa[LOCALFONT_COUNT];
115 } LOCALFONT, *PLOCALFONT;
116
117 // sdk/winspool.h
118 typedef BOOL (WINAPI *ABORTPRINTER) (HANDLE);
119 typedef BOOL (WINAPI *CLOSEPRINTER) (HANDLE);
120 typedef BOOL (WINAPI *CLOSESPOOLFILEHANDLE) (HANDLE, HANDLE); // W2k8
121 typedef HANDLE (WINAPI *COMMITSPOOLDATA) (HANDLE,HANDLE,DWORD); // W2k8
122 typedef LONG (WINAPI *DOCUMENTPROPERTIESW) (HWND,HANDLE,LPWSTR,PDEVMODEW,PDEVMODEW,DWORD);
123 typedef BOOL (WINAPI *ENDDOCPRINTER) (HANDLE);
124 typedef BOOL (WINAPI *ENDPAGEPRINTER) (HANDLE);
125 typedef BOOL (WINAPI *GETPRINTERW) (HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
126 typedef BOOL (WINAPI *GETPRINTERDRIVERW) (HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
127 typedef HANDLE (WINAPI *GETSPOOLFILEHANDLE) (HANDLE); // W2k8
128 typedef BOOL (WINAPI *ISVALIDDEVMODEW) (PDEVMODEW,size_t);
129 typedef BOOL (WINAPI *OPENPRINTERW) (LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW);
130 typedef BOOL (WINAPI *READPRINTER) (HANDLE,PVOID,DWORD,PDWORD);
131 typedef BOOL (WINAPI *RESETPRINTERW) (HANDLE,LPPRINTER_DEFAULTSW);
132 typedef LPWSTR (WINAPI *STARTDOCDLGW) (HANDLE,DOCINFOW *);
133 typedef DWORD (WINAPI *STARTDOCPRINTERW) (HANDLE,DWORD,PBYTE);
134 typedef BOOL (WINAPI *STARTPAGEPRINTER) (HANDLE);
135 // ddk/winsplp.h
136 typedef BOOL (WINAPI *SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
137 typedef BOOL (WINAPI *SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
138 // Same as ddk/winsplp.h DriverUnloadComplete?
139 typedef BOOL (WINAPI *SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
140 // Driver support:
141 // DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
142 typedef INT (WINAPI *DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
143 // DrvQueryColorProfile
144 typedef BOOL (WINAPI *QUERYCOLORPROFILE) (HANDLE,PDEVMODEW,ULONG,VOID*,ULONG,FLONG);
145 // Unknown:
146 typedef DWORD (WINAPI *QUERYSPOOLMODE) (HANDLE,DWORD,DWORD);
147 typedef DWORD (WINAPI *QUERYREMOTEFONTS) (DWORD,DWORD,DWORD);
148
149 extern CLOSEPRINTER fpClosePrinter;
150
151 /* FUNCTIONS *****************************************************************/
152
153 PVOID
154 HEAP_alloc(DWORD len);
155
156 NTSTATUS
157 HEAP_strdupA2W(
158 LPWSTR* ppszW,
159 LPCSTR lpszA
160 );
161
162 VOID
163 HEAP_free(LPVOID memory);
164
165 BOOL
166 FASTCALL
167 TextMetricW2A(
168 TEXTMETRICA *tma,
169 TEXTMETRICW *tmw
170 );
171
172 BOOL
173 FASTCALL
174 NewTextMetricW2A(
175 NEWTEXTMETRICA *tma,
176 NEWTEXTMETRICW *tmw
177 );
178
179 BOOL
180 FASTCALL
181 NewTextMetricExW2A(
182 NEWTEXTMETRICEXA *tma,
183 NEWTEXTMETRICEXW *tmw
184 );
185
186 BOOL
187 FASTCALL
188 DeleteRegion( HRGN );
189
190 BOOL
191 GdiIsHandleValid(HGDIOBJ hGdiObj);
192
193 BOOL
194 GdiGetHandleUserData(
195 HGDIOBJ hGdiObj,
196 DWORD ObjectType,
197 PVOID *UserData
198 );
199
200 PLDC
201 FASTCALL
202 GdiGetLDC(HDC hDC);
203
204 HGDIOBJ
205 WINAPI
206 GdiFixUpHandle(HGDIOBJ hGO);
207
208 BOOL
209 WINAPI
210 CalculateColorTableSize(
211 CONST BITMAPINFOHEADER *BitmapInfoHeader,
212 UINT *ColorSpec,
213 UINT *ColorTableSize
214 );
215
216 LPBITMAPINFO
217 WINAPI
218 ConvertBitmapInfo(
219 CONST BITMAPINFO *BitmapInfo,
220 UINT ColorSpec,
221 UINT *BitmapInfoSize,
222 BOOL FollowedByData
223 );
224
225 DEVMODEW *
226 NTAPI
227 GdiConvertToDevmodeW(DEVMODEA *dm);
228
229 DWORD
230 WINAPI
231 GetAndSetDCDWord( HDC, INT, DWORD, DWORD, DWORD, DWORD );
232
233 DWORD
234 WINAPI
235 GetDCDWord( HDC, INT, DWORD);
236
237 HGDIOBJ
238 WINAPI
239 GetDCObject( HDC, INT);
240
241 VOID
242 NTAPI
243 LogFontA2W(
244 LPLOGFONTW pW,
245 CONST LOGFONTA *pA
246 );
247
248 VOID
249 NTAPI
250 LogFontW2A(
251 LPLOGFONTA pA,
252 CONST LOGFONTW *pW
253 );
254
255 VOID
256 WINAPI
257 EnumLogFontExW2A(
258 LPENUMLOGFONTEXA fontA,
259 CONST ENUMLOGFONTEXW *fontW );
260
261 /* FIXME: Put in some public header */
262 UINT
263 WINAPI
264 UserRealizePalette(HDC hDC);
265
266 int
267 WINAPI
268 GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv);
269
270 VOID
271 WINAPI
272 GdiSetLastError( DWORD dwErrCode );
273
274 DWORD WINAPI GdiGetCodePage(HDC);
275 UINT FASTCALL DIB_BitmapBitsSize( PBITMAPINFO );
276
277 int
278 WINAPI
279 GdiGetBitmapBitsSize(BITMAPINFO *lpbmi);
280
281 VOID GdiSAPCallback(PLDC pldc);
282
283 int FASTCALL DocumentEventEx(PVOID,HANDLE,HDC,int,ULONG,PVOID,ULONG,PVOID);
284 BOOL FASTCALL EndPagePrinterEx(PVOID,HANDLE);
285 BOOL FASTCALL LoadTheSpoolerDrv(VOID);
286
287 /* EOF */