ReactOS 0.4.15-dev-8222-g9164419
icm.c
Go to the documentation of this file.
1#include <precomp.h>
2
3#define NDEBUG
4#include <debug.h>
5
6
7HCOLORSPACE
10 LPLOGCOLORSPACEW lplcpw,
11 BOOL Ascii
12)
13{
14 LOGCOLORSPACEEXW lcpeexw;
15
16 if ((lplcpw->lcsSignature != LCS_SIGNATURE) ||
17 (lplcpw->lcsVersion != 0x400) ||
18 (lplcpw->lcsSize != sizeof(LOGCOLORSPACEW)))
19 {
21 return NULL;
22 }
23 RtlCopyMemory(&lcpeexw.lcsColorSpace, lplcpw, sizeof(LOGCOLORSPACEW));
24
25 return NtGdiCreateColorSpace(&lcpeexw);
26}
27
28/*
29 * @implemented
30 */
31HCOLORSPACE
34 LPLOGCOLORSPACEW lplcpw
35)
36{
37 return IntCreateColorSpaceW(lplcpw, FALSE);
38}
39
40
41/*
42 * @implemented
43 */
44HCOLORSPACE
47 LPLOGCOLORSPACEA lplcpa
48)
49{
50 LOGCOLORSPACEW lcpw;
51
52 if ((lplcpa->lcsSignature != LCS_SIGNATURE) ||
53 (lplcpa->lcsVersion != 0x400) ||
54 (lplcpa->lcsSize != sizeof(LOGCOLORSPACEA)))
55 {
57 return NULL;
58 }
59
60 lcpw.lcsSignature = lplcpa->lcsSignature;
61 lcpw.lcsVersion = lplcpa->lcsVersion;
62 lcpw.lcsSize = sizeof(LOGCOLORSPACEW);
63 lcpw.lcsCSType = lplcpa->lcsCSType;
64 lcpw.lcsIntent = lplcpa->lcsIntent;
65 lcpw.lcsEndpoints = lplcpa->lcsEndpoints;
66 lcpw.lcsGammaRed = lplcpa->lcsGammaRed;
67 lcpw.lcsGammaGreen = lplcpa->lcsGammaGreen;
68 lcpw.lcsGammaBlue = lplcpa->lcsGammaBlue;
69
72 NULL,
73 lplcpa->lcsFilename,
74 strlen(lplcpa->lcsFilename) + 1);
75
76 return IntCreateColorSpaceW(&lcpw, FALSE);
77}
78
79/*
80 * @implemented
81 */
82HCOLORSPACE
85{
86 PDC_ATTR pDc_Attr;
87
89 {
91 return NULL;
92 }
93 return pDc_Attr->hColorSpace;
94}
95
96
97/*
98 * @implemented
99 */
100HCOLORSPACE
101WINAPI
103 HDC hDC,
104 HCOLORSPACE hCS
105)
106{
107 HCOLORSPACE rhCS = GetColorSpace(hDC);
108
110 {
111 if (NtGdiSetColorSpace(hDC, hCS)) return rhCS;
112 }
113#if 0
115 {
116 PLDC pLDC = GdiGetLDC(hDC);
117 if ( !pLDC )
118 {
120 return NULL;
121 }
122 if (pLDC->iType == LDC_EMFLDC && !EMFDC_SetColorSpace( pLDC, hCS ))
123 {
124 return NULL;
125 }
126 }
127#endif
128 return NULL;
129}
130
131
132/*
133 * @unimplemented
134 */
135BOOL
136WINAPI
138 HDC hdc,
139 LPDWORD pBufSize,
140 LPSTR pszFilename
141)
142{
144 DWORD buflen = MAX_PATH;
145 BOOL ret = FALSE;
146
147 if (!hdc || !pBufSize) return FALSE;
148
149 if (GetICMProfileW(hdc, &buflen, filenameW))
150 {
152
153 if (!pszFilename)
154 {
155 *pBufSize = len;
156 return FALSE;
157 }
158
159 if (*pBufSize >= len)
160 {
161 WideCharToMultiByte(CP_ACP, 0, filenameW, -1, pszFilename, *pBufSize, NULL, NULL);
162 ret = TRUE;
163 }
165 *pBufSize = len;
166 }
167
168 return ret;
169}
170
171
172/*
173 * @unimplemented
174 */
175BOOL
176WINAPI
178 HDC hdc,
181)
182{
183 if (!hdc || !size || !filename) return FALSE;
184
187 return FALSE;
188}
189
190
191/*
192 * @unimplemented
193 */
194BOOL
195WINAPI
197 HDC a0,
198 LPSTR a1
199)
200{
203 return FALSE;
204}
205
206
207/*
208 * @unimplemented
209 */
210BOOL
211WINAPI
213 HDC a0,
214 LPWSTR a1
215)
216{
219 return FALSE;
220}
221
222
223/*
224 * @unimplemented
225 */
226int
227WINAPI
229 HDC a0,
231 LPARAM a2
232)
233{
234 /*
235 * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
236 * to find out how big a buffer we need. Then allocate that buffer
237 * and call NtGdiEnumICMProfiles again to have the buffer filled.
238 *
239 * Finally, step through the buffer ( MULTI-SZ recommended for format ),
240 * and convert each string to ANSI, calling the user's callback function
241 * until we run out of strings or the user returns FALSE
242 */
243
246 return 0;
247}
248
249
250/*
251 * @unimplemented
252 */
253int
254WINAPI
256 HDC hDC,
257 ICMENUMPROCW lpEnumICMProfilesFunc,
259)
260{
261 /*
262 * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
263 * to find out how big a buffer we need. Then allocate that buffer
264 * and call NtGdiEnumICMProfiles again to have the buffer filled.
265 *
266 * Finally, step through the buffer ( MULTI-SZ recommended for format ),
267 * and call the user's callback function until we run out of strings or
268 * the user returns FALSE
269 */
272 return 0;
273}
274
275
276/*
277 * @unimplemented
278 */
279BOOL
280WINAPI
282 DWORD a0,
283 LPSTR a1,
284 LPSTR a2,
285 UINT a3
286)
287{
290 return FALSE;
291}
292
293
294/*
295 * @unimplemented
296 */
297BOOL
298WINAPI
300 DWORD a0,
301 LPWSTR a1,
302 LPWSTR a2,
303 UINT a3
304)
305{
308 return FALSE;
309}
310
311/*
312 * @unimplemented
313 */
314int
315WINAPI
317 HDC hdc,
318 int iEnableICM
319)
320{
321 /*FIXME: Assume that ICM is always off, and cannot be turned on */
322 if (iEnableICM == ICM_OFF) return ICM_OFF;
323 if (iEnableICM == ICM_ON) return 0;
324 if (iEnableICM == ICM_QUERY) return ICM_OFF;
325
328 return 0;
329}
330
331/*
332 * @unimplemented
333 *
334 */
336WINAPI
338 HBITMAP in_format_BitMap,
339 HBITMAP src_BitMap,
340 INT bpp,
341 INT unuse)
342{
343 /* FIXME guessing the prototypes */
344
345 /*
346 * it have create a new bitmap with desired in format,
347 * then convert it src_bitmap to new format
348 * and return it as HBITMAP
349 */
350
351 return FALSE;
352}
static HDC hDC
Definition: 3dtext.c:33
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define UNIMPLEMENTED
Definition: debug.h:118
LPARAM lParam
Definition: combotst.c:139
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DWORD bpp
Definition: surface.c:185
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define WideCharToMultiByte
Definition: compat.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define LDC_EMFLDC
Definition: gdi_private.h:105
@ GDILoObjType_LO_METADC16_TYPE
Definition: gdi_private.h:49
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
const char * filename
Definition: ioapi.h:137
HDC hdc
Definition: main.c:9
static const WCHAR filenameW[]
Definition: amstream.c:41
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static const struct update_accum a1
Definition: msg.c:578
static const struct update_accum a2
Definition: msg.c:586
static const struct update_accum a3
Definition: msg.c:600
unsigned int UINT
Definition: ndis.h:50
_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeN(_Out_ PWCH UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH MbString, _In_ ULONG MbSize)
Definition: nlsboot.c:62
#define FASTCALL
Definition: nt_native.h:50
__kernel_entry W32KAPI BOOL APIENTRY NtGdiSetColorSpace(_In_ HDC hdc, _In_ HCOLORSPACE hColorSpace)
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiCreateColorSpace(_In_ PLOGCOLORSPACEEXW pLogColorSpace)
HCOLORSPACE hColorSpace
Definition: ntgdihdl.h:319
Definition: ntgdihdl.h:263
INT iType
Definition: ntgdihdl.h:266
LOGCOLORSPACEW lcsColorSpace
Definition: ntgdi.h:65
LCSGAMUTMATCH lcsIntent
Definition: wingdi.h:1769
CIEXYZTRIPLE lcsEndpoints
Definition: wingdi.h:1770
DWORD lcsGammaGreen
Definition: wingdi.h:1772
DWORD lcsVersion
Definition: wingdi.h:1766
CHAR lcsFilename[MAX_PATH]
Definition: wingdi.h:1774
LCSCSTYPE lcsCSType
Definition: wingdi.h:1768
DWORD lcsGammaRed
Definition: wingdi.h:1771
DWORD lcsGammaBlue
Definition: wingdi.h:1773
DWORD lcsSignature
Definition: wingdi.h:1765
LCSGAMUTMATCH lcsIntent
Definition: wingdi.h:1781
DWORD lcsGammaBlue
Definition: wingdi.h:1785
LCSCSTYPE lcsCSType
Definition: wingdi.h:1780
DWORD lcsSignature
Definition: wingdi.h:1777
DWORD lcsGammaGreen
Definition: wingdi.h:1784
WCHAR lcsFilename[MAX_PATH]
Definition: wingdi.h:1786
DWORD lcsGammaRed
Definition: wingdi.h:1783
CIEXYZTRIPLE lcsEndpoints
Definition: wingdi.h:1782
DWORD lcsVersion
Definition: wingdi.h:1778
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
int ret
HCOLORSPACE FASTCALL IntCreateColorSpaceW(LPLOGCOLORSPACEW lplcpw, BOOL Ascii)
Definition: icm.c:9
HCOLORSPACE WINAPI GetColorSpace(HDC hDC)
Definition: icm.c:84
HBITMAP WINAPI GdiConvertBitmapV5(HBITMAP in_format_BitMap, HBITMAP src_BitMap, INT bpp, INT unuse)
Definition: icm.c:337
BOOL WINAPI UpdateICMRegKeyW(DWORD a0, LPWSTR a1, LPWSTR a2, UINT a3)
Definition: icm.c:299
HCOLORSPACE WINAPI CreateColorSpaceA(LPLOGCOLORSPACEA lplcpa)
Definition: icm.c:46
HCOLORSPACE WINAPI SetColorSpace(HDC hDC, HCOLORSPACE hCS)
Definition: icm.c:102
BOOL WINAPI UpdateICMRegKeyA(DWORD a0, LPSTR a1, LPSTR a2, UINT a3)
Definition: icm.c:281
HCOLORSPACE WINAPI CreateColorSpaceW(LPLOGCOLORSPACEW lplcpw)
Definition: icm.c:33
LONG_PTR LPARAM
Definition: windef.h:208
#define WINAPI
Definition: msvc.h:6
#define ERROR_INVALID_COLORSPACE
Definition: winerror.h:1192
int WINAPI EnumICMProfilesW(_In_ HDC, _In_ ICMENUMPROCW, _In_opt_ LPARAM)
int WINAPI SetICMMode(_In_ HDC, _In_ int)
BOOL WINAPI GetICMProfileA(_In_ HDC hdc, _Inout_ LPDWORD pBufSize, _Out_writes_opt_(*pBufSize) LPSTR pszFilename)
BOOL WINAPI SetICMProfileW(_In_ HDC, _In_ LPWSTR)
int(CALLBACK * ICMENUMPROCW)(LPWSTR, LPARAM)
Definition: wingdi.h:2930
#define ICM_QUERY
Definition: wingdi.h:983
#define ICM_OFF
Definition: wingdi.h:982
#define ICM_ON
Definition: wingdi.h:981
BOOL WINAPI SetICMProfileA(_In_ HDC, _In_ LPSTR)
struct tagLOGCOLORSPACEW LOGCOLORSPACEW
int(CALLBACK * ICMENUMPROCA)(LPSTR, LPARAM)
Definition: wingdi.h:2929
BOOL WINAPI GetICMProfileW(_In_ HDC hdc, _Inout_ LPDWORD pBufSize, _Out_writes_opt_(*pBufSize) LPWSTR pszFilename)
#define LCS_SIGNATURE
Definition: wingdi.h:1104
int WINAPI EnumICMProfilesA(_In_ HDC, _In_ ICMENUMPROCA, _In_opt_ LPARAM)
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184