1 // Copyright 2017 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_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/observed_ptr.h" 13 #include "core/fxcrt/retain_ptr.h" 14 #include "third_party/base/span.h" 15 16 class CPDF_Stream; 17 18 namespace fxcodec { 19 class CLcmsCmm; 20 } // namespace fxcodec 21 22 class CPDF_IccProfile final : public Retainable, public Observable { 23 public: 24 template <typename T, typename... Args> 25 friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); 26 GetStream()27 const CPDF_Stream* GetStream() const { return m_pStream.Get(); } IsValid()28 bool IsValid() const { return IsSRGB() || IsSupported(); } IsSRGB()29 bool IsSRGB() const { return m_bsRGB; } IsSupported()30 bool IsSupported() const { return !!m_Transform; } transform()31 fxcodec::CLcmsCmm* transform() { return m_Transform.get(); } GetComponents()32 uint32_t GetComponents() const { return m_nSrcComponents; } 33 34 private: 35 CPDF_IccProfile(const CPDF_Stream* pStream, pdfium::span<const uint8_t> span); 36 ~CPDF_IccProfile() override; 37 38 const bool m_bsRGB; 39 uint32_t m_nSrcComponents = 0; 40 RetainPtr<const CPDF_Stream> const m_pStream; 41 std::unique_ptr<fxcodec::CLcmsCmm> m_Transform; 42 }; 43 44 #endif // CORE_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_ 45