2 * Image Color Management
4 * Copyright 2004 Marcus Meissner
5 * Copyright 2008 Hans Leidekker
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "ntgdi_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(icm
);
44 static INT CALLBACK
enum_profiles_callbackA( LPWSTR filename
, LPARAM lparam
)
47 struct enum_profiles
*ep
= (struct enum_profiles
*)lparam
;
50 len
= WideCharToMultiByte( CP_ACP
, 0, filename
, -1, NULL
, 0, NULL
, NULL
);
51 filenameA
= HeapAlloc( GetProcessHeap(), 0, len
);
54 WideCharToMultiByte( CP_ACP
, 0, filename
, -1, filenameA
, len
, NULL
, NULL
);
55 ret
= ep
->funcA( filenameA
, ep
->data
);
56 HeapFree( GetProcessHeap(), 0, filenameA
);
61 /***********************************************************************
62 * EnumICMProfilesA (GDI32.@)
64 INT WINAPI
EnumICMProfilesA(HDC hdc
, ICMENUMPROCA func
, LPARAM lparam
)
66 struct enum_profiles ep
;
71 return EnumICMProfilesW( hdc
, enum_profiles_callbackA
, (LPARAM
)&ep
);
74 /***********************************************************************
75 * EnumICMProfilesW (GDI32.@)
77 INT WINAPI
EnumICMProfilesW(HDC hdc
, ICMENUMPROCW func
, LPARAM lparam
)
82 TRACE("%p, %p, 0x%08lx\n", hdc
, func
, lparam
);
85 if ((dc
= get_dc_ptr(hdc
)))
87 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pEnumICMProfiles
);
88 ret
= physdev
->funcs
->pEnumICMProfiles( physdev
, func
, lparam
);
94 /**********************************************************************
95 * GetICMProfileA (GDI32.@)
97 * Returns the filename of the specified device context's color
98 * management profile, even if color management is not enabled
102 * TRUE if filename is copied successfully.
103 * FALSE if the buffer length pointed to by size is too small.
106 * How does Windows assign these? Some registry key?
108 BOOL WINAPI
GetICMProfileA(HDC hdc
, LPDWORD size
, LPSTR filename
)
110 WCHAR filenameW
[MAX_PATH
];
111 DWORD buflen
= MAX_PATH
;
114 TRACE("%p, %p, %p\n", hdc
, size
, filename
);
116 if (!hdc
|| !size
) return FALSE
;
118 if (GetICMProfileW(hdc
, &buflen
, filenameW
))
120 int len
= WideCharToMultiByte(CP_ACP
, 0, filenameW
, -1, NULL
, 0, NULL
, NULL
);
130 WideCharToMultiByte(CP_ACP
, 0, filenameW
, -1, filename
, *size
, NULL
, NULL
);
133 else SetLastError(ERROR_INSUFFICIENT_BUFFER
);
139 /**********************************************************************
140 * GetICMProfileW (GDI32.@)
142 BOOL WINAPI
GetICMProfileW(HDC hdc
, LPDWORD size
, LPWSTR filename
)
145 DC
*dc
= get_dc_ptr(hdc
);
147 TRACE("%p, %p, %p\n", hdc
, size
, filename
);
151 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pGetICMProfile
);
152 ret
= physdev
->funcs
->pGetICMProfile( physdev
, size
, filename
);
158 /**********************************************************************
159 * GetLogColorSpaceA (GDI32.@)
161 BOOL WINAPI
GetLogColorSpaceA(HCOLORSPACE colorspace
, LPLOGCOLORSPACEA buffer
, DWORD size
)
163 FIXME("%p %p 0x%08x stub\n", colorspace
, buffer
, size
);
167 /**********************************************************************
168 * GetLogColorSpaceW (GDI32.@)
170 BOOL WINAPI
GetLogColorSpaceW(HCOLORSPACE colorspace
, LPLOGCOLORSPACEW buffer
, DWORD size
)
172 FIXME("%p %p 0x%08x stub\n", colorspace
, buffer
, size
);
176 /**********************************************************************
177 * SetICMProfileA (GDI32.@)
179 BOOL WINAPI
SetICMProfileA(HDC hdc
, LPSTR filename
)
181 FIXME("%p %s stub\n", hdc
, debugstr_a(filename
));
185 SetLastError( ERROR_INVALID_PARAMETER
);
190 SetLastError( ERROR_INVALID_HANDLE
);
196 /**********************************************************************
197 * SetICMProfileW (GDI32.@)
199 BOOL WINAPI
SetICMProfileW(HDC hdc
, LPWSTR filename
)
201 FIXME("%p %s stub\n", hdc
, debugstr_w(filename
));
205 SetLastError( ERROR_INVALID_PARAMETER
);
210 SetLastError( ERROR_INVALID_HANDLE
);
216 /**********************************************************************
217 * UpdateICMRegKeyA (GDI32.@)
219 BOOL WINAPI
UpdateICMRegKeyA(DWORD reserved
, LPSTR cmid
, LPSTR filename
, UINT command
)
221 FIXME("0x%08x, %s, %s, 0x%08x stub\n", reserved
, debugstr_a(cmid
), debugstr_a(filename
), command
);
225 /**********************************************************************
226 * UpdateICMRegKeyW (GDI32.@)
228 BOOL WINAPI
UpdateICMRegKeyW(DWORD reserved
, LPWSTR cmid
, LPWSTR filename
, UINT command
)
230 FIXME("0x%08x, %s, %s, 0x%08x stub\n", reserved
, debugstr_w(cmid
), debugstr_w(filename
), command
);