1 // Copyright 2016 The PDFium Authors 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_ICC_ICC_TRANSFORM_H_ 8 #define CORE_FXCODEC_ICC_ICC_TRANSFORM_H_ 9 10 #include <stdint.h> 11 12 #include <memory> 13 14 #include "core/fxcodec/fx_codec_def.h" 15 #include "third_party/base/containers/span.h" 16 17 #if defined(USE_SYSTEM_LCMS2) 18 #include <lcms2.h> 19 #else 20 #include "third_party/lcms/include/lcms2.h" 21 #endif 22 23 namespace fxcodec { 24 25 class IccTransform { 26 public: 27 static std::unique_ptr<IccTransform> CreateTransformSRGB( 28 pdfium::span<const uint8_t> span); 29 30 ~IccTransform(); 31 32 void Translate(pdfium::span<const float> pSrcValues, 33 pdfium::span<float> pDestValues); 34 void TranslateScanline(pdfium::span<uint8_t> pDest, 35 pdfium::span<const uint8_t> pSrc, 36 int pixels); 37 components()38 int components() const { return m_nSrcComponents; } IsNormal()39 bool IsNormal() const { return m_bNormal; } 40 41 private: 42 IccTransform(cmsHTRANSFORM transform, 43 int srcComponents, 44 bool bIsLab, 45 bool bNormal); 46 47 const cmsHTRANSFORM m_hTransform; 48 const int m_nSrcComponents; 49 const bool m_bLab; 50 const bool m_bNormal; 51 }; 52 53 } // namespace fxcodec 54 55 #endif // CORE_FXCODEC_ICC_ICC_TRANSFORM_H_ 56