implemeted test for GdiConvertBitmap, GdiConvertBrush, GdiConvertDC, GdiConvertFont...
[reactos.git] / rostests / apitests / gdi32api / gdi.h
1 #ifndef _WIN32_WINNT
2 #define _WIN32_WINNT 0x0501
3 #endif
4
5 typedef struct _GDI_TABLE_ENTRY
6 {
7 PVOID KernelData; /* Points to the kernel mode structure */
8 HANDLE ProcessId; /* process id that created the object, 0 for stock objects */
9 LONG Type; /* the first 16 bit is the object type including the stock obj flag, the last 16 bits is just the object type */
10 PVOID UserData; /* Points to the user mode structure, usually NULL though */
11 } GDI_TABLE_ENTRY, *PGDI_TABLE_ENTRY;
12
13 typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
14
15 /* GDI handle table can hold 0x4000 handles */
16 #define GDI_HANDLE_COUNT 0x10000
17 #define GDI_GLOBAL_PROCESS (0x0)
18
19 /* Handle Masks and shifts */
20 #define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
21 #define GDI_HANDLE_TYPE_MASK 0x007f0000
22 #define GDI_HANDLE_STOCK_MASK 0x00800000
23 #define GDI_HANDLE_REUSE_MASK 0xff000000
24 #define GDI_HANDLE_REUSECNT_SHIFT 24
25 #define GDI_HANDLE_UPPER_MASK 0xffff0000
26
27 /* Handle macros */
28 #define GDI_HANDLE_CREATE(i, t) \
29 ((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) << 16)))
30
31 #define GDI_HANDLE_GET_INDEX(h) \
32 (((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK)
33
34 #define GDI_HANDLE_GET_TYPE(h) \
35 (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK)
36
37 #define GDI_HANDLE_IS_TYPE(h, t) \
38 ((t) == (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK))
39
40 #define GDI_HANDLE_IS_STOCKOBJ(h) \
41 (0 != (((ULONG_PTR)(h)) & GDI_HANDLE_STOCK_MASK))
42
43 #define GDI_HANDLE_SET_STOCKOBJ(h) \
44 ((h) = (HANDLE)(((ULONG_PTR)(h)) | GDI_HANDLE_STOCK_MASK))
45
46 #define GDI_HANDLE_GET_UPPER(h) \
47 (((ULONG_PTR)(h)) & GDI_HANDLE_UPPER_MASK)
48
49 #define GDI_OBJECT_TYPE_DC 0x00010000
50 #define GDI_OBJECT_TYPE_REGION 0x00040000
51 #define GDI_OBJECT_TYPE_BITMAP 0x00050000
52 #define GDI_OBJECT_TYPE_PALETTE 0x00080000
53 #define GDI_OBJECT_TYPE_FONT 0x000a0000
54 #define GDI_OBJECT_TYPE_BRUSH 0x00100000
55 #define GDI_OBJECT_TYPE_EMF 0x00210000
56 #define GDI_OBJECT_TYPE_PEN 0x00300000
57 #define GDI_OBJECT_TYPE_EXTPEN 0x00500000
58 #define GDI_OBJECT_TYPE_COLORSPACE 0x00090000
59 #define GDI_OBJECT_TYPE_METADC 0x00660000
60 #define GDI_OBJECT_TYPE_METAFILE 0x00260000
61 #define GDI_OBJECT_TYPE_ENHMETAFILE 0x00460000
62 /* Following object types made up for ROS */
63 #define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
64 #define GDI_OBJECT_TYPE_MEMDC 0x00750000
65 #define GDI_OBJECT_TYPE_DCE 0x00770000
66 #define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
67 /** Not really an object type. Forces GDI_FreeObj to be silent. */
68 #define GDI_OBJECT_TYPE_SILENT 0x80000000
69
70
71
72 /* Number Representation */
73
74 typedef LONG FIX;
75
76 typedef struct _EFLOAT_S
77 {
78 LONG lMant;
79 LONG lExp;
80 } EFLOAT_S;
81
82 /* XFORM Structures */
83 typedef struct _MATRIX_S
84 {
85 EFLOAT_S efM11;
86 EFLOAT_S efM12;
87 EFLOAT_S efM21;
88 EFLOAT_S efM22;
89 EFLOAT_S efDx;
90 EFLOAT_S efDy;
91 FIX fxDx;
92 FIX fxDy;
93 FLONG flAccel;
94 } MATRIX;
95
96 /* GDI object structures */
97
98 typedef struct _RGNATTR
99 {
100 ULONG AttrFlags;
101 ULONG Flags;
102 RECTL Rect;
103 } RGNATTR,*PRGNATTR;
104
105 // Local DC structure (_DC_ATTR) PVOID pvLDC;
106 typedef struct _LDC
107 {
108 HDC hDC;
109 ULONG Flags;
110 INT iType;
111 PVOID pvEmfDC; /* Pointer to ENHMETAFILE structure */
112 ABORTPROC pAbortProc; /* AbortProc for Printing */
113 HANDLE hPrinter; /* Local or Remote Printer driver */
114 INT iInitPage; /* Start/Stop */
115 INT iInitDocument;
116 } LDC, *PLDC;
117
118 typedef struct
119 {
120 void * pvLDC; // 000
121 ULONG ulDirty;
122 HBRUSH hbrush;
123 HPEN hpen;
124
125 COLORREF crBackgroundClr; // 010
126 ULONG ulBackgroundClr;
127 COLORREF crForegroundClr;
128 ULONG ulForegroundClr;
129
130 #if (_WIN32_WINNT >= 0x0500)
131 COLORREF crBrushClr; // 020
132 ULONG ulBrushClr;
133 COLORREF crPenClr;
134 ULONG ulPenClr;
135
136 #endif
137 int iCS_CP; // 030
138 int iGraphicsMode;
139 BYTE jROP2; // 038
140 BYTE jBkMode;
141 BYTE jFillMode;
142 BYTE jStretchBltMode;
143
144 POINT ptlCurrent; // 03C
145 POINTFX ptfxCurrent; // 044
146 long lBkMode; // 04C
147
148 long lFillMode; // 050
149 long lStretchBltMode;
150
151 #if (_WIN32_WINNT >= 0x0500)
152 long flFontMapper; // 058
153 long lIcmMode;
154 unsigned hcmXform; // 060
155 HCOLORSPACE hColorSpace;
156 FLONG flIcmFlags;
157 unsigned IcmBrushColor;
158 unsigned IcmPenColor; // 070
159 PVOID pvLIcm;
160 #endif
161
162 long flTextAlign; // 078
163 long lTextAlign;
164 long lTextExtra; // 080
165 long lRelAbs;
166 long lBreakExtra;
167 long cBreak;
168
169 HFONT hlfntNew; // 090
170 MATRIX mxWorldToDevice; // 094
171 MATRIX mxDeviceToWorld; // 0D0
172 MATRIX mxWorldToPage; // 10C
173
174 EFLOAT_S efM11PtoD;
175 EFLOAT_S efM22PtoD;
176 EFLOAT_S efDxPtoD;
177 EFLOAT_S efDyPtoD;
178
179 int iMapMode; // 168
180
181 #if (_WIN32_WINNT >= 0x0500)
182 DWORD dwLayout; // 16c
183 long lWindowOrgx; // 170
184 #endif
185 POINT ptlWindowOrg; // 174
186 SIZE szlWindowExt; // 17c
187 POINT ptlViewportOrg; // 184
188 SIZE szlViewportExt; // 18c
189
190 long flXform; // 194
191 SIZE szlVirtualDevicePixel; // 198
192 SIZE szlVirtualDeviceMm; // 1a0
193 POINT ptlBrushOrigin; // 1a8
194
195 unsigned unk1b0_00000000[2]; // 1b0
196 RGNATTR VisRectRegion;
197
198 // unsigned unk1b0_00000000[2]; // 1b0
199 // unsigned RectRegionFlag; // 1b4
200 // RECT VisRectRegion; // 1b8
201 } DC_ATTR, *PDC_ATTR;
202
203 HDC WINAPI GdiConvertBitmap(HDC hdc);
204 HBRUSH WINAPI GdiConvertBrush(HBRUSH hbr);
205 HDC WINAPI GdiConvertDC(HDC hdc);
206 HFONT WINAPI GdiConvertFont(HFONT hfont);
207 HPALETTE WINAPI GdiConvertPalette(HPALETTE hpal);
208 HRGN WINAPI GdiConvertRegion(HRGN hregion);
209 HBRUSH WINAPI GdiGetLocalBrush(HBRUSH hbr);
210 HDC WINAPI GdiGetLocalDC(HDC hdc);
211
212
213