329 HCMTRANSFORM hcmTransform,
330 LPCOLOR lpaInputColors,
336 size_t i = (size_t)hcmTransform;
337 icFloatNumber srcPixel[MAX_COLOR_CHANNELS], destPixel[MAX_COLOR_CHANNELS];
340 SetLastError(ERROR_INVALID_HANDLE);
349 SetLastError(ERROR_INVALID_DATATYPE);
353 for (i=0; i<nColors; i++) {
356 srcPixel[0] = (
icFloatNumber)(lpaInputColors->gray.gray) / 65535.0f;
360 srcPixel[0] = (
icFloatNumber)(lpaInputColors->rgb.red) / 65535.0f;
361 srcPixel[1] = (
icFloatNumber)(lpaInputColors->rgb.green) / 65535.0f;
362 srcPixel[2] = (
icFloatNumber)(lpaInputColors->rgb.blue) / 65535.0f;
366 srcPixel[0] = (
icFloatNumber)(lpaInputColors->XYZ.X) / 65535.0f;
367 srcPixel[1] = (
icFloatNumber)(lpaInputColors->XYZ.Y) / 65535.0f;
368 srcPixel[2] = (
icFloatNumber)(lpaInputColors->XYZ.Z) / 65535.0f;
372 srcPixel[0] = (
icFloatNumber)(lpaInputColors->XYZ.X) / 65535.0f;
373 srcPixel[1] = (
icFloatNumber)(lpaInputColors->XYZ.Y) / 65535.0f;
374 srcPixel[2] = (
icFloatNumber)(lpaInputColors->XYZ.Z) / 65535.0f;
378 srcPixel[0] = (
icFloatNumber)(lpaInputColors->Lab.L) / 65535.0f;
379 srcPixel[1] = (
icFloatNumber)(lpaInputColors->Lab.a) / 65535.0f;
380 srcPixel[2] = (
icFloatNumber)(lpaInputColors->Lab.b) / 65535.0f;
383 case COLOR_3_CHANNEL:
384 srcPixel[0] = (
icFloatNumber)(lpaInputColors->gen3ch.ch1) / 65535.0f;
385 srcPixel[1] = (
icFloatNumber)(lpaInputColors->gen3ch.ch2) / 65535.0f;
386 srcPixel[2] = (
icFloatNumber)(lpaInputColors->gen3ch.ch3) / 65535.0f;
390 srcPixel[0] = (
icFloatNumber)(lpaInputColors->cmyk.cyan) / 65535.0f;
391 srcPixel[1] = (
icFloatNumber)(lpaInputColors->cmyk.magenta) / 65535.0f;
392 srcPixel[2] = (
icFloatNumber)(lpaInputColors->cmyk.yellow) / 65535.0f;
393 srcPixel[3] = (
icFloatNumber)(lpaInputColors->cmyk.black) / 65535.0f;
397 case COLOR_8_CHANNEL:
398 srcPixel[7] = (
icFloatNumber)(lpaInputColors->hifi.channel[7]) / 255.0f;
401 case COLOR_7_CHANNEL:
402 srcPixel[6] = (
icFloatNumber)(lpaInputColors->hifi.channel[6]) / 255.0f;
405 case COLOR_6_CHANNEL:
406 srcPixel[5] = (
icFloatNumber)(lpaInputColors->hifi.channel[5]) / 255.0f;
409 case COLOR_5_CHANNEL:
410 srcPixel[0] = (
icFloatNumber)(lpaInputColors->hifi.channel[0]) / 255.0f;
411 srcPixel[1] = (
icFloatNumber)(lpaInputColors->hifi.channel[1]) / 255.0f;
412 srcPixel[2] = (
icFloatNumber)(lpaInputColors->hifi.channel[2]) / 255.0f;
413 srcPixel[3] = (
icFloatNumber)(lpaInputColors->hifi.channel[3]) / 255.0f;
414 srcPixel[4] = (
icFloatNumber)(lpaInputColors->hifi.channel[4]) / 255.0f;
418 SetLastError(ERROR_UNSUPPORTED_TYPE);
423 if (pCmm->Apply(destPixel, srcPixel)!=
icCmmStatOk) {
424 SetLastError(ERROR_FUNCTION_FAILED);
484 HCMTRANSFORM hcmTransform,
491 PBMCALLBACKFN pfnCallback,
495 size_t i = (size_t)hcmTransform;
496 icFloatNumber srcPixel[MAX_COLOR_CHANNELS], destPixel[MAX_COLOR_CHANNELS];
499 SetLastError(ERROR_INVALID_HANDLE);
510 SetLastError(ERROR_INVALID_DATATYPE);
514 for (j=0; j<dwHeight; j++) {
515 lpSrcLine = lpSrcBits;
517 for (i=0; i<dwWidth; i++) {
545 case BM_G3CHTRIPLETS:
707 srcPixel[0] = (
icFloatNumber)((bits&0x3FF00000)>>20) / 1023.0f;
708 srcPixel[1] = (
icFloatNumber)((bits&0x000FFC00)>>10) / 1023.0f;
768 SetLastError(ERROR_UNSUPPORTED_TYPE);
774 if (pCmm->Apply(destPixel, srcPixel)!=
icCmmStatOk) {
775 SetLastError(ERROR_FUNCTION_FAILED);
784 if (pfnCallback && !pfnCallback(j, dwHeight, ulCallbackData)) {
785 SetLastError(ERROR_CANCELLED);
790 size_t dwAlignedSize = (((lpSrcBits - lpSrcLine) + 3)>>2)<<2;
791 lpSrcBits = lpSrcLine + dwAlignedSize;
794 lpSrcBits = lpSrcLine + dwStride;
954 LPLOGCOLORSPACEA lpColorSpace,
955 LPBYTE lpDevCharacter,
956 LPBYTE lpTargetDevCharacter,
968 SetLastError(ERROR_BAD_ARGUMENTS);
972 CIccCmm *pCmm =
new CIccCmm();
973 CIccProfile *pProfile;
975 LPBYTE lpSrcProfileBuf=NULL;
978 if (!CreateProfileFromLogColorSpaceA(lpColorSpace, &lpSrcProfileBuf) || !lpSrcProfileBuf) {
979 SetLastError(ERROR_INVALID_HANDLE);
986 GlobalFree(lpSrcProfileBuf);
987 SetLastError(ERROR_INVALID_HANDLE);
994 GlobalFree(lpSrcProfileBuf);
999 if (lpTargetDevCharacter) {
1003 if (lpSrcProfileBuf)
1004 GlobalFree(lpSrcProfileBuf);
1010 if (lpSrcProfileBuf)
1011 GlobalFree(lpSrcProfileBuf);
1016 if (lpSrcProfileBuf && lpDevCharacter) {
1020 GlobalFree(lpSrcProfileBuf);
1026 GlobalFree(lpSrcProfileBuf);
1032 if (lpDevCharacter) {
1036 if (lpSrcProfileBuf)
1037 GlobalFree(lpSrcProfileBuf);
1043 if (lpSrcProfileBuf)
1044 GlobalFree(lpSrcProfileBuf);
1052 if (lpSrcProfileBuf)
1053 GlobalFree(lpSrcProfileBuf);
1057 pCmm->RemoveAllIO();
1059 if (lpSrcProfileBuf)
1060 GlobalFree(lpSrcProfileBuf);
1064 return (HCMTRANSFORM)(rv+256);
1069 LPLOGCOLORSPACEW lpColorSpace,
1070 LPBYTE lpDevCharacter,
1071 LPBYTE lpTargetDevCharacter,
1086 CIccCmm *pCmm =
new CIccCmm();
1087 CIccProfile *pProfile;
1089 LPBYTE lpSrcProfileBuf=NULL;
1092 if (!CreateProfileFromLogColorSpaceW(lpColorSpace, &lpSrcProfileBuf) || !lpSrcProfileBuf) {
1099 GlobalFree(lpSrcProfileBuf);
1106 GlobalFree(lpSrcProfileBuf);
1111 if (lpTargetDevCharacter) {
1115 if (lpSrcProfileBuf)
1116 GlobalFree(lpSrcProfileBuf);
1122 if (lpSrcProfileBuf)
1123 GlobalFree(lpSrcProfileBuf);
1128 if (lpSrcProfileBuf && lpDevCharacter) {
1132 GlobalFree(lpSrcProfileBuf);
1138 GlobalFree(lpSrcProfileBuf);
1144 if (lpDevCharacter) {
1148 if (lpSrcProfileBuf)
1149 GlobalFree(lpSrcProfileBuf);
1155 if (lpSrcProfileBuf)
1156 GlobalFree(lpSrcProfileBuf);
1164 if (lpSrcProfileBuf)
1165 GlobalFree(lpSrcProfileBuf);
1169 if (lpSrcProfileBuf)
1170 GlobalFree(lpSrcProfileBuf);
1174 return (HCMTRANSFORM)(rv+256);
1282 HCMTRANSFORM hcmTransform,
1283 LPCOLOR lpaInputColors,
1286 LPCOLOR lpaOutputColors,
1290 size_t i = (size_t)hcmTransform;
1291 icFloatNumber srcPixel[MAX_COLOR_CHANNELS], destPixel[MAX_COLOR_CHANNELS];
1294 SetLastError(ERROR_INVALID_HANDLE);
1303 SetLastError(ERROR_INVALID_DATATYPE);
1308 for (i=0; i<nColors; i++) {
1311 srcPixel[0] = (
icFloatNumber)(lpaInputColors->gray.gray) / 65535.0f;
1315 srcPixel[0] = (
icFloatNumber)(lpaInputColors->rgb.red) / 65535.0f;
1316 srcPixel[1] = (
icFloatNumber)(lpaInputColors->rgb.green) / 65535.0f;
1317 srcPixel[2] = (
icFloatNumber)(lpaInputColors->rgb.blue) / 65535.0f;
1321 srcPixel[0] = (
icFloatNumber)(lpaInputColors->XYZ.X) / 65535.0f;
1322 srcPixel[1] = (
icFloatNumber)(lpaInputColors->XYZ.Y) / 65535.0f;
1323 srcPixel[2] = (
icFloatNumber)(lpaInputColors->XYZ.Z) / 65535.0f;
1328 srcPixel[0] = (
icFloatNumber)(lpaInputColors->Yxy.Y) / 65535.0f;
1329 srcPixel[1] = (
icFloatNumber)(lpaInputColors->Yxy.x) / 65535.0f;
1330 srcPixel[2] = (
icFloatNumber)(lpaInputColors->Yxy.y) / 65535.0f;
1334 srcPixel[0] = (
icFloatNumber)(lpaInputColors->Lab.L) / 65535.0f;
1335 srcPixel[1] = (
icFloatNumber)(lpaInputColors->Lab.a) / 65535.0f;
1336 srcPixel[2] = (
icFloatNumber)(lpaInputColors->Lab.b) / 65535.0f;
1338 CIccPCS::Lab2ToLab4(srcPixel, srcPixel);
1342 case COLOR_3_CHANNEL:
1343 srcPixel[0] = (
icFloatNumber)(lpaInputColors->gen3ch.ch1) / 65535.0f;
1344 srcPixel[1] = (
icFloatNumber)(lpaInputColors->gen3ch.ch2) / 65535.0f;
1345 srcPixel[2] = (
icFloatNumber)(lpaInputColors->gen3ch.ch3) / 65535.0f;
1349 srcPixel[0] = (
icFloatNumber)(lpaInputColors->cmyk.cyan) / 65535.0f;
1350 srcPixel[1] = (
icFloatNumber)(lpaInputColors->cmyk.magenta) / 65535.0f;
1351 srcPixel[2] = (
icFloatNumber)(lpaInputColors->cmyk.yellow) / 65535.0f;
1352 srcPixel[3] = (
icFloatNumber)(lpaInputColors->cmyk.black) / 65535.0f;
1356 case COLOR_8_CHANNEL:
1357 srcPixel[7] = (
icFloatNumber)(lpaInputColors->hifi.channel[7]) / 255.0f;
1360 case COLOR_7_CHANNEL:
1361 srcPixel[6] = (
icFloatNumber)(lpaInputColors->hifi.channel[6]) / 255.0f;
1364 case COLOR_6_CHANNEL:
1365 srcPixel[5] = (
icFloatNumber)(lpaInputColors->hifi.channel[5]) / 255.0f;
1368 case COLOR_5_CHANNEL:
1369 srcPixel[0] = (
icFloatNumber)(lpaInputColors->hifi.channel[0]) / 255.0f;
1370 srcPixel[1] = (
icFloatNumber)(lpaInputColors->hifi.channel[1]) / 255.0f;
1371 srcPixel[2] = (
icFloatNumber)(lpaInputColors->hifi.channel[2]) / 255.0f;
1372 srcPixel[3] = (
icFloatNumber)(lpaInputColors->hifi.channel[3]) / 255.0f;
1373 srcPixel[4] = (
icFloatNumber)(lpaInputColors->hifi.channel[4]) / 255.0f;
1377 SetLastError(ERROR_UNSUPPORTED_TYPE);
1382 if (pCmm->Apply(destPixel, srcPixel) !=
icCmmStatOk) {
1383 SetLastError(ERROR_FUNCTION_FAILED);
1412 CIccPCS::Lab4ToLab2(destPixel, destPixel);
1419 case COLOR_3_CHANNEL:
1433 case COLOR_8_CHANNEL:
1437 case COLOR_7_CHANNEL:
1441 case COLOR_6_CHANNEL:
1445 case COLOR_5_CHANNEL:
1454 SetLastError(ERROR_UNSUPPORTED_TYPE);
1514 HCMTRANSFORM hcmTransform,
1519 DWORD dwInputStride,
1522 DWORD dwOutputStride,
1523 LPBMCALLBACKFN lpfnCallback,
1524 ULONG ulCallbackData
1527 size_t i = (size_t)hcmTransform;
1528 icFloatNumber srcPixel[MAX_COLOR_CHANNELS], destPixel[MAX_COLOR_CHANNELS];
1531 SetLastError(ERROR_INVALID_HANDLE);
1543 SetLastError(ERROR_INVALID_DATATYPE);
1547 for (j=0; j<dwHeight; j++) {
1548 lpSrcLine = lpSrcBits;
1549 lpDestLine = lpDestBits;
1551 for (i=0; i<dwWidth; i++) {
1562 CIccPCS::Lab2ToLab4(srcPixel, srcPixel);
1589 case BM_LabTRIPLETS:
1598 CIccPCS::Lab2ToLab4(srcPixel, srcPixel);
1606 case BM_RGBTRIPLETS:
1607 case BM_XYZTRIPLETS:
1608 case BM_YxyTRIPLETS:
1609 case BM_G3CHTRIPLETS:
1622 case BM_BGRTRIPLETS:
1781 srcPixel[0] = (
icFloatNumber)((bits&0x3FF00000)>>20) / 1023.0f;
1782 srcPixel[1] = (
icFloatNumber)((bits&0x000FFC00)>>10) / 1023.0f;
1786 CIccPCS::Lab2ToLab4(srcPixel, srcPixel);
1800 srcPixel[0] = (
icFloatNumber)((bits&0x3FF00000)>>20) / 1023.0f;
1801 srcPixel[1] = (
icFloatNumber)((bits&0x000FFC00)>>10) / 1023.0f;
1822 CIccPCS::Lab2ToLab4(srcPixel, srcPixel);
1874 case BM_NAMED_INDEX:
1876 SetLastError(ERROR_UNSUPPORTED_TYPE);
1881 if (pCmm->Apply(destPixel, srcPixel)!=
icCmmStatOk) {
1882 SetLastError(ERROR_FUNCTION_FAILED);
1890 CIccPCS::Lab4ToLab2(destPixel, destPixel);
1918 case BM_LabTRIPLETS:
1921 CIccPCS::Lab4ToLab2(destPixel, destPixel);
1929 case BM_RGBTRIPLETS:
1930 case BM_XYZTRIPLETS:
1931 case BM_YxyTRIPLETS:
1932 case BM_G3CHTRIPLETS:
1940 case BM_BGRTRIPLETS:
2013 *lpDestBits++ = 0x00;
2022 *lpDestBits++ = 0x00;
2051 CIccPCS::Lab4ToLab2(destPixel, destPixel);
2082 CIccPCS::Lab4ToLab2(destPixel, destPixel);
2135 case BM_NAMED_INDEX:
2137 SetLastError(ERROR_UNSUPPORTED_TYPE);
2143 if (lpfnCallback && !lpfnCallback(j, dwHeight, ulCallbackData)) {
2144 SetLastError(ERROR_CANCELLED);
2148 if (!dwInputStride) {
2149 size_t dwAlignedSize = (((lpSrcBits - lpSrcLine) + 3)>>2)<<2;
2150 lpSrcBits = lpSrcLine + dwAlignedSize;
2153 lpSrcBits = lpSrcLine + dwInputStride;
2156 if (!dwOutputStride) {
2157 size_t dwAlignedSize = (((lpDestBits - lpDestLine) + 3)>>2)<<2;
2158 lpDestBits = lpDestLine + dwAlignedSize;
2161 lpSrcBits = lpDestLine + dwOutputStride;