OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ |
8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ |
9 | 9 |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.h" |
11 #include "core/fxcrt/include/fx_system.h" | 11 #include "core/fxcrt/include/fx_system.h" |
12 | 12 |
13 class CPDF_Pattern; | 13 class CPDF_Pattern; |
14 | 14 |
15 class CPDF_Color { | 15 class CPDF_Color { |
16 public: | 16 public: |
17 CPDF_Color() : m_pCS(nullptr), m_pBuffer(nullptr) {} | 17 CPDF_Color(); |
18 explicit CPDF_Color(int family); | |
19 ~CPDF_Color(); | 18 ~CPDF_Color(); |
20 | 19 |
21 FX_BOOL IsNull() const { return !m_pBuffer; } | 20 bool IsNull() const { return !m_pBuffer; } |
22 FX_BOOL IsEqual(const CPDF_Color& other) const; | 21 bool IsPattern() const; |
23 FX_BOOL IsPattern() const { | |
24 return m_pCS && m_pCS->GetFamily() == PDFCS_PATTERN; | |
25 } | |
26 | 22 |
27 void Copy(const CPDF_Color* pSrc); | 23 void Copy(const CPDF_Color* pSrc); |
28 | 24 |
29 void SetColorSpace(CPDF_ColorSpace* pCS); | 25 void SetColorSpace(CPDF_ColorSpace* pCS); |
30 void SetValue(FX_FLOAT* comp); | 26 void SetValue(FX_FLOAT* comp); |
31 void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps); | 27 void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps); |
32 | 28 |
33 FX_BOOL GetRGB(int& R, int& G, int& B) const; | 29 FX_BOOL GetRGB(int& R, int& G, int& B) const; |
34 CPDF_Pattern* GetPattern() const; | 30 CPDF_Pattern* GetPattern() const; |
35 CPDF_ColorSpace* GetPatternCS() const; | 31 const CPDF_ColorSpace* GetColorSpace() const { return m_pCS; } |
36 FX_FLOAT* GetPatternColor() const; | |
37 | |
38 CPDF_ColorSpace* m_pCS; | |
39 | 32 |
40 protected: | 33 protected: |
41 void ReleaseBuffer(); | 34 void ReleaseBuffer(); |
42 void ReleaseColorSpace(); | 35 void ReleaseColorSpace(); |
43 | 36 |
| 37 CPDF_ColorSpace* m_pCS; |
44 FX_FLOAT* m_pBuffer; | 38 FX_FLOAT* m_pBuffer; |
45 }; | 39 }; |
46 | 40 |
47 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ | 41 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ |
OLD | NEW |