Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_meshstream.h
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
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_MESHSTREAM_H_
8#define CORE_FPDFAPI_PAGE_CPDF_MESHSTREAM_H_
9
10#include <stdint.h>
11
12#include <memory>
13#include <tuple>
14#include <vector>
15
16#include "core/fpdfapi/page/cpdf_shadingpattern.h"
17#include "core/fxcrt/retain_ptr.h"
18
19class CPDF_StreamAcc;
20
22 public:
26
27 CFX_PointF position;
28 float r = 0.0f;
29 float g = 0.0f;
30 float b = 0.0f;
31};
32
33class CFX_BitStream;
34class CFX_Matrix;
35class CPDF_ColorSpace;
36class CPDF_Function;
37class CPDF_Stream;
38
40 public:
42 const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
43 RetainPtr<const CPDF_Stream> pShadingStream,
46
47 bool Load();
48 void SkipBits(uint32_t nbits);
49 void ByteAlign();
50
51 bool IsEOF() const;
52 bool CanReadFlag() const;
53 bool CanReadCoords() const;
54 bool CanReadColor() const;
55
56 uint32_t ReadFlag();
57 CFX_PointF ReadCoords();
58 std::tuple<float, float, float> ReadColor();
59
60 bool ReadVertex(const CFX_Matrix& pObject2Bitmap,
61 CPDF_MeshVertex* vertex,
62 uint32_t* flag);
63 std::vector<CPDF_MeshVertex> ReadVertexRow(const CFX_Matrix& pObject2Bitmap,
64 int count);
65
66 uint32_t ComponentBits() const { return m_nComponentBits; }
67 uint32_t Components() const { return m_nComponents; }
68
69 private:
70 static constexpr uint32_t kMaxComponents = 8;
71
72 const ShadingType m_type;
73 const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs;
74 RetainPtr<const CPDF_Stream> const m_pShadingStream;
75 RetainPtr<CPDF_ColorSpace> const m_pCS;
76 uint32_t m_nCoordBits = 0;
77 uint32_t m_nComponentBits = 0;
78 uint32_t m_nFlagBits = 0;
79 uint32_t m_nComponents = 0;
80 uint32_t m_CoordMax = 0;
81 uint32_t m_ComponentMax = 0;
82 float m_xmin = 0.0f;
83 float m_xmax = 0.0f;
84 float m_ymin = 0.0f;
85 float m_ymax = 0.0f;
86 RetainPtr<CPDF_StreamAcc> m_pStream;
87 std::unique_ptr<CFX_BitStream> m_BitStream;
88 float m_ColorMin[kMaxComponents] = {};
89 float m_ColorMax[kMaxComponents] = {};
90};
91
92#endif // CORE_FPDFAPI_PAGE_CPDF_MESHSTREAM_H_
CFX_PointF ReadCoords()
uint32_t ComponentBits() const
uint32_t Components() const
bool CanReadCoords() const
bool CanReadFlag() const
bool ReadVertex(const CFX_Matrix &pObject2Bitmap, CPDF_MeshVertex *vertex, uint32_t *flag)
void SkipBits(uint32_t nbits)
bool CanReadColor() const
CPDF_MeshStream(ShadingType type, const std::vector< std::unique_ptr< CPDF_Function > > &funcs, RetainPtr< const CPDF_Stream > pShadingStream, RetainPtr< CPDF_ColorSpace > pCS)
std::vector< CPDF_MeshVertex > ReadVertexRow(const CFX_Matrix &pObject2Bitmap, int count)
std::tuple< float, float, float > ReadColor()
CFX_PointF position
CPDF_MeshVertex(const CPDF_MeshVertex &)
@ kCoonsPatchMeshShading
@ kTensorProductPatchMeshShading
@ kLatticeFormGouraudTriangleMeshShading
@ kFreeFormGouraudTriangleMeshShading