| 1 | /* | 
|---|
| 2 | * MSCMS - Color Management System for Wine | 
|---|
| 3 | * | 
|---|
| 4 | * Copyright 2005, 2006, 2008 Hans Leidekker | 
|---|
| 5 | * | 
|---|
| 6 | * This library is free software; you can redistribute it and/or | 
|---|
| 7 | * modify it under the terms of the GNU Lesser General Public | 
|---|
| 8 | * License as published by the Free Software Foundation; either | 
|---|
| 9 | * version 2.1 of the License, or (at your option) any later version. | 
|---|
| 10 | * | 
|---|
| 11 | * This library is distributed in the hope that it will be useful, | 
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 14 | * Lesser General Public License for more details. | 
|---|
| 15 | * | 
|---|
| 16 | * You should have received a copy of the GNU Lesser General Public | 
|---|
| 17 | * License along with this library; if not, write to the Free Software | 
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | 
|---|
| 19 | */ | 
|---|
| 20 |  | 
|---|
| 21 | #include "config.h" | 
|---|
| 22 | #include "wine/debug.h" | 
|---|
| 23 |  | 
|---|
| 24 | #include <stdarg.h> | 
|---|
| 25 | #include <memory.h> | 
|---|
| 26 |  | 
|---|
| 27 | #include "windef.h" | 
|---|
| 28 | #include "winbase.h" | 
|---|
| 29 | #include "winnls.h" | 
|---|
| 30 | #include "wingdi.h" | 
|---|
| 31 | #include "winuser.h" | 
|---|
| 32 | #include "icm.h" | 
|---|
| 33 |  | 
|---|
| 34 | #include "mscms_priv.h" | 
|---|
| 35 |  | 
|---|
| 36 | WINE_DEFAULT_DEBUG_CHANNEL(mscms); | 
|---|
| 37 |  | 
|---|
| 38 | #ifdef HAVE_LCMS | 
|---|
| 39 |  | 
|---|
| 40 | static DWORD from_profile( HPROFILE profile ) | 
|---|
| 41 | { | 
|---|
| 42 | PROFILEHEADER header; | 
|---|
| 43 |  | 
|---|
| 44 | GetColorProfileHeader( profile, &header ); | 
|---|
| 45 | TRACE( "color space: 0x%08x %s\n", header.phDataColorSpace, MSCMS_dbgstr_tag( header.phDataColorSpace ) ); | 
|---|
| 46 |  | 
|---|
| 47 | switch (header.phDataColorSpace) | 
|---|
| 48 | { | 
|---|
| 49 | case 0x434d594b: return TYPE_CMYK_16;  /* 'CMYK' */ | 
|---|
| 50 | case 0x47524159: return TYPE_GRAY_16;  /* 'GRAY' */ | 
|---|
| 51 | case 0x4c616220: return TYPE_Lab_16;   /* 'Lab ' */ | 
|---|
| 52 | case 0x52474220: return TYPE_RGB_16;   /* 'RGB ' */ | 
|---|
| 53 | case 0x58595a20: return TYPE_XYZ_16;   /* 'XYZ ' */ | 
|---|
| 54 | default: | 
|---|
| 55 | WARN("unhandled format\n"); | 
|---|
| 56 | return TYPE_RGB_16; | 
|---|
| 57 | } | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | static DWORD from_bmformat( BMFORMAT format ) | 
|---|
| 61 | { | 
|---|
| 62 | static int quietfixme = 0; | 
|---|
| 63 | TRACE( "bitmap format: 0x%08x\n", format ); | 
|---|
| 64 |  | 
|---|
| 65 | switch (format) | 
|---|
| 66 | { | 
|---|
| 67 | case BM_RGBTRIPLETS: return TYPE_RGB_8; | 
|---|
| 68 | case BM_BGRTRIPLETS: return TYPE_BGR_8; | 
|---|
| 69 | case BM_GRAY:        return TYPE_GRAY_8; | 
|---|
| 70 | default: | 
|---|
| 71 | if (quietfixme == 0) | 
|---|
| 72 | { | 
|---|
| 73 | FIXME("unhandled bitmap format 0x%x\n", format); | 
|---|
| 74 | quietfixme = 1; | 
|---|
| 75 | } | 
|---|
| 76 | return TYPE_RGB_8; | 
|---|
| 77 | } | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | static DWORD from_type( COLORTYPE type ) | 
|---|
| 81 | { | 
|---|
| 82 | TRACE( "color type: 0x%08x\n", type ); | 
|---|
| 83 |  | 
|---|
| 84 | switch (type) | 
|---|
| 85 | { | 
|---|
| 86 | case COLOR_GRAY:    return TYPE_GRAY_16; | 
|---|
| 87 | case COLOR_RGB:     return TYPE_RGB_16; | 
|---|
| 88 | case COLOR_XYZ:     return TYPE_XYZ_16; | 
|---|
| 89 | case COLOR_Yxy:     return TYPE_Yxy_16; | 
|---|
| 90 | case COLOR_Lab:     return TYPE_Lab_16; | 
|---|
| 91 | case COLOR_CMYK:    return TYPE_CMYK_16; | 
|---|
| 92 | default: | 
|---|
| 93 | FIXME("unhandled color type\n"); | 
|---|
| 94 | return TYPE_RGB_16; | 
|---|
| 95 | } | 
|---|
| 96 | } | 
|---|
| 97 |  | 
|---|
| 98 | #endif /* HAVE_LCMS */ | 
|---|
| 99 |  | 
|---|
| 100 | /****************************************************************************** | 
|---|
| 101 | * CreateColorTransformA            [MSCMS.@] | 
|---|
| 102 | * | 
|---|
| 103 | * See CreateColorTransformW. | 
|---|
| 104 | */ | 
|---|
| 105 | HTRANSFORM WINAPI CreateColorTransformA( LPLOGCOLORSPACEA space, HPROFILE dest, | 
|---|
| 106 | HPROFILE target, DWORD flags ) | 
|---|
| 107 | { | 
|---|
| 108 | LOGCOLORSPACEW spaceW; | 
|---|
| 109 | DWORD len; | 
|---|
| 110 |  | 
|---|
| 111 | TRACE( "( %p, %p, %p, 0x%08x )\n", space, dest, target, flags ); | 
|---|
| 112 |  | 
|---|
| 113 | if (!space || !dest) return FALSE; | 
|---|
| 114 |  | 
|---|
| 115 | memcpy( &spaceW, space, FIELD_OFFSET(LOGCOLORSPACEA, lcsFilename) ); | 
|---|
| 116 | spaceW.lcsSize = sizeof(LOGCOLORSPACEW); | 
|---|
| 117 |  | 
|---|
| 118 | len = MultiByteToWideChar( CP_ACP, 0, space->lcsFilename, -1, NULL, 0 ); | 
|---|
| 119 | MultiByteToWideChar( CP_ACP, 0, space->lcsFilename, -1, spaceW.lcsFilename, len ); | 
|---|
| 120 |  | 
|---|
| 121 | return CreateColorTransformW( &spaceW, dest, target, flags ); | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 | /****************************************************************************** | 
|---|
| 125 | * CreateColorTransformW            [MSCMS.@] | 
|---|
| 126 | * | 
|---|
| 127 | * Create a color transform. | 
|---|
| 128 | * | 
|---|
| 129 | * PARAMS | 
|---|
| 130 | *  space  [I] Input color space. | 
|---|
| 131 | *  dest   [I] Color profile of destination device. | 
|---|
| 132 | *  target [I] Color profile of target device. | 
|---|
| 133 | *  flags  [I] Flags. | 
|---|
| 134 | * | 
|---|
| 135 | * RETURNS | 
|---|
| 136 | *  Success: Handle to a transform. | 
|---|
| 137 | *  Failure: NULL | 
|---|
| 138 | */ | 
|---|
| 139 | HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest, | 
|---|
| 140 | HPROFILE target, DWORD flags ) | 
|---|
| 141 | { | 
|---|
| 142 | HTRANSFORM ret = NULL; | 
|---|
| 143 | #ifdef HAVE_LCMS | 
|---|
| 144 | struct transform transform; | 
|---|
| 145 | struct profile *dst, *tgt = NULL; | 
|---|
| 146 | cmsHPROFILE cmsinput, cmsoutput, cmstarget = NULL; | 
|---|
| 147 | DWORD in_format, out_format, proofing = 0; | 
|---|
| 148 | int intent; | 
|---|
| 149 |  | 
|---|
| 150 | TRACE( "( %p, %p, %p, 0x%08x )\n", space, dest, target, flags ); | 
|---|
| 151 |  | 
|---|
| 152 | if (!space || !(dst = grab_profile( dest ))) return FALSE; | 
|---|
| 153 |  | 
|---|
| 154 | if (target && !(tgt = grab_profile( target ))) | 
|---|
| 155 | { | 
|---|
| 156 | release_profile( dst ); | 
|---|
| 157 | return FALSE; | 
|---|
| 158 | } | 
|---|
| 159 | intent = space->lcsIntent > 3 ? INTENT_PERCEPTUAL : space->lcsIntent; | 
|---|
| 160 |  | 
|---|
| 161 | TRACE( "lcsIntent:   %x\n", space->lcsIntent ); | 
|---|
| 162 | TRACE( "lcsCSType:   %s\n", MSCMS_dbgstr_tag( space->lcsCSType ) ); | 
|---|
| 163 | TRACE( "lcsFilename: %s\n", debugstr_w( space->lcsFilename ) ); | 
|---|
| 164 |  | 
|---|
| 165 | in_format  = TYPE_RGB_16; | 
|---|
| 166 | out_format = from_profile( dest ); | 
|---|
| 167 |  | 
|---|
| 168 | cmsinput = cmsCreate_sRGBProfile(); /* FIXME: create from supplied color space */ | 
|---|
| 169 | if (target) | 
|---|
| 170 | { | 
|---|
| 171 | proofing = cmsFLAGS_SOFTPROOFING; | 
|---|
| 172 | cmstarget = tgt->cmsprofile; | 
|---|
| 173 | } | 
|---|
| 174 | cmsoutput = dst->cmsprofile; | 
|---|
| 175 | transform.cmstransform = cmsCreateProofingTransform(cmsinput, in_format, cmsoutput, out_format, cmstarget, | 
|---|
| 176 | intent, INTENT_ABSOLUTE_COLORIMETRIC, proofing); | 
|---|
| 177 |  | 
|---|
| 178 | ret = create_transform( &transform ); | 
|---|
| 179 |  | 
|---|
| 180 | if (tgt) release_profile( tgt ); | 
|---|
| 181 | release_profile( dst ); | 
|---|
| 182 |  | 
|---|
| 183 | #endif /* HAVE_LCMS */ | 
|---|
| 184 | return ret; | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 | /****************************************************************************** | 
|---|
| 188 | * CreateMultiProfileTransform      [MSCMS.@] | 
|---|
| 189 | * | 
|---|
| 190 | * Create a color transform from an array of color profiles. | 
|---|
| 191 | * | 
|---|
| 192 | * PARAMS | 
|---|
| 193 | *  profiles  [I] Array of color profiles. | 
|---|
| 194 | *  nprofiles [I] Number of color profiles. | 
|---|
| 195 | *  intents   [I] Array of rendering intents. | 
|---|
| 196 | *  flags     [I] Flags. | 
|---|
| 197 | *  cmm       [I] Profile to take the CMM from. | 
|---|
| 198 | * | 
|---|
| 199 | * RETURNS | 
|---|
| 200 | *  Success: Handle to a transform. | 
|---|
| 201 | *  Failure: NULL | 
|---|
| 202 | */ | 
|---|
| 203 | HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofiles, | 
|---|
| 204 | PDWORD intents, DWORD nintents, DWORD flags, DWORD cmm ) | 
|---|
| 205 | { | 
|---|
| 206 | HTRANSFORM ret = NULL; | 
|---|
| 207 | #ifdef HAVE_LCMS | 
|---|
| 208 | cmsHPROFILE *cmsprofiles, cmsconvert = NULL; | 
|---|
| 209 | struct transform transform; | 
|---|
| 210 | struct profile *profile0, *profile1; | 
|---|
| 211 | DWORD in_format, out_format; | 
|---|
| 212 |  | 
|---|
| 213 | TRACE( "( %p, 0x%08x, %p, 0x%08x, 0x%08x, 0x%08x )\n", | 
|---|
| 214 | profiles, nprofiles, intents, nintents, flags, cmm ); | 
|---|
| 215 |  | 
|---|
| 216 | if (!profiles || !nprofiles || !intents) return NULL; | 
|---|
| 217 |  | 
|---|
| 218 | if (nprofiles > 2) | 
|---|
| 219 | { | 
|---|
| 220 | FIXME("more than 2 profiles not supported\n"); | 
|---|
| 221 | return NULL; | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|
| 224 | profile0 = grab_profile( profiles[0] ); | 
|---|
| 225 | if (!profile0) return NULL; | 
|---|
| 226 | profile1 = grab_profile( profiles[1] ); | 
|---|
| 227 | if (!profile1) | 
|---|
| 228 | { | 
|---|
| 229 | release_profile( profile0 ); | 
|---|
| 230 | return NULL; | 
|---|
| 231 | } | 
|---|
| 232 | in_format  = from_profile( profiles[0] ); | 
|---|
| 233 | out_format = from_profile( profiles[nprofiles - 1] ); | 
|---|
| 234 |  | 
|---|
| 235 | if (in_format != out_format) | 
|---|
| 236 | { | 
|---|
| 237 | /* insert a conversion profile for pairings that lcms doesn't handle */ | 
|---|
| 238 | if (out_format == TYPE_RGB_16) cmsconvert = cmsCreate_sRGBProfile(); | 
|---|
| 239 | if (out_format == TYPE_Lab_16) cmsconvert = cmsCreateLabProfile( NULL ); | 
|---|
| 240 | } | 
|---|
| 241 |  | 
|---|
| 242 | cmsprofiles = HeapAlloc( GetProcessHeap(), 0, (nprofiles + 1) * sizeof(cmsHPROFILE *) ); | 
|---|
| 243 | if (cmsprofiles) | 
|---|
| 244 | { | 
|---|
| 245 | cmsprofiles[0] = profile0->cmsprofile; | 
|---|
| 246 | if (cmsconvert) | 
|---|
| 247 | { | 
|---|
| 248 | cmsprofiles[1] = cmsconvert; | 
|---|
| 249 | cmsprofiles[2] = profile1->cmsprofile; | 
|---|
| 250 | nprofiles++; | 
|---|
| 251 | } | 
|---|
| 252 | else | 
|---|
| 253 | { | 
|---|
| 254 | cmsprofiles[1] = profile1->cmsprofile; | 
|---|
| 255 | } | 
|---|
| 256 | transform.cmstransform = cmsCreateMultiprofileTransform( cmsprofiles, nprofiles, in_format, out_format, *intents, 0 ); | 
|---|
| 257 |  | 
|---|
| 258 | HeapFree( GetProcessHeap(), 0, cmsprofiles ); | 
|---|
| 259 | ret = create_transform( &transform ); | 
|---|
| 260 | } | 
|---|
| 261 |  | 
|---|
| 262 | release_profile( profile0 ); | 
|---|
| 263 | release_profile( profile1 ); | 
|---|
| 264 |  | 
|---|
| 265 | #endif /* HAVE_LCMS */ | 
|---|
| 266 | return ret; | 
|---|
| 267 | } | 
|---|
| 268 |  | 
|---|
| 269 | /****************************************************************************** | 
|---|
| 270 | * DeleteColorTransform             [MSCMS.@] | 
|---|
| 271 | * | 
|---|
| 272 | * Delete a color transform. | 
|---|
| 273 | * | 
|---|
| 274 | * PARAMS | 
|---|
| 275 | *  transform [I] Handle to a color transform. | 
|---|
| 276 | * | 
|---|
| 277 | * RETURNS | 
|---|
| 278 | *  Success: TRUE | 
|---|
| 279 | *  Failure: FALSE | 
|---|
| 280 | */ | 
|---|
| 281 | BOOL WINAPI DeleteColorTransform( HTRANSFORM handle ) | 
|---|
| 282 | { | 
|---|
| 283 | BOOL ret = FALSE; | 
|---|
| 284 | #ifdef HAVE_LCMS | 
|---|
| 285 |  | 
|---|
| 286 | TRACE( "( %p )\n", handle ); | 
|---|
| 287 |  | 
|---|
| 288 | ret = close_transform( handle ); | 
|---|
| 289 |  | 
|---|
| 290 | #endif /* HAVE_LCMS */ | 
|---|
| 291 | return ret; | 
|---|
| 292 | } | 
|---|
| 293 |  | 
|---|
| 294 | /****************************************************************************** | 
|---|
| 295 | * TranslateBitmapBits              [MSCMS.@] | 
|---|
| 296 | * | 
|---|
| 297 | * Perform color translation. | 
|---|
| 298 | * | 
|---|
| 299 | * PARAMS | 
|---|
| 300 | *  transform    [I] Handle to a color transform. | 
|---|
| 301 | *  srcbits      [I] Source bitmap. | 
|---|
| 302 | *  input        [I] Format of the source bitmap. | 
|---|
| 303 | *  width        [I] Width of the source bitmap. | 
|---|
| 304 | *  height       [I] Height of the source bitmap. | 
|---|
| 305 | *  inputstride  [I] Number of bytes in one scanline. | 
|---|
| 306 | *  destbits     [I] Destination bitmap. | 
|---|
| 307 | *  output       [I] Format of the destination bitmap. | 
|---|
| 308 | *  outputstride [I] Number of bytes in one scanline. | 
|---|
| 309 | *  callback     [I] Callback function. | 
|---|
| 310 | *  data         [I] Callback data. | 
|---|
| 311 | * | 
|---|
| 312 | * RETURNS | 
|---|
| 313 | *  Success: TRUE | 
|---|
| 314 | *  Failure: FALSE | 
|---|
| 315 | */ | 
|---|
| 316 | BOOL WINAPI TranslateBitmapBits( HTRANSFORM handle, PVOID srcbits, BMFORMAT input, | 
|---|
| 317 | DWORD width, DWORD height, DWORD inputstride, PVOID destbits, BMFORMAT output, | 
|---|
| 318 | DWORD outputstride, PBMCALLBACKFN callback, ULONG data ) | 
|---|
| 319 | { | 
|---|
| 320 | BOOL ret = FALSE; | 
|---|
| 321 | #ifdef HAVE_LCMS | 
|---|
| 322 | struct transform *transform = grab_transform( handle ); | 
|---|
| 323 |  | 
|---|
| 324 | TRACE( "( %p, %p, 0x%08x, 0x%08x, 0x%08x, 0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x )\n", | 
|---|
| 325 | handle, srcbits, input, width, height, inputstride, destbits, output, | 
|---|
| 326 | outputstride, callback, data ); | 
|---|
| 327 |  | 
|---|
| 328 | if (!transform) return FALSE; | 
|---|
| 329 | cmsChangeBuffersFormat( transform->cmstransform, from_bmformat(input), from_bmformat(output) ); | 
|---|
| 330 |  | 
|---|
| 331 | cmsDoTransform( transform->cmstransform, srcbits, destbits, width * height ); | 
|---|
| 332 | release_transform( transform ); | 
|---|
| 333 | ret = TRUE; | 
|---|
| 334 |  | 
|---|
| 335 | #endif /* HAVE_LCMS */ | 
|---|
| 336 | return ret; | 
|---|
| 337 | } | 
|---|
| 338 |  | 
|---|
| 339 | /****************************************************************************** | 
|---|
| 340 | * TranslateColors              [MSCMS.@] | 
|---|
| 341 | * | 
|---|
| 342 | * Perform color translation. | 
|---|
| 343 | * | 
|---|
| 344 | * PARAMS | 
|---|
| 345 | *  transform    [I] Handle to a color transform. | 
|---|
| 346 | *  input        [I] Array of input colors. | 
|---|
| 347 | *  number       [I] Number of colors to translate. | 
|---|
| 348 | *  input_type   [I] Input color format. | 
|---|
| 349 | *  output       [O] Array of output colors. | 
|---|
| 350 | *  output_type  [I] Output color format. | 
|---|
| 351 | * | 
|---|
| 352 | * RETURNS | 
|---|
| 353 | *  Success: TRUE | 
|---|
| 354 | *  Failure: FALSE | 
|---|
| 355 | */ | 
|---|
| 356 | BOOL WINAPI TranslateColors( HTRANSFORM handle, PCOLOR in, DWORD count, | 
|---|
| 357 | COLORTYPE input_type, PCOLOR out, COLORTYPE output_type ) | 
|---|
| 358 | { | 
|---|
| 359 | BOOL ret = FALSE; | 
|---|
| 360 | #ifdef HAVE_LCMS | 
|---|
| 361 | struct transform *transform = grab_transform( handle ); | 
|---|
| 362 | cmsHTRANSFORM xfrm; | 
|---|
| 363 | unsigned int i; | 
|---|
| 364 |  | 
|---|
| 365 | TRACE( "( %p, %p, %d, %d, %p, %d )\n", handle, in, count, input_type, out, output_type ); | 
|---|
| 366 |  | 
|---|
| 367 | if (!transform) return FALSE; | 
|---|
| 368 |  | 
|---|
| 369 | xfrm = transform->cmstransform; | 
|---|
| 370 | cmsChangeBuffersFormat( xfrm, from_type(input_type), from_type(output_type) ); | 
|---|
| 371 |  | 
|---|
| 372 | switch (input_type) | 
|---|
| 373 | { | 
|---|
| 374 | case COLOR_RGB: | 
|---|
| 375 | { | 
|---|
| 376 | switch (output_type) | 
|---|
| 377 | { | 
|---|
| 378 | case COLOR_RGB:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].rgb, &out[i].rgb, 1 ); return TRUE; | 
|---|
| 379 | case COLOR_Lab:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].rgb, &out[i].Lab, 1 ); return TRUE; | 
|---|
| 380 | case COLOR_GRAY: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].rgb, &out[i].gray, 1 ); return TRUE; | 
|---|
| 381 | case COLOR_CMYK: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].rgb, &out[i].cmyk, 1 ); return TRUE; | 
|---|
| 382 | case COLOR_XYZ:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].rgb, &out[i].XYZ, 1 ); return TRUE; | 
|---|
| 383 | default: | 
|---|
| 384 | FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type); | 
|---|
| 385 | return FALSE; | 
|---|
| 386 | } | 
|---|
| 387 | } | 
|---|
| 388 | case COLOR_Lab: | 
|---|
| 389 | { | 
|---|
| 390 | switch (output_type) | 
|---|
| 391 | { | 
|---|
| 392 | case COLOR_RGB:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].Lab, &out[i].rgb, 1 ); return TRUE; | 
|---|
| 393 | case COLOR_Lab:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].Lab, &out[i].Lab, 1 ); return TRUE; | 
|---|
| 394 | case COLOR_GRAY: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].Lab, &out[i].gray, 1 ); return TRUE; | 
|---|
| 395 | case COLOR_CMYK: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].Lab, &out[i].cmyk, 1 ); return TRUE; | 
|---|
| 396 | case COLOR_XYZ:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].Lab, &out[i].XYZ, 1 ); return TRUE; | 
|---|
| 397 | default: | 
|---|
| 398 | FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type); | 
|---|
| 399 | return FALSE; | 
|---|
| 400 | } | 
|---|
| 401 | } | 
|---|
| 402 | case COLOR_GRAY: | 
|---|
| 403 | { | 
|---|
| 404 | switch (output_type) | 
|---|
| 405 | { | 
|---|
| 406 | case COLOR_RGB:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].gray, &out[i].rgb, 1 ); return TRUE; | 
|---|
| 407 | case COLOR_Lab:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].gray, &out[i].Lab, 1 ); return TRUE; | 
|---|
| 408 | case COLOR_GRAY: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].gray, &out[i].gray, 1 ); return TRUE; | 
|---|
| 409 | case COLOR_CMYK: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].gray, &out[i].cmyk, 1 ); return TRUE; | 
|---|
| 410 | case COLOR_XYZ:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].gray, &out[i].XYZ, 1 ); return TRUE; | 
|---|
| 411 | default: | 
|---|
| 412 | FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type); | 
|---|
| 413 | return FALSE; | 
|---|
| 414 | } | 
|---|
| 415 | } | 
|---|
| 416 | case COLOR_CMYK: | 
|---|
| 417 | { | 
|---|
| 418 | switch (output_type) | 
|---|
| 419 | { | 
|---|
| 420 | case COLOR_RGB:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].cmyk, &out[i].rgb, 1 ); return TRUE; | 
|---|
| 421 | case COLOR_Lab:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].cmyk, &out[i].Lab, 1 ); return TRUE; | 
|---|
| 422 | case COLOR_GRAY: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].cmyk, &out[i].gray, 1 ); return TRUE; | 
|---|
| 423 | case COLOR_CMYK: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].cmyk, &out[i].cmyk, 1 ); return TRUE; | 
|---|
| 424 | case COLOR_XYZ:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].cmyk, &out[i].XYZ, 1 ); return TRUE; | 
|---|
| 425 | default: | 
|---|
| 426 | FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type); | 
|---|
| 427 | return FALSE; | 
|---|
| 428 | } | 
|---|
| 429 | } | 
|---|
| 430 | case COLOR_XYZ: | 
|---|
| 431 | { | 
|---|
| 432 | switch (output_type) | 
|---|
| 433 | { | 
|---|
| 434 | case COLOR_RGB:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].XYZ, &out[i].rgb, 1 ); return TRUE; | 
|---|
| 435 | case COLOR_Lab:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].XYZ, &out[i].Lab, 1 ); return TRUE; | 
|---|
| 436 | case COLOR_GRAY: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].XYZ, &out[i].gray, 1 ); return TRUE; | 
|---|
| 437 | case COLOR_CMYK: for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].XYZ, &out[i].cmyk, 1 ); return TRUE; | 
|---|
| 438 | case COLOR_XYZ:  for (i = 0; i < count; i++) cmsDoTransform( xfrm, &in[i].XYZ, &out[i].XYZ, 1 ); return TRUE; | 
|---|
| 439 | default: | 
|---|
| 440 | FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type); | 
|---|
| 441 | return FALSE; | 
|---|
| 442 | } | 
|---|
| 443 | } | 
|---|
| 444 | default: | 
|---|
| 445 | FIXME("unhandled input/output pair: %d/%d\n", input_type, output_type); | 
|---|
| 446 | break; | 
|---|
| 447 | } | 
|---|
| 448 | release_transform( transform ); | 
|---|
| 449 |  | 
|---|
| 450 | #endif /* HAVE_LCMS */ | 
|---|
| 451 | return ret; | 
|---|
| 452 | } | 
|---|