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_FPDFAPI_PAGE_CPDF_COLOR_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_COLOR_H_ 9 10 #include "core/fpdfapi/page/cpdf_colorspace.h" 11 #include "core/fxcrt/fx_system.h" 12 13 class CPDF_Pattern; 14 15 class CPDF_Color { 16 public: 17 CPDF_Color(); 18 ~CPDF_Color(); 19 IsNull()20 bool IsNull() const { return !m_pBuffer; } 21 bool IsPattern() const; 22 23 void Copy(const CPDF_Color* pSrc); 24 25 void SetColorSpace(CPDF_ColorSpace* pCS); 26 void SetValue(FX_FLOAT* comp); 27 void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps); 28 29 bool GetRGB(int& R, int& G, int& B) const; 30 CPDF_Pattern* GetPattern() const; GetColorSpace()31 const CPDF_ColorSpace* GetColorSpace() const { return m_pCS; } 32 33 protected: 34 void ReleaseBuffer(); 35 void ReleaseColorSpace(); 36 37 CPDF_ColorSpace* m_pCS; 38 FX_FLOAT* m_pBuffer; 39 }; 40 41 #endif // CORE_FPDFAPI_PAGE_CPDF_COLOR_H_ 42