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_PATTERNCS_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_PATTERNCS_H_ 9 10 #include <set> 11 12 #include "core/fpdfapi/page/cpdf_colorspace.h" 13 #include "core/fxcrt/retain_ptr.h" 14 15 class CPDF_Document; 16 17 class CPDF_PatternCS final : public CPDF_ColorSpace { 18 public: 19 template <typename T, typename... Args> 20 friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); 21 22 ~CPDF_PatternCS() override; 23 24 // Called for the stock pattern, since it is not initialized via 25 // CPDF_ColorSpace::Load(). 26 void InitializeStockPattern(); 27 28 // CPDF_ColorSpace: 29 bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; 30 bool GetPatternRGB(const PatternValue& value, 31 float* R, 32 float* G, 33 float* B) const override; 34 CPDF_PatternCS* AsPatternCS() override; 35 const CPDF_PatternCS* AsPatternCS() const override; 36 uint32_t v_Load(CPDF_Document* pDoc, 37 const CPDF_Array* pArray, 38 std::set<const CPDF_Object*>* pVisited) override; 39 40 private: 41 explicit CPDF_PatternCS(CPDF_Document* pDoc); 42 43 RetainPtr<CPDF_ColorSpace> m_pBaseCS; 44 }; 45 46 #endif // CORE_FPDFAPI_PAGE_CPDF_PATTERNCS_H_ 47