Loading...
Searching...
No Matches
PathData.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_CPPPDFPathData
6#define PDFTRON_H_CPPPDFPathData
7
8#include <vector>
9
10 namespace pdftron {
11 namespace PDF {
12
19 class PathData
20{
21 public:
25 enum PathSegmentType
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
34 e_lineto,
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
40 e_cubicto,
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
47 e_conicto,
48
49 // A rectangle at the given (x,y) coordinate and the given width and height (w, h).
50 // Number of arguments: 4
51 e_rect,
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
56 e_closepath
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
pdftron::PDF::PathData::PathSegmentType
PathSegmentType
Definition PathData.h:26
pdftron::PDF::PathData::e_rect
@ e_rect
Definition PathData.h:51
pdftron::PDF::PathData::e_conicto
@ e_conicto
Definition PathData.h:47
pdftron::PDF::PathData::e_moveto
@ e_moveto
Definition PathData.h:29
pdftron::PDF::PathData::e_lineto
@ e_lineto
Definition PathData.h:34
pdftron::PDF::PathData::e_cubicto
@ e_cubicto
Definition PathData.h:40
pdftron::PDF::PathData::e_closepath
@ e_closepath
Definition PathData.h:56
pdftron::PDF::PathData::GetOperators
const std::vector< unsigned char > & GetOperators() const
Definition PathData.h:92
pdftron::PDF::PathData::SetPoints
void SetPoints(const std::vector< double > &points)
Definition PathData.h:78
pdftron::PDF::PathData::SetOperators
void SetOperators(const std::vector< unsigned char > &operators)
Definition PathData.h:69
pdftron::PDF::PathData::GetPoints
const std::vector< double > & GetPoints() const
Definition PathData.h:107
pdftron::PDF::PathData::PathData
PathData()
Definition PathData.h:62
pdftron::PDF::PathData::IsDefined
bool IsDefined() const
Definition PathData.h:121
pdftron::PDF::PathData::GetGlyphIndex
int GetGlyphIndex() const
Definition PathData.h:128
pdftron::PDF
Definition Action.h:15
pdftron
Definition BasicTypes.h:10