Loading...
Searching...
No Matches
Element.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3// Consult legal.txt regarding legal and license information.
4//---------------------------------------------------------------------------------------
5#ifndef PDFTRON_H_CPPPDFElement
6#define PDFTRON_H_CPPPDFElement
7
8#include <SDF/Obj.h>
9#include <PDF/GState.h>
10#include <PDF/Rect.h>
11#include <PDF/CharData.h>
12#include <PDF/PathData.h>
13#include <PDF/Struct/SElement.h>
14#include <C/PDF/TRN_Element.h>
15
16namespace pdftron {
17 namespace PDF {
18
19
32class Element
33{
34public:
35 // Common Methods ---------------------------------------------------------------
36
37 enum Type
38 {
39 e_null, // undefined element type
40 e_path, // path object
41 e_text_begin, // marks the beginning of a text container
42 e_text, // text object within a text container
43 e_text_new_line, // indicates the start of the new text line
44 e_text_end, // marks the end of text container
45 e_image, // image XObject
46 e_inline_image, // inline image object
47 e_shading, // shading object
48 e_form, // a form XObject
49 e_group_begin, // push graphics state operator (q)
50 e_group_end, // pop graphics state operator (Q)
51 e_marked_content_begin, // marks the beginning of marked content sequence (BMC, BDC)
52 e_marked_content_end, // marks the end of marked content sequence (EMC)
53 e_marked_content_point // designate a marked-content point (MP, DP)
54 };
55
57 Element(const Element& c);
59 operator bool () { return mp_elem!=0;}
60
65
70
76
98
99#ifndef SWIG
100 bool GetBBox(Rect& out_bbox);
101#endif
102
109
118
130
131 // Path Element (e_path) Get Methods --------------------------------------------
132
138
142 bool IsStroked();
143
147 bool IsFilled();
148
167
173
180
181 // Path Element (e_path) Set Methods --------------------------------------------
182
187 void SetPathData(const PathData& data);
188
193 void SetPathClip(bool clip);
194
199 void SetPathStroke(bool stroke);
200
205 void SetPathFill(bool fill);
206
212 void SetWindingFill(bool winding_rule);
213
219 void SetClipWindingFill(bool winding_rule);
220
221 // XObject Element (e_image or e_form_begin) Methods ----------------------------
222
227
228
229 // Image (e_image and e_inline_image) Element Methods ---------------------------
230
235
239 int GetImageDataSize() const;
240
252 #if defined(_WIN32)
253 Gdiplus::Bitmap* GetBitmap() const;
254 #endif
255
263
267 int GetImageWidth() const;
268
272 int GetImageHeight() const;
273
283
290
294 int GetComponentNum() const;
295
296
300 bool IsImageMask() const;
301
305 bool IsImageInterpolate() const;
306
315
320
321 // Text Element (e_text) Get Methods --------------------------------------------
322
341
356#ifdef SWIG
357 std::vector<unsigned char> GetTextData();
358#else
360#endif
361
366
371
403
419
430
431 // Text New Line Element (e_text_new_line) Methods ------------------------------
432
441
442#ifndef SWIG
443 void GetNewTextLineOffset(double& out_x, double& out_y);
444#endif
445
452 void SetNewTextLineOffset(double dx, double dy);
453
454
455 // Text Element (e_text and e_text_new_line) Methods ----------------------------
456
463
464
465 // Text Element (e_text) Set Methods --------------------------------------------
466
472 void SetTextData(const UChar* buf_text_data, int text_data_size);
473
480
500 void SetTextMatrix(double a, double b, double c, double d, double h, double v);
501
508 void SetPosAdjustment(double adjust);
509
520
521
522 // Shading Element (e_shading) Methods ------------------------------------------
523
528
529 // Marked Content Elements
530 // (e_marked_content_begin and e_marked_content_point) Methods ------------------
531
541
547
549
550
551// @cond PRIVATE_DOC
552#ifndef SWIGHIDDEN
553 Element(TRN_Element impl);
554 TRN_Element mp_elem;
555#endif
556// @endcond
557};
558
559
560#include <Impl/Element.inl>
561
562 }; // namespace PDF
563}; // namespace pdftron
564
565#endif // PDFTRON_H_CPPPDFElement
void SetPathStroke(bool stroke)
void SetNewTextLineOffset(double dx, double dy)
bool IsImageInterpolate() const
Filters::Filter GetImageData() const
const UChar * GetTextData()
bool GetBBox(Rect &out_bbox)
int GetImageWidth() const
SDF::Obj GetMCPropertyDict()
Element(const Element &c)
void GetNewTextLineOffset(double &out_x, double &out_y)
SDF::Obj GetMask() const
int GetImageDataSize() const
void SetWindingFill(bool winding_rule)
GState::RenderingIntent GetImageRenderingIntent() const
void SetClipWindingFill(bool winding_rule)
int GetComponentNum() const
CharIterator GetCharIterator()
void SetPathData(const PathData &data)
Struct::SElement GetParentStructElement()
PathData GetPathData() const
int GetBitsPerComponent() const
Element & operator=(const Element &c)
SDF::Obj GetDecodeArray() const
void SetTextMatrix(double a, double b, double c, double d, double h, double v)
void SetPathClip(bool clip)
Common::Matrix2D GetCTM()
void SetTextData(const UChar *buf_text_data, int text_data_size)
void SetPosAdjustment(double adjust)
int GetImageHeight() const
void SetTextMatrix(Common::Matrix2D &mtx)
void SetPathFill(bool fill)
bool IsImageMask() const
ColorSpace GetImageColorSpace() const
Common::Matrix2D GetTextMatrix()
Common::Iterator< TRN_CharData > CharIterator
Definition CharData.h:41
TRN_UInt32 UInt32
Definition BasicTypes.h:13
TRN_UChar UChar
Definition BasicTypes.h:12