All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PathData.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2023 by Apryse Software Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFPathData
6 #define PDFTRON_H_CPPPDFPathData
7 
8 #include <vector>
9 
10 namespace pdftron {
11  namespace PDF {
12 
19 class PathData
20 {
21 public:
26  {
27  // Start a new sub-path at the given (x,y) coordinate.
28  // Number of arguments: 2
29  e_moveto = 1,
30 
31  // A line from the current point to the given (x,y) coordinate which becomes
32  // the new current point.
33  // Number of arguments: 2
35 
36  // A cubic Bezier curve from the current point to (x,y) using (x1,y1) as
37  // the control point at the beginning of the curve and (x2,y2) as the control
38  // point at the end of the curve.
39  // Number of arguments: 6
41 
42  // A quadratic Bezier curve from the current point to (x,y) using (x1,y1) as
43  // the control point. Note that e_conicto does not appear in PDF content streams.
44  // This operator is only used to represent glyph outlines (e.g. PDF::Font::GetGlyphPath()
45  // may return a path containing e_conicto operator).
46  // Number of arguments: 4
48 
49  // A rectangle at the given (x,y) coordinate and the given width and height (w, h).
50  // Number of arguments: 4
52 
53  // Close the current subpath by drawing a straight line from the current point
54  // to current subpath's initial point.
55  // Number of arguments: 0
57  };
58 
62  PathData() : is_def(true), glyph_index(0) {};
63 
69  void SetOperators(const std::vector<unsigned char>& operators) {
70  oprs = operators;
71  };
72 
78  void SetPoints(const std::vector<double>& points) {
79  pts = points;
80  };
81 
87 #ifdef SWIG
88  std::vector<unsigned char> GetOperators() const {
89  return oprs;
90  };
91 #else
92  const std::vector<unsigned char>& GetOperators() const {
93  return oprs;
94  };
95 #endif
96 
102 #ifdef SWIG
103  std::vector<double> GetPoints() const {
104  return pts;
105  };
106 #else
107  const std::vector<double>& GetPoints() const {
108  return pts;
109  };
110 #endif
111 
121  bool IsDefined() const {
122  return is_def;
123  };
124 
128  int GetGlyphIndex() const {
129  return glyph_index;
130  }
131 
132 
133 
134 // @cond PRIVATE_DOC
135 
136 #ifndef SWIGHIDDEN
137  bool is_def;
138  int glyph_index;
139  std::vector<unsigned char> oprs;
140  std::vector<double> pts;
141  PathData(bool i, int gi, const std::vector<unsigned char>& o, const std::vector<double>& d) : is_def(i), glyph_index(gi), oprs(o), pts(d) {}
142 #endif
143 // @endcond
144 
145 };
146 
147  }; // namespace PDF
148 }; // namespace pdftron
149 
150 #endif // PDFTRON_H_CPPPDFPathData
bool IsDefined() const
Definition: PathData.h:121
int GetGlyphIndex() const
Definition: PathData.h:128
void SetPoints(const std::vector< double > &points)
Definition: PathData.h:78
void SetOperators(const std::vector< unsigned char > &operators)
Definition: PathData.h:69
const std::vector< unsigned char > & GetOperators() const
Definition: PathData.h:92
const std::vector< double > & GetPoints() const
Definition: PathData.h:107