ReactOS  0.4.14-dev-599-g2d4d3f5
icm.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for icm.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

HCOLORSPACE FASTCALL IntCreateColorSpaceW (LPLOGCOLORSPACEW lplcpw, BOOL Ascii)
 
HCOLORSPACE WINAPI CreateColorSpaceW (LPLOGCOLORSPACEW lplcpw)
 
HCOLORSPACE WINAPI CreateColorSpaceA (LPLOGCOLORSPACEA lplcpa)
 
HCOLORSPACE WINAPI GetColorSpace (HDC hDC)
 
HCOLORSPACE WINAPI SetColorSpace (HDC hDC, HCOLORSPACE hCS)
 
BOOL WINAPI GetICMProfileA (HDC hdc, LPDWORD pBufSize, LPSTR pszFilename)
 
BOOL WINAPI GetICMProfileW (HDC hdc, LPDWORD size, LPWSTR filename)
 
BOOL WINAPI SetICMProfileA (HDC a0, LPSTR a1)
 
BOOL WINAPI SetICMProfileW (HDC a0, LPWSTR a1)
 
int WINAPI EnumICMProfilesA (HDC a0, ICMENUMPROCA a1, LPARAM a2)
 
int WINAPI EnumICMProfilesW (HDC hDC, ICMENUMPROCW lpEnumICMProfilesFunc, LPARAM lParam)
 
BOOL WINAPI UpdateICMRegKeyA (DWORD a0, LPSTR a1, LPSTR a2, UINT a3)
 
BOOL WINAPI UpdateICMRegKeyW (DWORD a0, LPWSTR a1, LPWSTR a2, UINT a3)
 
int WINAPI SetICMMode (HDC hdc, int iEnableICM)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 3 of file icm.c.

Function Documentation

◆ CreateColorSpaceA()

HCOLORSPACE WINAPI CreateColorSpaceA ( LPLOGCOLORSPACEA  lplcpa)

Definition at line 46 of file icm.c.

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 }
LCSCSTYPE lcsCSType
Definition: wingdi.h:1779
DWORD lcsSignature
Definition: wingdi.h:1764
LCSCSTYPE lcsCSType
Definition: wingdi.h:1767
DWORD lcsGammaRed
Definition: wingdi.h:1770
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
DWORD lcsGammaGreen
Definition: wingdi.h:1783
DWORD lcsGammaGreen
Definition: wingdi.h:1771
WCHAR lcsFilename[MAX_PATH]
Definition: wingdi.h:1785
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_INVALID_COLORSPACE
Definition: winerror.h:1192
CIEXYZTRIPLE lcsEndpoints
Definition: wingdi.h:1769
CHAR lcsFilename[MAX_PATH]
Definition: wingdi.h:1773
#define MAX_PATH
Definition: compat.h:26
#define SetLastError(x)
Definition: compat.h:417
DWORD lcsVersion
Definition: wingdi.h:1777
struct tagLOGCOLORSPACEW LOGCOLORSPACEW
HCOLORSPACE FASTCALL IntCreateColorSpaceW(LPLOGCOLORSPACEW lplcpw, BOOL Ascii)
Definition: icm.c:9
#define LCS_SIGNATURE
Definition: wingdi.h:1103
LCSGAMUTMATCH lcsIntent
Definition: wingdi.h:1768
LCSGAMUTMATCH lcsIntent
Definition: wingdi.h:1780
CIEXYZTRIPLE lcsEndpoints
Definition: wingdi.h:1781
DWORD lcsGammaBlue
Definition: wingdi.h:1784
DWORD lcsGammaBlue
Definition: wingdi.h:1772
DWORD lcsGammaRed
Definition: wingdi.h:1782
DWORD lcsSignature
Definition: wingdi.h:1776
DWORD lcsVersion
Definition: wingdi.h:1765

◆ CreateColorSpaceW()

HCOLORSPACE WINAPI CreateColorSpaceW ( LPLOGCOLORSPACEW  lplcpw)

Definition at line 33 of file icm.c.

36 {
37  return IntCreateColorSpaceW(lplcpw, FALSE);
38 }
HCOLORSPACE FASTCALL IntCreateColorSpaceW(LPLOGCOLORSPACEW lplcpw, BOOL Ascii)
Definition: icm.c:9

◆ EnumICMProfilesA()

int WINAPI EnumICMProfilesA ( HDC  a0,
ICMENUMPROCA  a1,
LPARAM  a2 
)

Definition at line 228 of file icm.c.

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 }
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by test_EnumICMProfilesA().

◆ EnumICMProfilesW()

int WINAPI EnumICMProfilesW ( HDC  hDC,
ICMENUMPROCW  lpEnumICMProfilesFunc,
LPARAM  lParam 
)

Definition at line 255 of file icm.c.

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 }
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by test_EnumICMProfilesW().

