33 #include <Pt/Gfx/Api.h>
34 #include <Pt/Gfx/Point.h>
35 #include <Pt/Gfx/Size.h>
36 #include <Pt/Gfx/Rect.h>
37 #include <Pt/Gfx/Transform.h>
47 Polygon(
const PointF* ps, std::size_t n)
56 void assign(
const PointF* ps, std::size_t n)
58 _points.assign(ps, ps+n);
61 const PointF& at(std::size_t n)
const
66 PointF& at(std::size_t n)
78 return _points.empty();
81 std::size_t size()
const
83 return _points.size();
86 void push_back(
const PointF& p)
91 std::vector<PointF>& points()
96 const std::vector<PointF>& points()
const
102 std::vector<PointF> _points;
117 Element(ElementType type_)
121 Element(ElementType type_,
double x0,
double y0)
122 : type(type_), pxy(2)
123 { pxy[0] = x0; pxy[1] = y0; }
125 Element(ElementType type_,
double x0,
double y0,
double x1,
double y1)
126 : type(type_), pxy(4)
127 { pxy[0] = x0; pxy[1] = y0; pxy[2] = x1; pxy[3] = y1; }
129 Element(ElementType type_,
double x0,
double y0,
double x1,
double y1,
double x2,
double y2)
130 : type(type_), pxy(6)
131 { pxy[0] = x0; pxy[1] = y0; pxy[2] = x1; pxy[3] = y1; pxy[4] = x2; pxy[5] = y2; }
133 Element(ElementType type_,
const std::vector<double>& pxy_)
134 : type(type_), pxy(pxy_)
138 std::vector<double> pxy;
142 class PT_GFX_API Path
149 std::size_t size()
const;
151 bool isEmpty()
const;
153 const Element& at(std::size_t n)
const;
157 RectF boundingRect()
const;
159 const PointF& currentPosition()
const;
161 void moveTo(
const PointF& p);
163 void lineTo(
const PointF& p);
165 void arcTo(
const PointF& p,
double r);
167 void quadraticBezierTo(
const PointF &c,
const PointF& to);
169 void cubicBezierTo(
const PointF &c1,
const PointF &c2,
const PointF& to);
171 void bezierTo(
const PointF* controlPoints,
size_t n,
const PointF& to);
179 void addPath(
const Path& p);
183 void insertPath(
const Path& p);
185 void addRect(
const SizeF& size);
187 void addRoundedRect(
const SizeF& size,
float radius);
189 void addEllipse(
const SizeF& size);
191 void addPie(
const SizeF& size,
float degBegin,
float degEnd);
193 void addChord(
const SizeF& size,
float degBegin,
float degEnd);
195 void transform(
const Transform& transform);
197 void toPolygons(std::vector<Polygon>& polygons,
float smoothness = 1)
const;
200 typedef std::vector<Element> ElementVector;
203 ElementVector _elements;