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
22 #include "gdi_private.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(icm
);
36 static INT CALLBACK
enum_profiles_callbackA( LPWSTR filename
, LPARAM lparam
)
39 struct enum_profiles
*ep
= (struct enum_profiles
*)lparam
;
42 len
= WideCharToMultiByte( CP_ACP
, 0, filename
, -1, NULL
, 0, NULL
, NULL
);
43 filenameA
= HeapAlloc( GetProcessHeap(), 0, len
);
46 WideCharToMultiByte( CP_ACP
, 0, filename
, -1, filenameA
, len
, NULL
, NULL
);
47 ret
= ep
->funcA( filenameA
, ep
->data
);
48 HeapFree( GetProcessHeap(), 0, filenameA
);
53 /***********************************************************************
54 * EnumICMProfilesA (GDI32.@)
56 INT WINAPI
EnumICMProfilesA(HDC hdc
, ICMENUMPROCA func
, LPARAM lparam
)
58 struct enum_profiles ep
;
63 return EnumICMProfilesW( hdc
, enum_profiles_callbackA
, (LPARAM
)&ep
);
66 /***********************************************************************
67 * EnumICMProfilesW (GDI32.@)
69 INT WINAPI
EnumICMProfilesW(HDC hdc
, ICMENUMPROCW func
, LPARAM lparam
)
71 WCHAR profile
[MAX_PATH
];
72 DWORD size
= ARRAYSIZE(profile
);
74 TRACE( "%p, %p, 0x%08Ix\n", hdc
, func
, lparam
);
77 if (!__wine_get_icm_profile( hdc
, FALSE
, &size
, profile
)) return -1;
78 /* FIXME: support multiple profiles */
79 return func( profile
, lparam
);
82 /**********************************************************************
83 * GetICMProfileA (GDI32.@)
85 * Returns the filename of the specified device context's color
86 * management profile, even if color management is not enabled
90 * TRUE if filename is copied successfully.
91 * FALSE if the buffer length pointed to by size is too small.
94 * How does Windows assign these? Some registry key?
96 BOOL WINAPI
GetICMProfileA(HDC hdc
, LPDWORD size
, LPSTR filename
)
98 WCHAR filenameW
[MAX_PATH
];
99 DWORD buflen
= MAX_PATH
;
102 TRACE("%p, %p, %p\n", hdc
, size
, filename
);
104 if (!hdc
|| !size
) return FALSE
;
106 if (GetICMProfileW(hdc
, &buflen
, filenameW
))
108 int len
= WideCharToMultiByte(CP_ACP
, 0, filenameW
, -1, NULL
, 0, NULL
, NULL
);
118 WideCharToMultiByte(CP_ACP
, 0, filenameW
, -1, filename
, *size
, NULL
, NULL
);
121 else SetLastError(ERROR_INSUFFICIENT_BUFFER
);
127 /**********************************************************************
128 * GetICMProfileW (GDI32.@)
130 BOOL WINAPI
GetICMProfileW(HDC hdc
, LPDWORD size
, LPWSTR filename
)
132 TRACE("%p, %p, %p\n", hdc
, size
, filename
);
134 return __wine_get_icm_profile( hdc
, TRUE
, size
, filename
);
137 /**********************************************************************
138 * GetLogColorSpaceA (GDI32.@)
140 BOOL WINAPI
GetLogColorSpaceA(HCOLORSPACE colorspace
, LPLOGCOLORSPACEA buffer
, DWORD size
)
142 FIXME("%p %p 0x%08lx stub\n", colorspace
, buffer
, size
);
146 /**********************************************************************
147 * GetLogColorSpaceW (GDI32.@)
149 BOOL WINAPI
GetLogColorSpaceW(HCOLORSPACE colorspace
, LPLOGCOLORSPACEW buffer
, DWORD size
)
151 FIXME("%p %p 0x%08lx stub\n", colorspace
, buffer
, size
);
155 /**********************************************************************
156 * SetICMProfileA (GDI32.@)
158 BOOL WINAPI
SetICMProfileA(HDC hdc
, LPSTR filename
)
160 FIXME("%p %s stub\n", hdc
, debugstr_a(filename
));
164 SetLastError( ERROR_INVALID_PARAMETER
);
169 SetLastError( ERROR_INVALID_HANDLE
);
175 /**********************************************************************
176 * SetICMProfileW (GDI32.@)
178 BOOL WINAPI
SetICMProfileW(HDC hdc
, LPWSTR filename
)
180 FIXME("%p %s stub\n", hdc
, debugstr_w(filename
));
184 SetLastError( ERROR_INVALID_PARAMETER
);
189 SetLastError( ERROR_INVALID_HANDLE
);
195 /**********************************************************************
196 * UpdateICMRegKeyA (GDI32.@)
198 BOOL WINAPI
UpdateICMRegKeyA(DWORD reserved
, LPSTR cmid
, LPSTR filename
, UINT command
)
200 FIXME("0x%08lx, %s, %s, 0x%08x stub\n", reserved
, debugstr_a(cmid
), debugstr_a(filename
), command
);
204 /**********************************************************************
205 * UpdateICMRegKeyW (GDI32.@)
207 BOOL WINAPI
UpdateICMRegKeyW(DWORD reserved
, LPWSTR cmid
, LPWSTR filename
, UINT command
)
209 FIXME("0x%08lx, %s, %s, 0x%08x stub\n", reserved
, debugstr_w(cmid
), debugstr_w(filename
), command
);