OLD | NEW |
| (Empty) |
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_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ | |
8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ | |
9 | |
10 #include <memory> | |
11 #include <vector> | |
12 | |
13 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" | |
14 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" | |
15 #include "core/fxcrt/fx_system.h" | |
16 | |
17 enum ShadingType { | |
18 kInvalidShading = 0, | |
19 kFunctionBasedShading = 1, | |
20 kAxialShading = 2, | |
21 kRadialShading = 3, | |
22 kFreeFormGouraudTriangleMeshShading = 4, | |
23 kLatticeFormGouraudTriangleMeshShading = 5, | |
24 kCoonsPatchMeshShading = 6, | |
25 kTensorProductPatchMeshShading = 7, | |
26 kMaxShading = 8 | |
27 }; | |
28 | |
29 class CFX_Matrix; | |
30 class CPDF_ColorSpace; | |
31 class CPDF_Document; | |
32 class CPDF_Function; | |
33 class CPDF_Object; | |
34 | |
35 class CPDF_ShadingPattern : public CPDF_Pattern { | |
36 public: | |
37 CPDF_ShadingPattern(CPDF_Document* pDoc, | |
38 CPDF_Object* pPatternObj, | |
39 FX_BOOL bShading, | |
40 const CFX_Matrix& parentMatrix); | |
41 ~CPDF_ShadingPattern() override; | |
42 | |
43 CPDF_TilingPattern* AsTilingPattern() override; | |
44 CPDF_ShadingPattern* AsShadingPattern() override; | |
45 | |
46 bool IsMeshShading() const { | |
47 return m_ShadingType == kFreeFormGouraudTriangleMeshShading || | |
48 m_ShadingType == kLatticeFormGouraudTriangleMeshShading || | |
49 m_ShadingType == kCoonsPatchMeshShading || | |
50 m_ShadingType == kTensorProductPatchMeshShading; | |
51 } | |
52 bool Load(); | |
53 | |
54 ShadingType GetShadingType() const { return m_ShadingType; } | |
55 FX_BOOL IsShadingObject() const { return m_bShadingObj; } | |
56 CPDF_Object* GetShadingObject() const { return m_pShadingObj; } | |
57 CPDF_ColorSpace* GetCS() const { return m_pCS; } | |
58 const std::vector<std::unique_ptr<CPDF_Function>>& GetFuncs() const { | |
59 return m_pFunctions; | |
60 } | |
61 | |
62 private: | |
63 ShadingType m_ShadingType; | |
64 FX_BOOL m_bShadingObj; | |
65 CPDF_Object* m_pShadingObj; | |
66 | |
67 // Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed | |
68 // as counted objects. Refer to CPDF_DocPageData::GetColorSpace. | |
69 CPDF_ColorSpace* m_pCS; | |
70 | |
71 CPDF_CountedColorSpace* m_pCountedCS; | |
72 std::vector<std::unique_ptr<CPDF_Function>> m_pFunctions; | |
73 }; | |
74 | |
75 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ | |
OLD | NEW |