ReactOS  0.4.14-dev-376-gaedba84
icm.c
Go to the documentation of this file.
1 #include <precomp.h>
2 
3 #define NDEBUG
4 #include <debug.h>
5 
6 
7 HCOLORSPACE
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  */
31 HCOLORSPACE
32 WINAPI
34  LPLOGCOLORSPACEW lplcpw
35 )
36 {
37  return IntCreateColorSpaceW(lplcpw, FALSE);
38 }
39 
40 
41 /*
42  * @implemented
43  */
44 HCOLORSPACE
45 WINAPI
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 
71  MAX_PATH,
72  NULL,
73  lplcpa->lcsFilename,
74  strlen(lplcpa->lcsFilename) + 1);
75 
76  return IntCreateColorSpaceW(&lcpw, FALSE);
77 }
78 
79 /*
80  * @implemented
81  */
82 HCOLORSPACE
83 WINAPI
85 {
86  PDC_ATTR pDc_Attr;
87 
89  {
91  return NULL;
92  }
93  return pDc_Attr->hColorSpace;
94 }
95 
96 
97 /*
98  * @implemented
99  */
100 HCOLORSPACE
101 WINAPI
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)
123  {
124  return NULL;
125  }
126  }
127 #endif
128  return NULL;
129 }
130 
131 
132 /*
133  * @unimplemented
134  */
135 BOOL
136 WINAPI
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  */
175 BOOL
176 WINAPI
178  HDC hdc,
179  LPDWORD size,
181 )
182 {
183  if (!hdc || !size || !filename) return FALSE;
184 
187  return FALSE;
188 }
189 
190 
191 /*
192  * @unimplemented
193  */
194 BOOL
195 WINAPI
197  HDC a0,
198  LPSTR a1
199 )
200 {
203  return FALSE;
204 }
205 
206 
207 /*
208  * @unimplemented
209  */
210 BOOL
211 WINAPI
213  HDC a0,
214  LPWSTR a1
215 )
216 {
219  return FALSE;
220 }
221 
222 
223 /*
224  * @unimplemented
225  */
226 int
227 WINAPI
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  */
253 int
254 WINAPI
256  HDC hDC,
257  ICMENUMPROCW lpEnumICMProfilesFunc,
258  LPARAM lParam
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  */
279 BOOL
280 WINAPI
282  DWORD a0,
283  LPSTR a1,
284  LPSTR a2,
285  UINT a3
286 )
287 {
290  return FALSE;
291 }
292 
293 
294 /*
295  * @unimplemented
296  */
297 BOOL
298 WINAPI
300  DWORD a0,
301  LPWSTR a1,
302  LPWSTR a2,
303  UINT a3
304 )
305 {
308  return FALSE;
309 }
310 
311 /*
312  * @unimplemented
313  */
314 int
315 WINAPI
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 }
LCSCSTYPE lcsCSType
Definition: wingdi.h:1775
DWORD lcsSignature
Definition: wingdi.h:1760
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static const struct update_accum a3
Definition: msg.c:600
LCSCSTYPE lcsCSType
Definition: wingdi.h:1763
DWORD lcsGammaRed
Definition: wingdi.h:1766
#define WideCharToMultiByte
Definition: compat.h:101
int WINAPI EnumICMProfilesW(HDC hDC, ICMENUMPROCW lpEnumICMProfilesFunc, LPARAM lParam)
Definition: icm.c:255
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
#define CP_ACP
Definition: compat.h:99
DWORD lcsGammaGreen
Definition: wingdi.h:1779
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD lcsGammaGreen
Definition: wingdi.h:1767
static HDC
Definition: imagelist.c:92
int WINAPI SetICMMode(HDC hdc, int iEnableICM)
Definition: icm.c:316
BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
Definition: icm.c:177
BOOL WINAPI SetICMProfileA(HDC a0, LPSTR a1)
Definition: icm.c:196
BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD pBufSize, LPSTR pszFilename)
Definition: icm.c:137
HCOLORSPACE WINAPI CreateColorSpaceA(LPLOGCOLORSPACEA lplcpa)
Definition: icm.c:46
char * LPSTR
Definition: xmlstorage.h:182
const char * filename
Definition: ioapi.h:135
#define FASTCALL
Definition: nt_native.h:50
HCOLORSPACE WINAPI SetColorSpace(HDC hDC, HCOLORSPACE hCS)
Definition: icm.c:102
static const WCHAR filenameW[]
Definition: amstream.c:41
#define ICM_QUERY
Definition: wingdi.h:982
WCHAR lcsFilename[MAX_PATH]
Definition: wingdi.h:1781
unsigned int BOOL
Definition: ntddk_ex.h:94
HCOLORSPACE WINAPI GetColorSpace(HDC hDC)
Definition: icm.c:84
LOGCOLORSPACEW lcsColorSpace
Definition: ntgdi.h:65
smooth NULL
Definition: ftsmooth.c:416
HCOLORSPACE WINAPI CreateColorSpaceW(LPLOGCOLORSPACEW lplcpw)
Definition: icm.c:33
#define ERROR_INVALID_COLORSPACE
Definition: winerror.h:1192
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI SetICMProfileW(HDC a0, LPWSTR a1)
Definition: icm.c:212
CIEXYZTRIPLE lcsEndpoints
Definition: wingdi.h:1765
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
CHAR lcsFilename[MAX_PATH]
Definition: wingdi.h:1769
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const struct update_accum a2
Definition: msg.c:586
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI UpdateICMRegKeyA(DWORD a0, LPSTR a1, LPSTR a2, UINT a3)
Definition: icm.c:281
#define SetLastError(x)
Definition: compat.h:417
HANDLE APIENTRY NtGdiCreateColorSpace(IN PLOGCOLORSPACEEXW pLogColorSpace)
Definition: icm.c:56
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
DWORD lcsVersion
Definition: wingdi.h:1773
struct tagLOGCOLORSPACEW LOGCOLORSPACEW
Definition: ntgdihdl.h:275
INT iType
Definition: ntgdihdl.h:279
int ret
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
HDC hdc
Definition: main.c:9
HCOLORSPACE FASTCALL IntCreateColorSpaceW(LPLOGCOLORSPACEW lplcpw, BOOL Ascii)
Definition: icm.c:9
#define ICM_OFF
Definition: wingdi.h:981
#define ICM_ON
Definition: wingdi.h:980
GLenum GLsizei len
Definition: glext.h:6722
BOOL APIENTRY NtGdiSetColorSpace(IN HDC hdc, IN HCOLORSPACE hColorSpace)
Definition: icm.c:184
#define LCS_SIGNATURE
Definition: wingdi.h:1103
static HDC hDC
Definition: 3dtext.c:33
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68
BOOL WINAPI UpdateICMRegKeyW(DWORD a0, LPWSTR a1, LPWSTR a2, UINT a3)
Definition: icm.c:299
LCSGAMUTMATCH lcsIntent
Definition: wingdi.h:1764
LCSGAMUTMATCH lcsIntent
Definition: wingdi.h:1776
unsigned int UINT
Definition: ndis.h:50
CIEXYZTRIPLE lcsEndpoints
Definition: wingdi.h:1777
int(CALLBACK * ICMENUMPROCW)(LPWSTR, LPARAM)
Definition: wingdi.h:2925
uint32_t * LPDWORD
Definition: typedefs.h:57
DWORD lcsGammaBlue
Definition: wingdi.h:1780
unsigned int ULONG
Definition: retypes.h:1
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114
static const struct update_accum a1
Definition: msg.c:578
DWORD lcsGammaBlue
Definition: wingdi.h:1768
DWORD lcsGammaRed
Definition: wingdi.h:1778
WCHAR * LPWSTR
Definition: xmlstorage.h:184
DWORD lcsSignature
Definition: wingdi.h:1772
LPARAM lParam
Definition: combotst.c:139
int(CALLBACK * ICMENUMPROCA)(LPSTR, LPARAM)
Definition: wingdi.h:2924
DWORD lcsVersion
Definition: wingdi.h:1761
int WINAPI EnumICMProfilesA(HDC a0, ICMENUMPROCA a1, LPARAM a2)
Definition: icm.c:228
#define LDC_EMFLDC
Definition: gdi_private.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10