- Merge from trunk up to r45543
[reactos.git] / 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 {
47 PVOID pvMetaBuffer;
48 HANDLE hFile;
49 DWORD Size;
50 DWORD dwWritten;
51 METAHEADER mh;
52 WORD reserved;
53 HLOCAL MFObjList;
54 HPEN hPen;
55 HBRUSH hBrush;
56 HDC hDc;
57 HGDIOBJ hMetaDc;
58 HPALETTE hPalette;
59 HFONT hFont;
60 HBITMAP hBitmap;
61 HRGN hRegion;
62 HGDIOBJ hMetafile;
63 HGDIOBJ hMemDc;
64 HPEN hExtPen;
65 HGDIOBJ hEnhMetaDc;
66 HGDIOBJ hEnhMetaFile;
67 HCOLORSPACE hColorSpace;
68 WCHAR Filename[MAX_PATH+2];
69 } METAFILEDC,*PMETAFILEDC;
70
71 // Metafile Entry handle
72 typedef struct tagMF_ENTRY
73 {
74 LIST_ENTRY List;
75 HGDIOBJ hmDC; // Handle return from NtGdiCreateClientObj.
76 PMETAFILEDC pmfDC;
77 } MF_ENTRY, *PMF_ENTRY;
78
79 typedef struct tagENHMETAFILE
80 {
81 PVOID pvMetaBuffer;
82 HANDLE hFile; /* Handle for disk based MetaFile */
83 DWORD Size;
84 INT iType;
85 PENHMETAHEADER emf;
86 UINT handles_size, cur_handles;
87 HGDIOBJ *handles;
88 INT horzres, vertres;
89 INT horzsize, vertsize;
90 INT logpixelsx, logpixelsy;
91 INT bitspixel;
92 INT textcaps;
93 INT rastercaps;
94 INT technology;
95 INT planes;
96 } ENHMETAFILE,*PENHMETAFILE;
97
98
99 #define PDEV_UMPD_ID 0xFEDCBA98
100 // UMPDEV flags
101 #define UMPDEV_NO_ESCAPE 0x0002
102 #define UMPDEV_SUPPORT_ESCAPE 0x0004
103 typedef struct _UMPDEV
104 {
105 DWORD Sig; // Init with PDEV_UMPD_ID
106 struct _UMPDEV *pumpdNext;
107 PDRIVER_INFO_5W pdi5Info;
108 HMODULE hModule;
109 DWORD dwFlags;
110 DWORD dwDriverAttributes;
111 DWORD dwConfigVersion; // Number of times the configuration
112 // file for this driver has been upgraded
113 // or downgraded since the last spooler restart.
114 DWORD dwDriverCount; // After init should be 2
115 DWORD WOW64_UMPDev;
116 DWORD WOW64_hMod;
117 DWORD Unknown;
118 PVOID apfn[INDEX_LAST]; // Print Driver pfn
119 } UMPDEV, *PUMPDEV;
120
121 #define LOCALFONT_COUNT 10
122 typedef struct _LOCALFONT
123 {
124 FONT_ATTR lfa[LOCALFONT_COUNT];
125 } LOCALFONT, *PLOCALFONT;
126
127 // sdk/winspool.h
128 typedef BOOL (WINAPI *ABORTPRINTER) (HANDLE);
129 typedef BOOL (WINAPI *CLOSEPRINTER) (HANDLE);
130 typedef BOOL (WINAPI *CLOSESPOOLFILEHANDLE) (HANDLE, HANDLE); // W2k8
131 typedef HANDLE (WINAPI *COMMITSPOOLDATA) (HANDLE,HANDLE,DWORD); // W2k8
132 typedef LONG (WINAPI *DOCUMENTPROPERTIESW) (HWND,HANDLE,LPWSTR,PDEVMODEW,PDEVMODEW,DWORD);
133 typedef BOOL (WINAPI *ENDDOCPRINTER) (HANDLE);
134 typedef BOOL (WINAPI *ENDPAGEPRINTER) (HANDLE);
135 typedef BOOL (WINAPI *GETPRINTERW) (HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
136 typedef BOOL (WINAPI *GETPRINTERDRIVERW) (HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
137 typedef HANDLE (WINAPI *GETSPOOLFILEHANDLE) (HANDLE); // W2k8
138 typedef BOOL (WINAPI *ISVALIDDEVMODEW) (PDEVMODEW,size_t);
139 typedef BOOL (WINAPI *OPENPRINTERW) (LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW);
140 typedef BOOL (WINAPI *READPRINTER) (HANDLE,PVOID,DWORD,PDWORD);
141 typedef BOOL (WINAPI *RESETPRINTERW) (HANDLE,LPPRINTER_DEFAULTSW);
142 typedef LPWSTR (WINAPI *STARTDOCDLGW) (HANDLE,DOCINFOW *);
143 typedef DWORD (WINAPI *STARTDOCPRINTERW) (HANDLE,DWORD,PBYTE);
144 typedef BOOL (WINAPI *STARTPAGEPRINTER) (HANDLE);
145 // ddk/winsplp.h
146 typedef BOOL (WINAPI *SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
147 typedef BOOL (WINAPI *SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
148 // Same as ddk/winsplp.h DriverUnloadComplete?
149 typedef BOOL (WINAPI *SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
150 // Driver support:
151 // DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
152 typedef INT (WINAPI *DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
153 // DrvQueryColorProfile
154 typedef BOOL (WINAPI *QUERYCOLORPROFILE) (HANDLE,PDEVMODEW,ULONG,VOID*,ULONG,FLONG);
155 // Unknown:
156 typedef DWORD (WINAPI *QUERYSPOOLMODE) (HANDLE,DWORD,DWORD);
157 typedef DWORD (WINAPI *QUERYREMOTEFONTS) (DWORD,DWORD,DWORD);
158
159 extern CLOSEPRINTER fpClosePrinter;
160 extern OPENPRINTERW fpOpenPrinterW;
161
162 /* FUNCTIONS *****************************************************************/
163
164 PVOID
165 HEAP_alloc(DWORD len);
166
167 NTSTATUS
168 HEAP_strdupA2W(
169 LPWSTR* ppszW,
170 LPCSTR lpszA
171 );
172
173 VOID
174 HEAP_free(LPVOID memory);
175
176 VOID
177 FASTCALL
178 FONT_TextMetricWToA(
179 const TEXTMETRICW *ptmW,
180 LPTEXTMETRICA ptmA
181 );
182
183 VOID
184 FASTCALL
185 NewTextMetricW2A(
186 NEWTEXTMETRICA *tma,
187 NEWTEXTMETRICW *tmw
188 );
189
190 VOID
191 FASTCALL
192 NewTextMetricExW2A(
193 NEWTEXTMETRICEXA *tma,
194 NEWTEXTMETRICEXW *tmw
195 );
196
197 BOOL
198 FASTCALL
199 DeleteRegion( HRGN );
200
201 BOOL
202 GdiIsHandleValid(HGDIOBJ hGdiObj);
203
204 BOOL
205 GdiGetHandleUserData(
206 HGDIOBJ hGdiObj,
207 DWORD ObjectType,
208 PVOID *UserData
209 );
210
211 PLDC
212 FASTCALL
213 GdiGetLDC(HDC hDC);
214
215 HGDIOBJ
216 WINAPI
217 GdiFixUpHandle(HGDIOBJ hGO);
218
219 BOOL
220 WINAPI
221 CalculateColorTableSize(
222 CONST BITMAPINFOHEADER *BitmapInfoHeader,
223 UINT *ColorSpec,
224 UINT *ColorTableSize
225 );
226
227 LPBITMAPINFO
228 WINAPI
229 ConvertBitmapInfo(
230 CONST BITMAPINFO *BitmapInfo,
231 UINT ColorSpec,
232 UINT *BitmapInfoSize,
233 BOOL FollowedByData
234 );
235
236 DEVMODEW *
237 NTAPI
238 GdiConvertToDevmodeW(DEVMODEA *dm);
239
240 DWORD
241 WINAPI
242 GetAndSetDCDWord( HDC, INT, DWORD, DWORD, DWORD, DWORD );
243
244 DWORD
245 WINAPI
246 GetDCDWord( HDC, INT, DWORD);
247
248 HGDIOBJ
249 WINAPI
250 GetDCObject( HDC, INT);
251
252 VOID
253 NTAPI
254 LogFontA2W(
255 LPLOGFONTW pW,
256 CONST LOGFONTA *pA
257 );
258
259 VOID
260 NTAPI
261 LogFontW2A(
262 LPLOGFONTA pA,
263 CONST LOGFONTW *pW
264 );
265
266 VOID
267 WINAPI
268 EnumLogFontExW2A(
269 LPENUMLOGFONTEXA fontA,
270 CONST ENUMLOGFONTEXW *fontW );
271
272 /* FIXME: Put in some public header */
273 UINT
274 WINAPI
275 UserRealizePalette(HDC hDC);
276
277 int
278 WINAPI
279 GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv);
280
281 VOID
282 WINAPI
283 GdiSetLastError( DWORD dwErrCode );
284
285 DWORD WINAPI GdiGetCodePage(HDC);
286 UINT FASTCALL DIB_BitmapBitsSize( PBITMAPINFO );
287
288 int
289 WINAPI
290 GdiGetBitmapBitsSize(BITMAPINFO *lpbmi);
291
292 VOID GdiSAPCallback(PLDC pldc);
293 HGDIOBJ FASTCALL hGetPEBHandle(HANDLECACHETYPE,COLORREF);
294
295 int FASTCALL DocumentEventEx(PVOID,HANDLE,HDC,int,ULONG,PVOID,ULONG,PVOID);
296 BOOL FASTCALL EndPagePrinterEx(PVOID,HANDLE);
297 BOOL FASTCALL LoadTheSpoolerDrv(VOID);
298
299 /* EOF */