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