| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../../include/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
| 8 #include "codec_int.h" | 8 #include "codec_int.h" |
| 9 #include "../lcms2/include/fx_lcms2.h" | 9 #include "../lcms2/include/fx_lcms2.h" |
| 10 const FX_DWORD N_COMPONENT_LAB = 3; | 10 const FX_DWORD N_COMPONENT_LAB = 3; |
| 11 const FX_DWORD N_COMPONENT_GRAY = 1; | 11 const FX_DWORD N_COMPONENT_GRAY = 1; |
| 12 const FX_DWORD N_COMPONENT_RGB = 3; | 12 const FX_DWORD N_COMPONENT_RGB = 3; |
| 13 const FX_DWORD N_COMPONENT_CMYK = 4; | 13 const FX_DWORD N_COMPONENT_CMYK = 4; |
| 14 const FX_DWORD N_COMPONENT_DEFAULT = 3; | 14 const FX_DWORD N_COMPONENT_DEFAULT = 3; |
| 15 | 15 |
| 16 FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16] ) | 16 FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) |
| 17 { | 17 { |
| 18 return cmsMD5computeIDExt(buf, dwSize, ID); | 18 return cmsMD5computeIDExt(buf, dwSize, ID); |
| 19 } | 19 } |
| 20 struct CLcmsCmm { | 20 struct CLcmsCmm { |
| 21 cmsHTRANSFORM m_hTransform; | 21 cmsHTRANSFORM m_hTransform; |
| 22 int m_nSrcComponents; | 22 int m_nSrcComponents; |
| 23 int m_nDstComponents; | 23 int m_nDstComponents; |
| 24 FX_BOOL m_bLab; | 24 FX_BOOL m_bLab; |
| 25 }; | 25 }; |
| 26 extern "C" { | 26 extern "C" { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 break; | 59 break; |
| 60 default: | 60 default: |
| 61 if (nComponents != 3) { | 61 if (nComponents != 3) { |
| 62 return FALSE; | 62 return FALSE; |
| 63 } | 63 } |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 return TRUE; | 66 return TRUE; |
| 67 } | 67 } |
| 68 FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) | 68 int32_t GetCSComponents(cmsColorSpaceSignature cs) |
| 69 { | 69 { |
| 70 FX_DWORD components; | 70 FX_DWORD components; |
| 71 switch (cs) { | 71 switch (cs) { |
| 72 case cmsSigLabData: | 72 case cmsSigLabData: |
| 73 components = N_COMPONENT_LAB; | 73 components = N_COMPONENT_LAB; |
| 74 break; | 74 break; |
| 75 case cmsSigGrayData: | 75 case cmsSigGrayData: |
| 76 components = N_COMPONENT_GRAY; | 76 components = N_COMPONENT_GRAY; |
| 77 break; | 77 break; |
| 78 case cmsSigRgbData: | 78 case cmsSigRgbData: |
| 79 components = N_COMPONENT_RGB; | 79 components = N_COMPONENT_RGB; |
| 80 break; | 80 break; |
| 81 case cmsSigCmykData: | 81 case cmsSigCmykData: |
| 82 components = N_COMPONENT_CMYK; | 82 components = N_COMPONENT_CMYK; |
| 83 break; | 83 break; |
| 84 default: | 84 default: |
| 85 components = N_COMPONENT_DEFAULT; | 85 components = N_COMPONENT_DEFAULT; |
| 86 break; | 86 break; |
| 87 } | 87 } |
| 88 return components; | 88 return components; |
| 89 } | 89 } |
| 90 void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr
cProfileSize, FX_INT32& nSrcComponents, | 90 void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr
cProfileSize, int32_t& nSrcComponents, |
| 91 const unsigned char* pDstProfileData, FX_DWORD dwDs
tProfileSize, FX_INT32 nDstComponents, | 91 const unsigned char* pDstProfileData, FX_DWORD dwDs
tProfileSize, int32_t nDstComponents, |
| 92 int intent, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAU
LT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) | 92 int intent, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAU
LT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) |
| 93 { | 93 { |
| 94 cmsHPROFILE srcProfile = NULL; | 94 cmsHPROFILE srcProfile = NULL; |
| 95 cmsHPROFILE dstProfile = NULL; | 95 cmsHPROFILE dstProfile = NULL; |
| 96 cmsHTRANSFORM hTransform = NULL; | 96 cmsHTRANSFORM hTransform = NULL; |
| 97 CLcmsCmm* pCmm = NULL; | 97 CLcmsCmm* pCmm = NULL; |
| 98 nSrcComponents = 0; | 98 nSrcComponents = 0; |
| 99 srcProfile = cmsOpenProfileFromMem((void*)pSrcProfileData, dwSrcProfileSize)
; | 99 srcProfile = cmsOpenProfileFromMem((void*)pSrcProfileData, dwSrcProfileSize)
; |
| 100 if (srcProfile == NULL) { | 100 if (srcProfile == NULL) { |
| 101 return NULL; | 101 return NULL; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 pCmm = new CLcmsCmm; | 151 pCmm = new CLcmsCmm; |
| 152 pCmm->m_nSrcComponents = nSrcComponents; | 152 pCmm->m_nSrcComponents = nSrcComponents; |
| 153 pCmm->m_nDstComponents = nDstComponents; | 153 pCmm->m_nDstComponents = nDstComponents; |
| 154 pCmm->m_hTransform = hTransform; | 154 pCmm->m_hTransform = hTransform; |
| 155 pCmm->m_bLab = bLab; | 155 pCmm->m_bLab = bLab; |
| 156 cmsCloseProfile(srcProfile); | 156 cmsCloseProfile(srcProfile); |
| 157 cmsCloseProfile(dstProfile); | 157 cmsCloseProfile(dstProfile); |
| 158 return pCmm; | 158 return pCmm; |
| 159 } | 159 } |
| 160 void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dw
ProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) | 160 void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dw
ProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) |
| 161 { | 161 { |
| 162 return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL
, 0, 3, intent, dwSrcFormat); | 162 return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL
, 0, 3, intent, dwSrcFormat); |
| 163 } | 163 } |
| 164 void IccLib_DestroyTransform(void* pTransform) | 164 void IccLib_DestroyTransform(void* pTransform) |
| 165 { | 165 { |
| 166 if (pTransform == NULL) { | 166 if (pTransform == NULL) { |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 cmsDeleteTransform(((CLcmsCmm*)pTransform)->m_hTransform); | 169 cmsDeleteTransform(((CLcmsCmm*)pTransform)->m_hTransform); |
| 170 delete (CLcmsCmm*)pTransform; | 170 delete (CLcmsCmm*)pTransform; |
| 171 } | 171 } |
| 172 void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV
alues, FX_FLOAT* pDestValues) | 172 void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV
alues, FX_FLOAT* pDestValues) |
| 173 { | 173 { |
| 174 if (pTransform == NULL) { | 174 if (pTransform == NULL) { |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 CLcmsCmm* p = (CLcmsCmm*)pTransform; | 177 CLcmsCmm* p = (CLcmsCmm*)pTransform; |
| 178 FX_BYTE output[4]; | 178 uint8_t output[4]; |
| 179 if (p->m_bLab) { | 179 if (p->m_bLab) { |
| 180 CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); | 180 CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); |
| 181 double* input = inputs; | 181 double* input = inputs; |
| 182 for (FX_DWORD i = 0; i < nSrcComponents; i ++) { | 182 for (FX_DWORD i = 0; i < nSrcComponents; i ++) { |
| 183 input[i] = pSrcValues[i]; | 183 input[i] = pSrcValues[i]; |
| 184 } | 184 } |
| 185 cmsDoTransform(p->m_hTransform, input, output, 1); | 185 cmsDoTransform(p->m_hTransform, input, output, 1); |
| 186 } else { | 186 } else { |
| 187 CFX_FixedBufGrow<FX_BYTE, 16> inputs(nSrcComponents); | 187 CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents); |
| 188 FX_BYTE* input = inputs; | 188 uint8_t* input = inputs; |
| 189 for (FX_DWORD i = 0; i < nSrcComponents; i ++) { | 189 for (FX_DWORD i = 0; i < nSrcComponents; i ++) { |
| 190 if (pSrcValues[i] > 1.0f) { | 190 if (pSrcValues[i] > 1.0f) { |
| 191 input[i] = 255; | 191 input[i] = 255; |
| 192 } else if (pSrcValues[i] < 0) { | 192 } else if (pSrcValues[i] < 0) { |
| 193 input[i] = 0; | 193 input[i] = 0; |
| 194 } else { | 194 } else { |
| 195 input[i] = (int)(pSrcValues[i] * 255.0f); | 195 input[i] = (int)(pSrcValues[i] * 255.0f); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 cmsDoTransform(p->m_hTransform, input, output, 1); | 198 cmsDoTransform(p->m_hTransform, input, output, 1); |
| 199 } | 199 } |
| 200 switch(p->m_nDstComponents) { | 200 switch(p->m_nDstComponents) { |
| 201 case 1: | 201 case 1: |
| 202 pDestValues[0] = output[0] / 255.0f; | 202 pDestValues[0] = output[0] / 255.0f; |
| 203 break; | 203 break; |
| 204 case 3: | 204 case 3: |
| 205 pDestValues[0] = output[2] / 255.0f; | 205 pDestValues[0] = output[2] / 255.0f; |
| 206 pDestValues[1] = output[1] / 255.0f; | 206 pDestValues[1] = output[1] / 255.0f; |
| 207 pDestValues[2] = output[0] / 255.0f; | 207 pDestValues[2] = output[0] / 255.0f; |
| 208 break; | 208 break; |
| 209 case 4: | 209 case 4: |
| 210 pDestValues[0] = output[0] / 255.0f; | 210 pDestValues[0] = output[0] / 255.0f; |
| 211 pDestValues[1] = output[1] / 255.0f; | 211 pDestValues[1] = output[1] / 255.0f; |
| 212 pDestValues[2] = output[2] / 255.0f; | 212 pDestValues[2] = output[2] / 255.0f; |
| 213 pDestValues[3] = output[3] / 255.0f; | 213 pDestValues[3] = output[3] / 255.0f; |
| 214 break; | 214 break; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigne
d char* pSrc, FX_INT32 pixels) | 217 void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigne
d char* pSrc, int32_t pixels) |
| 218 { | 218 { |
| 219 cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pi
xels); | 219 cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pi
xels); |
| 220 } | 220 } |
| 221 FX_LPVOID CreateProfile_Gray(double gamma) | 221 FX_LPVOID CreateProfile_Gray(double gamma) |
| 222 { | 222 { |
| 223 cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY(); | 223 cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY(); |
| 224 if (!cmsWhitePointFromTemp(D50, 6504)) { | 224 if (!cmsWhitePointFromTemp(D50, 6504)) { |
| 225 return NULL; | 225 return NULL; |
| 226 } | 226 } |
| 227 cmsToneCurve* curve = cmsBuildGamma(NULL, gamma); | 227 cmsToneCurve* curve = cmsBuildGamma(NULL, gamma); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 return cs; | 278 return cs; |
| 279 } | 279 } |
| 280 ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) | 280 ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) |
| 281 { | 281 { |
| 282 if (pFile == NULL) { | 282 if (pFile == NULL) { |
| 283 return IccCS_Unknown; | 283 return IccCS_Unknown; |
| 284 } | 284 } |
| 285 ICodec_IccModule::IccCS cs; | 285 ICodec_IccModule::IccCS cs; |
| 286 FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); | 286 FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); |
| 287 FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, dwSize); | 287 FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); |
| 288 pFile->ReadBlock(pBuf, 0, dwSize); | 288 pFile->ReadBlock(pBuf, 0, dwSize); |
| 289 cs = GetProfileCS(pBuf, dwSize); | 289 cs = GetProfileCS(pBuf, dwSize); |
| 290 FX_Free(pBuf); | 290 FX_Free(pBuf); |
| 291 return cs; | 291 return cs; |
| 292 } | 292 } |
| 293 FX_DWORD TransferProfileType(FX_LPVOID pProfile, FX_DWORD dwFormat) | 293 FX_DWORD TransferProfileType(FX_LPVOID pProfile, FX_DWORD dwFormat) |
| 294 { | 294 { |
| 295 cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); | 295 cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); |
| 296 switch (cs) { | 296 switch (cs) { |
| 297 case cmsSigXYZData: | 297 case cmsSigXYZData: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 { | 399 { |
| 400 AppendBlock(&i, sizeof(FX_DWORD)); | 400 AppendBlock(&i, sizeof(FX_DWORD)); |
| 401 return *this; | 401 return *this; |
| 402 } | 402 } |
| 403 FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam,
Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) | 403 FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam,
Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) |
| 404 { | 404 { |
| 405 CFX_IccProfileCache* pCache = NULL; | 405 CFX_IccProfileCache* pCache = NULL; |
| 406 CFX_ByteStringKey key; | 406 CFX_ByteStringKey key; |
| 407 CFX_ByteString text; | 407 CFX_ByteString text; |
| 408 key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8); | 408 key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8); |
| 409 FX_BYTE ID[16]; | 409 uint8_t ID[16]; |
| 410 switch (pIccParam->dwProfileType) { | 410 switch (pIccParam->dwProfileType) { |
| 411 case Icc_PARAMTYPE_NONE: | 411 case Icc_PARAMTYPE_NONE: |
| 412 return NULL; | 412 return NULL; |
| 413 case Icc_PARAMTYPE_BUFFER: | 413 case Icc_PARAMTYPE_BUFFER: |
| 414 MD5ComputeID(pIccParam->pProfileData, pIccParam->dwProfileSize, ID); | 414 MD5ComputeID(pIccParam->pProfileData, pIccParam->dwProfileSize, ID); |
| 415 break; | 415 break; |
| 416 case Icc_PARAMTYPE_PARAM: | 416 case Icc_PARAMTYPE_PARAM: |
| 417 FXSYS_memset32(ID, 0, 16); | 417 FXSYS_memset32(ID, 0, 16); |
| 418 switch (pIccParam->ColorSpace) { | 418 switch (pIccParam->ColorSpace) { |
| 419 case IccCS_Gray: | 419 case IccCS_Gray: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 519 } |
| 520 pos = m_MapTranform.GetStartPosition(); | 520 pos = m_MapTranform.GetStartPosition(); |
| 521 CFX_IccTransformCache* pTransformCache; | 521 CFX_IccTransformCache* pTransformCache; |
| 522 while (pos) { | 522 while (pos) { |
| 523 m_MapTranform.GetNextAssoc(pos, key, (FX_LPVOID&)pTransformCache); | 523 m_MapTranform.GetNextAssoc(pos, key, (FX_LPVOID&)pTransformCache); |
| 524 if (pTransformCache) { | 524 if (pTransformCache) { |
| 525 delete pTransformCache; | 525 delete pTransformCache; |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD d
wProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) | 529 void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD d
wProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) |
| 530 { | 530 { |
| 531 return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents,
intent, dwSrcFormat); | 531 return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents,
intent, dwSrcFormat); |
| 532 } | 532 } |
| 533 void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWOR
D dwSrcProfileSize, FX_INT32& nSrcComponents, | 533 void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWOR
D dwSrcProfileSize, int32_t& nSrcComponents, |
| 534 FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent, | 534 FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, |
| 535 FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) | 535 FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) |
| 536 { | 536 { |
| 537 return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcCompone
nts, | 537 return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcCompone
nts, |
| 538 pDstProfileData, dwDstProfileSize, 4, intent,
dwSrcFormat, dwDstFormat); | 538 pDstProfileData, dwDstProfileSize, 4, intent,
dwSrcFormat, dwDstFormat); |
| 539 } | 539 } |
| 540 void CCodec_IccModule::DestroyTransform(void* pTransform) | 540 void CCodec_IccModule::DestroyTransform(void* pTransform) |
| 541 { | 541 { |
| 542 IccLib_DestroyTransform(pTransform); | 542 IccLib_DestroyTransform(pTransform); |
| 543 } | 543 } |
| 544 void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA
T* pDestValues) | 544 void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA
T* pDestValues) |
| 545 { | 545 { |
| 546 IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); | 546 IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); |
| 547 } | 547 } |
| 548 void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_L
PCBYTE pSrc, FX_INT32 pixels) | 548 void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_L
PCBYTE pSrc, int32_t pixels) |
| 549 { | 549 { |
| 550 IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); | 550 IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); |
| 551 } | 551 } |
| 552 const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { | 552 const uint8_t g_CMYKSamples[81 * 81 * 3] = { |
| 553 255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152, 1
23, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, | 553 255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152, 1
23, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, |
| 554 255, 253, 229, 226, 224, 203, 200, 199, 182, 173, 173, 158, 149, 148, 135, 1
25, 124, 113, 99, 99, 90, 70, 69, 63, 33, 29, 24, | 554 255, 253, 229, 226, 224, 203, 200, 199, 182, 173, 173, 158, 149, 148, 135, 1
25, 124, 113, 99, 99, 90, 70, 69, 63, 33, 29, 24, |
| 555 255, 251, 204, 228, 223, 182, 201, 198, 163, 174, 172, 142, 150, 147, 122, 1
25, 123, 101, 99, 98, 80, 70, 68, 54, 32, 28, 16, | 555 255, 251, 204, 228, 223, 182, 201, 198, 163, 174, 172, 142, 150, 147, 122, 1
25, 123, 101, 99, 98, 80, 70, 68, 54, 32, 28, 16, |
| 556 255, 249, 179, 230, 222, 160, 203, 197, 144, 174, 170, 124, 150, 145, 105, 1
25, 122, 88, 99, 97, 69, 70, 68, 46, 31, 28, 6, | 556 255, 249, 179, 230, 222, 160, 203, 197, 144, 174, 170, 124, 150, 145, 105, 1
25, 122, 88, 99, 97, 69, 70, 68, 46, 31, 28, 6, |
| 557 255, 247, 154, 229, 220, 138, 203, 195, 122, 176, 169, 107, 150, 145, 91, 12
5, 121, 74, 100, 96, 57, 70, 67, 35, 29, 26, 0, | 557 255, 247, 154, 229, 220, 138, 203, 195, 122, 176, 169, 107, 150, 145, 91, 12
5, 121, 74, 100, 96, 57, 70, 67, 35, 29, 26, 0, |
| 558 255, 246, 128, 231, 217, 114, 205, 194, 101, 176, 167, 88, 150, 144, 75, 125
, 120, 60, 100, 96, 44, 70, 66, 24, 28, 26, 0, | 558 255, 246, 128, 231, 217, 114, 205, 194, 101, 176, 167, 88, 150, 144, 75, 125
, 120, 60, 100, 96, 44, 70, 66, 24, 28, 26, 0, |
| 559 255, 244, 96, 231, 217, 87, 203, 192, 78, 175, 167, 66, 150, 143, 56, 125, 1
19, 43, 100, 95, 29, 69, 66, 7, 26, 26, 0, | 559 255, 244, 96, 231, 217, 87, 203, 192, 78, 175, 167, 66, 150, 143, 56, 125, 1
19, 43, 100, 95, 29, 69, 66, 7, 26, 26, 0, |
| 560 255, 243, 51, 232, 215, 51, 204, 191, 43, 176, 165, 38, 150, 142, 28, 125, 1
18, 17, 99, 94, 0, 68, 65, 0, 24, 25, 0, | 560 255, 243, 51, 232, 215, 51, 204, 191, 43, 176, 165, 38, 150, 142, 28, 125, 1
18, 17, 99, 94, 0, 68, 65, 0, 24, 25, 0, |
| 561 255, 241, 0, 231, 215, 0, 203, 190, 0, 176, 164, 0, 150, 141, 0, 126, 1
17, 0, 99, 93, 0, 68, 65, 0, 24, 25, 0, | 561 255, 241, 0, 231, 215, 0, 203, 190, 0, 176, 164, 0, 150, 141, 0, 126, 1
17, 0, 99, 93, 0, 68, 65, 0, 24, 25, 0, |
| 562 252, 228, 238, 222, 201, 211, 197, 180, 190, 171, 156, 166, 147, 133, 143, 1
23, 111, 119, 99, 88, 94, 71, 61, 66, 34, 22, 26, | 562 252, 228, 238, 222, 201, 211, 197, 180, 190, 171, 156, 166, 147, 133, 143, 1
23, 111, 119, 99, 88, 94, 71, 61, 66, 34, 22, 26, |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 46, 48, 146, 42, 40, 131, 36, 32, 118, 27, 22, 103, 17, 6, 88, 5, 0,
73, 0, 0, 55, 0, 0, 33, 0, 0, 0, | 1273 46, 48, 146, 42, 40, 131, 36, 32, 118, 27, 22, 103, 17, 6, 88, 5, 0,
73, 0, 0, 55, 0, 0, 33, 0, 0, 0, |
| 1274 48, 48, 133, 44, 40, 119, 37, 32, 107, 28, 22, 93, 20, 8, 79, 7, 0,
65, 0, 0, 49, 0, 0, 27, 0, 0, 0, | 1274 48, 48, 133, 44, 40, 119, 37, 32, 107, 28, 22, 93, 20, 8, 79, 7, 0,
65, 0, 0, 49, 0, 0, 27, 0, 0, 0, |
| 1275 48, 50, 123, 44, 41, 109, 37, 33, 97, 30, 23, 83, 21, 11, 71, 8, 0, 5
8, 0, 0, 42, 0, 0, 21, 0, 0, 0, | 1275 48, 50, 123, 44, 41, 109, 37, 33, 97, 30, 23, 83, 21, 11, 71, 8, 0, 5
8, 0, 0, 42, 0, 0, 21, 0, 0, 0, |
| 1276 49, 51, 111, 45, 42, 99, 38, 34, 87, 29, 25, 75, 20, 13, 63, 8, 0, 51
, 0, 0, 36, 0, 0, 14, 0, 0, 0, | 1276 49, 51, 111, 45, 42, 99, 38, 34, 87, 29, 25, 75, 20, 13, 63, 8, 0, 51
, 0, 0, 36, 0, 0, 14, 0, 0, 0, |
| 1277 52, 52, 100, 44, 43, 89, 38, 35, 79, 29, 26, 68, 19, 15, 56, 10, 1, 43
, 0, 0, 28, 0, 0, 6, 0, 0, 0, | 1277 52, 52, 100, 44, 43, 89, 38, 35, 79, 29, 26, 68, 19, 15, 56, 10, 1, 43
, 0, 0, 28, 0, 0, 6, 0, 0, 0, |
| 1278 52, 52, 90, 47, 44, 79, 39, 36, 70, 30, 27, 59, 20, 16, 47, 9, 2, 36,
0, 0, 22, 0, 0, 2, 0, 0, 0, | 1278 52, 52, 90, 47, 44, 79, 39, 36, 70, 30, 27, 59, 20, 16, 47, 9, 2, 36,
0, 0, 22, 0, 0, 2, 0, 0, 0, |
| 1279 52, 53, 78, 46, 44, 68, 39, 37, 60, 32, 27, 49, 22, 17, 39, 10, 3, 28,
0, 0, 12, 0, 0, 0, 0, 0, 0, | 1279 52, 53, 78, 46, 44, 68, 39, 37, 60, 32, 27, 49, 22, 17, 39, 10, 3, 28,
0, 0, 12, 0, 0, 0, 0, 0, 0, |
| 1280 53, 53, 66, 47, 44, 57, 40, 36, 48, 32, 27, 39, 22, 18, 30, 9, 4, 18,
0, 0, 3, 0, 0, 0, 0, 0, 0, | 1280 53, 53, 66, 47, 44, 57, 40, 36, 48, 32, 27, 39, 22, 18, 30, 9, 4, 18,
0, 0, 3, 0, 0, 0, 0, 0, 0, |
| 1281 54, 53, 57, 48, 45, 49, 41, 37, 41, 33, 28, 32, 22, 19, 23, 11, 6, 10,
1, 0, 0, 0, 0, 0, 0, 0, 0, | 1281 54, 53, 57, 48, 45, 49, 41, 37, 41, 33, 28, 32, 22, 19, 23, 11, 6, 10,
1, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1282 }; | 1282 }; |
| 1283 void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R,
FX_BYTE& G, FX_BYTE& B) | 1283 void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R,
uint8_t& G, uint8_t& B) |
| 1284 { | 1284 { |
| 1285 int fix_c = c << 8; | 1285 int fix_c = c << 8; |
| 1286 int fix_m = m << 8; | 1286 int fix_m = m << 8; |
| 1287 int fix_y = y << 8; | 1287 int fix_y = y << 8; |
| 1288 int fix_k = k << 8; | 1288 int fix_k = k << 8; |
| 1289 int c_index = (fix_c + 4096) >> 13; | 1289 int c_index = (fix_c + 4096) >> 13; |
| 1290 int m_index = (fix_m + 4096) >> 13; | 1290 int m_index = (fix_m + 4096) >> 13; |
| 1291 int y_index = (fix_y + 4096) >> 13; | 1291 int y_index = (fix_y + 4096) >> 13; |
| 1292 int k_index = (fix_k + 4096) >> 13; | 1292 int k_index = (fix_k + 4096) >> 13; |
| 1293 int pos = (c_index * 9 * 9 * 9 + m_index * 9 * 9 + y_index * 9 + k_index) *
3; | 1293 int pos = (c_index * 9 * 9 * 9 + m_index * 9 * 9 + y_index * 9 + k_index) *
3; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 } | 1350 } |
| 1351 if (fix_b < 0) { | 1351 if (fix_b < 0) { |
| 1352 fix_b = 0; | 1352 fix_b = 0; |
| 1353 } | 1353 } |
| 1354 R = fix_r >> 8; | 1354 R = fix_r >> 8; |
| 1355 G = fix_g >> 8; | 1355 G = fix_g >> 8; |
| 1356 B = fix_b >> 8; | 1356 B = fix_b >> 8; |
| 1357 } | 1357 } |
| 1358 void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT&
R, FX_FLOAT& G, FX_FLOAT& B) | 1358 void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT&
R, FX_FLOAT& G, FX_FLOAT& B) |
| 1359 { | 1359 { |
| 1360 FX_BYTE c1 = FXSYS_round(c * 255); | 1360 uint8_t c1 = FXSYS_round(c * 255); |
| 1361 FX_BYTE m1 = FXSYS_round(m * 255); | 1361 uint8_t m1 = FXSYS_round(m * 255); |
| 1362 FX_BYTE y1 = FXSYS_round(y * 255); | 1362 uint8_t y1 = FXSYS_round(y * 255); |
| 1363 FX_BYTE k1 = FXSYS_round(k * 255); | 1363 uint8_t k1 = FXSYS_round(k * 255); |
| 1364 FX_BYTE r, g, b; | 1364 uint8_t r, g, b; |
| 1365 AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); | 1365 AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); |
| 1366 R = 1.0f * r / 255; | 1366 R = 1.0f * r / 255; |
| 1367 G = 1.0f * g / 255; | 1367 G = 1.0f * g / 255; |
| 1368 B = 1.0f * b / 255; | 1368 B = 1.0f * b / 255; |
| 1369 } | 1369 } |
| OLD | NEW |