| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ | 7 #ifndef CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ |
| 8 #define CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ | 8 #define CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ |
| 9 | 9 |
| 10 #include "core/fxcodec/include/fx_codec_def.h" | 10 #include "core/fxcodec/include/fx_codec_def.h" |
| 11 #include "core/fxcrt/include/fx_string.h" | 11 #include "core/fxcrt/include/fx_string.h" |
| 12 #include "core/fxcrt/include/fx_system.h" | 12 #include "core/fxcrt/include/fx_system.h" |
| 13 | 13 |
| 14 class CFX_BinaryBuf; | |
| 15 class CFX_IccProfileCache; | |
| 16 class CFX_IccTransformCache; | |
| 17 class IFX_FileRead; | |
| 18 | |
| 19 class CCodec_IccModule { | 14 class CCodec_IccModule { |
| 20 public: | 15 public: |
| 21 enum IccCS { | |
| 22 IccCS_Unknown = 0, | |
| 23 IccCS_XYZ, | |
| 24 IccCS_Lab, | |
| 25 IccCS_Luv, | |
| 26 IccCS_YCbCr, | |
| 27 IccCS_Yxy, | |
| 28 IccCS_Hsv, | |
| 29 IccCS_Hls, | |
| 30 IccCS_Gray, | |
| 31 IccCS_Rgb, | |
| 32 IccCS_Cmyk, | |
| 33 IccCS_Cmy | |
| 34 }; | |
| 35 | |
| 36 struct IccParam { | |
| 37 uint32_t Version; | |
| 38 IccCS ColorSpace; | |
| 39 uint32_t dwProfileType; | |
| 40 uint32_t dwFormat; | |
| 41 uint8_t* pProfileData; | |
| 42 uint32_t dwProfileSize; | |
| 43 double Gamma; | |
| 44 }; | |
| 45 | |
| 46 CCodec_IccModule(); | 16 CCodec_IccModule(); |
| 47 ~CCodec_IccModule(); | 17 ~CCodec_IccModule(); |
| 48 | 18 |
| 49 IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize); | |
| 50 IccCS GetProfileCS(IFX_FileRead* pFile); | |
| 51 void* CreateTransform(CCodec_IccModule::IccParam* pInputParam, | |
| 52 CCodec_IccModule::IccParam* pOutputParam, | |
| 53 CCodec_IccModule::IccParam* pProofParam = nullptr, | |
| 54 uint32_t dwIntent = Icc_INTENT_PERCEPTUAL, | |
| 55 uint32_t dwFlag = Icc_FLAGS_DEFAULT, | |
| 56 uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, | |
| 57 uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING); | |
| 58 void* CreateTransform_sRGB(const uint8_t* pProfileData, | 19 void* CreateTransform_sRGB(const uint8_t* pProfileData, |
| 59 uint32_t dwProfileSize, | 20 uint32_t dwProfileSize, |
| 60 uint32_t& nComponents, | 21 uint32_t& nComponents, |
| 61 int32_t intent = 0, | 22 int32_t intent = 0, |
| 62 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); | 23 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); |
| 63 void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, | |
| 64 uint32_t dwSrcProfileSize, | |
| 65 uint32_t& nSrcComponents, | |
| 66 const uint8_t* pDstProfileData, | |
| 67 uint32_t dwDstProfileSize, | |
| 68 int32_t intent = 0, | |
| 69 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, | |
| 70 uint32_t dwDstFormat = Icc_FORMAT_DEFAULT); | |
| 71 void DestroyTransform(void* pTransform); | 24 void DestroyTransform(void* pTransform); |
| 72 void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); | 25 void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); |
| 73 void TranslateScanline(void* pTransform, | 26 void TranslateScanline(void* pTransform, |
| 74 uint8_t* pDest, | 27 uint8_t* pDest, |
| 75 const uint8_t* pSrc, | 28 const uint8_t* pSrc, |
| 76 int pixels); | 29 int pixels); |
| 77 void SetComponents(uint32_t nComponents) { m_nComponents = nComponents; } | 30 void SetComponents(uint32_t nComponents) { m_nComponents = nComponents; } |
| 78 | 31 |
| 79 protected: | 32 protected: |
| 80 enum Icc_CLASS { | |
| 81 Icc_CLASS_INPUT = 0, | |
| 82 Icc_CLASS_OUTPUT, | |
| 83 Icc_CLASS_PROOF, | |
| 84 Icc_CLASS_MAX | |
| 85 }; | |
| 86 void* CreateProfile(CCodec_IccModule::IccParam* pIccParam, | |
| 87 Icc_CLASS ic, | |
| 88 CFX_BinaryBuf* pTransformKey); | |
| 89 | |
| 90 uint32_t m_nComponents; | 33 uint32_t m_nComponents; |
| 91 std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform; | |
| 92 std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile; | |
| 93 }; | 34 }; |
| 94 | 35 |
| 95 #endif // CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ | 36 #endif // CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ |
| OLD | NEW |