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_MESHSTREAM_H_ | |
8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ | |
9 | |
10 #include <memory> | |
11 #include <vector> | |
12 | |
13 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | |
14 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" | |
15 #include "core/fxcrt/fx_basic.h" | |
16 #include "core/fxcrt/fx_system.h" | |
17 | |
18 struct CPDF_MeshVertex { | |
19 FX_FLOAT x; | |
20 FX_FLOAT y; | |
21 FX_FLOAT r; | |
22 FX_FLOAT g; | |
23 FX_FLOAT b; | |
24 }; | |
25 | |
26 class CFX_Matrix; | |
27 class CPDF_ColorSpace; | |
28 class CPDF_Function; | |
29 class CPDF_Stream; | |
30 | |
31 class CPDF_MeshStream { | |
32 public: | |
33 CPDF_MeshStream(ShadingType type, | |
34 const std::vector<std::unique_ptr<CPDF_Function>>& funcs, | |
35 CPDF_Stream* pShadingStream, | |
36 CPDF_ColorSpace* pCS); | |
37 | |
38 bool Load(); | |
39 | |
40 uint32_t GetFlag(); | |
41 void GetCoords(FX_FLOAT& x, FX_FLOAT& y); | |
42 void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b); | |
43 | |
44 uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap); | |
45 FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex, | |
46 int count, | |
47 CFX_Matrix* pObject2Bitmap); | |
48 | |
49 CFX_BitStream* BitStream() { return &m_BitStream; } | |
50 uint32_t ComponentBits() const { return m_nComponentBits; } | |
51 uint32_t Components() const { return m_nComponents; } | |
52 | |
53 private: | |
54 static const uint32_t kMaxComponents = 8; | |
55 | |
56 const ShadingType m_type; | |
57 const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs; | |
58 CPDF_Stream* const m_pShadingStream; | |
59 CPDF_ColorSpace* const m_pCS; | |
60 uint32_t m_nCoordBits; | |
61 uint32_t m_nComponentBits; | |
62 uint32_t m_nFlagBits; | |
63 uint32_t m_nComponents; | |
64 uint32_t m_CoordMax; | |
65 uint32_t m_ComponentMax; | |
66 FX_FLOAT m_xmin; | |
67 FX_FLOAT m_xmax; | |
68 FX_FLOAT m_ymin; | |
69 FX_FLOAT m_ymax; | |
70 FX_FLOAT m_ColorMin[kMaxComponents]; | |
71 FX_FLOAT m_ColorMax[kMaxComponents]; | |
72 CPDF_StreamAcc m_Stream; | |
73 CFX_BitStream m_BitStream; | |
74 }; | |
75 | |
76 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ | |
OLD | NEW |