• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core/fxcrt/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   static bool IsValidIccComponents(int components);
42 
43  private:
44   IccTransform(cmsHTRANSFORM transform,
45                int srcComponents,
46                bool bIsLab,
47                bool bNormal);
48 
49   const cmsHTRANSFORM m_hTransform;
50   const int m_nSrcComponents;
51   const bool m_bLab;
52   const bool m_bNormal;
53 };
54 
55 }  // namespace fxcodec
56 
57 #endif  // CORE_FXCODEC_ICC_ICC_TRANSFORM_H_
58