OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
| 7 #ifndef CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ |
| 8 #define CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ |
| 9 |
| 10 #include "core/fxcodec/include/fx_codec_def.h" |
| 11 #include "core/fxcrt/include/fx_string.h" |
| 12 #include "core/fxcrt/include/fx_system.h" |
| 13 |
| 14 class CFX_BinaryBuf; |
| 15 class CFX_IccProfileCache; |
| 16 class CFX_IccTransformCache; |
| 17 class CFX_PrivateData; |
| 18 class IFX_FileRead; |
| 19 |
| 20 class CCodec_IccModule { |
| 21 public: |
| 22 enum IccCS { |
| 23 IccCS_Unknown = 0, |
| 24 IccCS_XYZ, |
| 25 IccCS_Lab, |
| 26 IccCS_Luv, |
| 27 IccCS_YCbCr, |
| 28 IccCS_Yxy, |
| 29 IccCS_Hsv, |
| 30 IccCS_Hls, |
| 31 IccCS_Gray, |
| 32 IccCS_Rgb, |
| 33 IccCS_Cmyk, |
| 34 IccCS_Cmy |
| 35 }; |
| 36 |
| 37 struct IccParam { |
| 38 uint32_t Version; |
| 39 IccCS ColorSpace; |
| 40 uint32_t dwProfileType; |
| 41 uint32_t dwFormat; |
| 42 uint8_t* pProfileData; |
| 43 uint32_t dwProfileSize; |
| 44 double Gamma; |
| 45 }; |
| 46 |
| 47 ~CCodec_IccModule(); |
| 48 |
| 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, |
| 59 uint32_t dwProfileSize, |
| 60 uint32_t& nComponents, |
| 61 int32_t intent = 0, |
| 62 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); |
| 72 void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); |
| 73 void TranslateScanline(void* pTransform, |
| 74 uint8_t* pDest, |
| 75 const uint8_t* pSrc, |
| 76 int pixels); |
| 77 void SetComponents(uint32_t nComponents) { m_nComponents = nComponents; } |
| 78 |
| 79 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; |
| 91 std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform; |
| 92 std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile; |
| 93 }; |
| 94 |
| 95 #endif // CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ |
OLD | NEW |