◆ GetColorSpace()

HCOLORSPACE WINAPI GetColorSpace ( HDC  hDC)

Definition at line 84 of file icm.c.

85 {
86  PDC_ATTR pDc_Attr;
87 
89  {
91  return NULL;
92  }
93  return pDc_Attr->hColorSpace;
94 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:417
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
static HDC hDC
Definition: 3dtext.c:33
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68

Referenced by SetColorSpace().

◆ GetICMProfileA()

BOOL WINAPI GetICMProfileA ( HDC  hdc,
LPDWORD  pBufSize,
LPSTR  pszFilename 
)

Definition at line 137 of file icm.c.

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 }
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
Definition: icm.c:177
static const WCHAR filenameW[]
Definition: amstream.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
HDC hdc
Definition: main.c:9
GLenum GLsizei len
Definition: glext.h:6722
unsigned int ULONG
Definition: retypes.h:1
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by test_GetICMProfileA(), test_SetICMMode(), and test_SetICMProfileA().

◆ GetICMProfileW()

BOOL WINAPI GetICMProfileW ( HDC  hdc,
LPDWORD  size,
LPWSTR  filename 
)

Definition at line 177 of file icm.c.

182 {
183  if (!hdc || !size || !filename) return FALSE;
184 
187  return FALSE;
188 }
const char * filename
Definition: ioapi.h:135
GLsizeiptr size
Definition: glext.h:5919
#define SetLastError(x)
Definition: compat.h:417
HDC hdc
Definition: main.c:9
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by GetICMProfileA(), test_GetICMProfileW(), and test_SetICMProfileW().

◆ IntCreateColorSpaceW()

HCOLORSPACE FASTCALL IntCreateColorSpaceW ( LPLOGCOLORSPACEW  lplcpw,
BOOL  Ascii 
)

Definition at line 9 of file icm.c.

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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LOGCOLORSPACEW lcsColorSpace
Definition: ntgdi.h:65
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_INVALID_COLORSPACE
Definition: winerror.h:1192
#define SetLastError(x)
Definition: compat.h:417
HANDLE APIENTRY NtGdiCreateColorSpace(IN PLOGCOLORSPACEEXW pLogColorSpace)
Definition: icm.c:56
DWORD lcsVersion
Definition: wingdi.h:1777
#define LCS_SIGNATURE
Definition: wingdi.h:1103
DWORD lcsSignature
Definition: wingdi.h:1776

Referenced by CreateColorSpaceA(), and CreateColorSpaceW().

◆ SetColorSpace()

HCOLORSPACE WINAPI SetColorSpace ( HDC  hDC,
HCOLORSPACE  hCS 
)

Definition at line 102 of file icm.c.

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 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HCOLORSPACE WINAPI GetColorSpace(HDC hDC)
Definition: icm.c:84
smooth NULL
Definition: ftsmooth.c:416
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define SetLastError(x)
Definition: compat.h:417
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
Definition: ntgdihdl.h:275
INT iType
Definition: ntgdihdl.h:279
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
BOOL APIENTRY NtGdiSetColorSpace(IN HDC hdc, IN HCOLORSPACE hColorSpace)
Definition: icm.c:184
static HDC hDC
Definition: 3dtext.c:33
#define LDC_EMFLDC
Definition: gdi_private.h:57

◆ SetICMMode()

int WINAPI SetICMMode ( HDC  hdc,
int  iEnableICM 
)

Definition at line 316 of file icm.c.

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 }
#define ICM_QUERY
Definition: wingdi.h:982
#define SetLastError(x)
Definition: compat.h:417
#define ICM_OFF
Definition: wingdi.h:981
#define ICM_ON
Definition: wingdi.h:980
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by test_SetICMMode().

◆ SetICMProfileA()

BOOL WINAPI SetICMProfileA ( HDC  a0,
LPSTR  a1 
)

Definition at line 196 of file icm.c.

200 {
203  return FALSE;
204 }
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by test_SetICMProfileA().

◆ SetICMProfileW()

BOOL WINAPI SetICMProfileW ( HDC  a0,
LPWSTR  a1 
)

Definition at line 212 of file icm.c.

216 {
219  return FALSE;
220 }
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by test_SetICMProfileW().

◆ UpdateICMRegKeyA()

BOOL WINAPI UpdateICMRegKeyA ( DWORD  a0,
LPSTR  a1,
LPSTR  a2,
UINT  a3 
)

Definition at line 281 of file icm.c.

287 {
290  return FALSE;
291 }
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114

◆ UpdateICMRegKeyW()

BOOL WINAPI UpdateICMRegKeyW ( DWORD  a0,
LPWSTR  a1,
LPWSTR  a2,
UINT  a3 
)

Definition at line 299 of file icm.c.

305 {
308  return FALSE;
309 }
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define UNIMPLEMENTED
Definition: debug.h:114