All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ElementBuilder.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2020 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFElementBuilder
6 #define PDFTRON_H_CPPPDFElementBuilder
7 
8 #include <PDF/Page.h>
9 #include <PDF/Element.h>
10 #include <Common/Matrix2D.h>
11 #include <PDF/Image.h>
12 #include <PDF/Shading.h>
13 #include <PDF/PDFDoc.h>
14 #include <PDF/ShapedText.h>
15 #include <C/PDF/TRN_ElementBuilder.h>
16 
17 namespace pdftron {
18  namespace PDF {
19 
20 
34 {
35 public:
36 
39 
56  void Reset(GState gs = 0);
57 
58  // Image Element ------------------------------------------------
59 
65 
71  Element CreateImage(Image& img, const Common::Matrix2D& mtx);
72 
82  Element CreateImage(Image& img, double x, double y, double hscale, double vscale);
83 
89 
95 
102 
108 
117  Element CreateForm(Page page);
118 
127  Element CreateForm(Page page, class PDFDoc& doc);
128 
135  Element CreateTextBegin(Font font, double font_sz);
136 
141 
146 
151  Element CreateTextRun(const char* text_data, Font font, double font_sz);
152 #ifndef SWIG
153  Element CreateTextRun(const char* text_data, UInt32 text_data_sz, Font font, double font_sz);
154  Element CreateTextRun(const UChar* text_data, UInt32 text_data_sz, Font font, double font_sz);
155 #endif
156 
162  Element CreateTextRun(const char* text_data);
163 #ifndef SWIG
164  Element CreateTextRun(const char* text_data, UInt32 text_data_sz);
165  Element CreateTextRun(const UChar* text_data, UInt32 text_data_sz);
166 #endif
167 
179  Element CreateUnicodeTextRun(const Unicode* text_data, UInt32 text_data_sz);
180 
196 
206  Element CreateTextNewLine(double dx, double dy);
207 
213 
214  // Path Element -------------------------------------------------
215 
220  Element CreatePath(const std::vector<double>& points, const std::vector<unsigned char>& seg_types);
221 
222 #ifndef SWIG
223  Element CreatePath(const double* points, int point_count, const char* seg_types, int seg_types_count);
224 #endif
225 
235  Element CreateRect(double x, double y, double width, double height);
236 
246  Element CreateEllipse(double x, double y, double width, double height);
247 
252  void PathBegin();
253 
258  Element PathEnd();
259 
265  void MoveTo(double x, double y);
266 
272  void LineTo(double x, double y);
273 
284  void CurveTo(double cx1, double cy1, double cx2, double cy2, double x2, double y2);
285 
296  void ArcTo(double x, double y, double width, double height, double start, double extent);
297 
314  void ArcTo(double xr, double yr,
315  double rx,
316  bool isLargeArc,
317  bool sweep,
318  double endX, double endY);
319 
329  void Ellipse(double x, double y, double width, double height);
330 
340  void Rect(double x, double y, double width, double height);
341 
345  void ClosePath();
346 
350  void Destroy();
351 
352 // @cond PRIVATE_DOC
353 #ifndef SWIGHIDDEN
354  TRN_ElementBuilder mp_builder;
355 #endif
356 private:
357  // ElementBuilder should not be copied
359  ElementBuilder& operator= (const ElementBuilder&);
360 // @endcond
361 };
362 
363 
364 #include <Impl/ElementBuilder.inl>
365 
366  }; // namespace PDF
367 }; // namespace pdftron
368 
369 
370 #endif // PDFTRON_H_CPPPDFElementBuilder
void MoveTo(double x, double y)
Element CreateShapedTextRun(ShapedText text_data)
Element CreateImage(Image &img)
Element CreateEllipse(double x, double y, double width, double height)
Element CreateTextRun(const char *text_data, Font font, double font_sz)
Element CreateForm(SDF::Obj form)
void CurveTo(double cx1, double cy1, double cx2, double cy2, double x2, double y2)
Element CreateRect(double x, double y, double width, double height)
TRN_Unicode Unicode
Definition: BasicTypes.h:22
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
void LineTo(double x, double y)
TRN_UChar UChar
Definition: BasicTypes.h:12
Element CreatePath(const std::vector< double > &points, const std::vector< unsigned char > &seg_types)
void Ellipse(double x, double y, double width, double height)
void Rect(double x, double y, double width, double height)
Element CreateUnicodeTextRun(const Unicode *text_data, UInt32 text_data_sz)
void ArcTo(double x, double y, double width, double height, double start, double extent)
Element CreateShading(Shading &sh)