47 RetainPtr<CPDF_Dictionary> pPageResources,
48 RetainPtr<CPDF_Dictionary> pParentResources,
57 uint32_t
Parse(pdfium::span<
const uint8_t> pData,
58 uint32_t start_offset,
60 const std::vector<uint32_t>& stream_start_offsets);
64 pdfium::span<
const float>
GetType3Data()
const {
return m_Type3Data; }
71 enum class RenderType :
bool { kFill =
false, kStroke =
true };
74 enum class Type : uint8_t { kObject = 0, kNumber, kName };
79 Type m_Type = Type::kObject;
85 static constexpr int kParamBufSize = 16;
87 void AddNameParam(ByteStringView bsName);
88 void AddNumberParam(ByteStringView str);
90 int GetNextParamPos();
91 void ClearAllParams();
93 ByteString GetString(uint32_t index)
const;
94 float GetNumber(uint32_t index)
const;
97 std::vector<
float> GetNumbers(size_t count)
const;
98 int GetInteger(uint32_t index)
const {
99 return static_cast<
int>(GetNumber(index));
102 CFX_PointF GetPoint(uint32_t index)
const;
105 void OnOperator(ByteStringView op);
106 void AddTextObject(
const ByteString* pStrs,
108 const std::vector<
float>& kernings,
110 float GetHorizontalTextSize(
float fKerning)
const;
111 float GetVerticalTextSize(
float fKerning)
const;
113 void OnChangeTextMatrix();
114 void ParsePathObject();
116 void AddPathPointAndClose(
const CFX_PointF& point,
118 void AddPathRect(
float x,
float y,
float w,
float h);
120 RenderType render_type);
121 CPDF_ImageObject* AddImageFromStream(
RetainPtr<CPDF_Stream> pStream,
122 const ByteString& name);
123 CPDF_ImageObject* AddImageFromStreamObjNum(uint32_t stream_obj_num,
124 const ByteString& name);
125 CPDF_ImageObject* AddLastImage();
127 void AddForm(
RetainPtr<CPDF_Stream> pStream,
const ByteString& name);
134 RetainPtr<CPDF_ShadingPattern> FindShading(
const ByteString& name);
135 RetainPtr<CPDF_Dictionary> FindResourceHolder(
const ByteString& type);
137 const ByteString& name);
140 CPDF_ImageObject* AddImageObject(std::unique_ptr<CPDF_ImageObject> pImageObj);
142 std::vector<
float> GetColors()
const;
143 std::vector<
float> GetNamedColors()
const;
144 int32_t GetCurrentStreamIndex();
146 void Handle_CloseFillStrokePath();
147 void Handle_FillStrokePath();
148 void Handle_CloseEOFillStrokePath();
149 void Handle_EOFillStrokePath();
150 void Handle_BeginMarkedContent_Dictionary();
151 void Handle_BeginImage();
152 void Handle_BeginMarkedContent();
153 void Handle_BeginText();
154 void Handle_CurveTo_123();
155 void Handle_ConcatMatrix();
156 void Handle_SetColorSpace_Fill();
157 void Handle_SetColorSpace_Stroke();
158 void Handle_SetDash();
159 void Handle_SetCharWidth();
160 void Handle_SetCachedDevice();
161 void Handle_ExecuteXObject();
162 void Handle_MarkPlace_Dictionary();
163 void Handle_EndImage();
164 void Handle_EndMarkedContent();
165 void Handle_EndText();
166 void Handle_FillPath();
167 void Handle_FillPathOld();
168 void Handle_EOFillPath();
169 void Handle_SetGray_Fill();
170 void Handle_SetGray_Stroke();
171 void Handle_SetExtendGraphState();
172 void Handle_ClosePath();
173 void Handle_SetFlat();
174 void Handle_BeginImageData();
175 void Handle_SetLineJoin();
176 void Handle_SetLineCap();
177 void Handle_SetCMYKColor_Fill();
178 void Handle_SetCMYKColor_Stroke();
179 void Handle_LineTo();
180 void Handle_MoveTo();
181 void Handle_SetMiterLimit();
182 void Handle_MarkPlace();
183 void Handle_EndPath();
184 void Handle_SaveGraphState();
185 void Handle_RestoreGraphState();
186 void Handle_Rectangle();
187 void Handle_SetRGBColor_Fill();
188 void Handle_SetRGBColor_Stroke();
189 void Handle_SetRenderIntent();
190 void Handle_CloseStrokePath();
191 void Handle_StrokePath();
192 void Handle_SetColor_Fill();
193 void Handle_SetColor_Stroke();
194 void Handle_SetColorPS_Fill();
195 void Handle_SetColorPS_Stroke();
196 void Handle_ShadeFill();
197 void Handle_SetCharSpace();
198 void Handle_MoveTextPoint();
199 void Handle_MoveTextPoint_SetLeading();
200 void Handle_SetFont();
201 void Handle_ShowText();
202 void Handle_ShowText_Positioning();
203 void Handle_SetTextLeading();
204 void Handle_SetTextMatrix();
205 void Handle_SetTextRenderMode();
206 void Handle_SetTextRise();
207 void Handle_SetWordSpace();
208 void Handle_SetHorzScale();
209 void Handle_MoveToNextLine();
210 void Handle_CurveTo_23();
211 void Handle_SetLineWidth();
213 void Handle_EOClip();
214 void Handle_CurveTo_13();
215 void Handle_NextLineShowText();
216 void Handle_NextLineShowText_Space();
217 void Handle_Invalid();
220 RetainPtr<CPDF_Dictionary>
const m_pPageResources;
221 RetainPtr<CPDF_Dictionary>
const m_pParentResources;
222 RetainPtr<CPDF_Dictionary>
const m_pResources;
227 uint32_t m_ParamStartPos = 0;
228 uint32_t m_ParamCount = 0;
229 std::unique_ptr<CPDF_StreamParser> m_pSyntax;
230 std::unique_ptr<CPDF_AllStates> m_pCurStates;
231 std::stack<std::unique_ptr<CPDF_ContentMarks>> m_ContentMarksStack;
232 std::vector<std::unique_ptr<CPDF_TextObject>> m_ClipTextList;
233 std::vector<CFX_Path::Point> m_PathPoints;
234 CFX_PointF m_PathStart;
235 CFX_PointF m_PathCurrent;
238 ByteString m_LastImageName;
240 bool m_bColored =
false;
241 std::vector<std::unique_ptr<CPDF_AllStates>> m_StateStack;
242 float m_Type3Data[6] = {0.0f};
243 ContentParam m_ParamBuf[kParamBufSize];
247 std::vector<uint32_t> m_StreamStartOffsets;
250 uint32_t m_StartParseOffset = 0;
CPDF_StreamContentParser(CPDF_Document *pDoc, RetainPtr< CPDF_Dictionary > pPageResources, RetainPtr< CPDF_Dictionary > pParentResources, const CFX_Matrix *pmtContentToUser, CPDF_PageObjectHolder *pObjHolder, RetainPtr< CPDF_Dictionary > pResources, const CFX_FloatRect &rcBBox, const CPDF_AllStates *pStates, CPDF_Form::RecursionState *parse_state)
uint32_t Parse(pdfium::span< const uint8_t > pData, uint32_t start_offset, uint32_t max_cost, const std::vector< uint32_t > &stream_start_offsets)
pdfium::span< const float > GetType3Data() const
CPDF_PageObjectHolder * GetPageObjectHolder() const
static ByteStringView FindValueAbbreviationForTesting(ByteStringView abbr)
RetainPtr< CPDF_Font > FindFont(const ByteString &name)
static ByteStringView FindKeyAbbreviationForTesting(ByteStringView abbr)