1// qpainterpath.sip generated by MetaSIP
2//
3// This file is part of the QtGui Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QPainterPath
24{
25%TypeHeaderCode
26#include <qpainterpath.h>
27%End
28
29public:
30    enum ElementType
31    {
32        MoveToElement,
33        LineToElement,
34        CurveToElement,
35        CurveToDataElement,
36    };
37
38    class Element
39    {
40%TypeHeaderCode
41#include <qpainterpath.h>
42%End
43
44    public:
45        qreal x;
46        qreal y;
47        QPainterPath::ElementType type;
48        bool isMoveTo() const;
49        bool isLineTo() const;
50        bool isCurveTo() const;
51        bool operator==(const QPainterPath::Element &e) const;
52        bool operator!=(const QPainterPath::Element &e) const;
53        operator QPointF() const;
54    };
55
56    QPainterPath();
57    explicit QPainterPath(const QPointF &startPoint);
58    QPainterPath(const QPainterPath &other);
59    ~QPainterPath();
60    void closeSubpath();
61    void moveTo(const QPointF &p);
62    void lineTo(const QPointF &p);
63    void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength);
64    void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt);
65    void quadTo(const QPointF &ctrlPt, const QPointF &endPt);
66    QPointF currentPosition() const;
67    void addRect(const QRectF &rect);
68    void addEllipse(const QRectF &rect);
69    void addPolygon(const QPolygonF &polygon);
70    void addText(const QPointF &point, const QFont &f, const QString &text);
71    void addPath(const QPainterPath &path);
72    void addRegion(const QRegion &region);
73    void connectPath(const QPainterPath &path);
74    bool contains(const QPointF &pt) const;
75    bool contains(const QRectF &rect) const;
76    bool intersects(const QRectF &rect) const;
77    QRectF boundingRect() const;
78    QRectF controlPointRect() const;
79    Qt::FillRule fillRule() const;
80    void setFillRule(Qt::FillRule fillRule);
81    QPainterPath toReversed() const;
82    QList<QPolygonF> toSubpathPolygons() const;
83%MethodCode
84        sipRes = new QList<QPolygonF>(sipCpp->toSubpathPolygons());
85%End
86
87    QList<QPolygonF> toFillPolygons() const;
88%MethodCode
89        sipRes = new QList<QPolygonF>(sipCpp->toFillPolygons());
90%End
91
92    QPolygonF toFillPolygon() const;
93%MethodCode
94        sipRes = new QPolygonF(sipCpp->toFillPolygon());
95%End
96
97    bool operator==(const QPainterPath &other) const;
98    bool operator!=(const QPainterPath &other) const;
99    void moveTo(qreal x, qreal y);
100    void arcMoveTo(const QRectF &rect, qreal angle);
101    void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
102    void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLenght);
103    void lineTo(qreal x, qreal y);
104    void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty);
105    void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
106    void addEllipse(qreal x, qreal y, qreal w, qreal h);
107    void addRect(qreal x, qreal y, qreal w, qreal h);
108    void addText(qreal x, qreal y, const QFont &f, const QString &text);
109    bool isEmpty() const;
110    int elementCount() const;
111    QPainterPath::Element elementAt(int i) const;
112    void setElementPositionAt(int i, qreal x, qreal y);
113    QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const;
114    QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
115    QPolygonF toFillPolygon(const QTransform &matrix) const;
116    qreal length() const;
117    qreal percentAtLength(qreal t) const;
118    QPointF pointAtPercent(qreal t) const;
119    qreal angleAtPercent(qreal t) const;
120    qreal slopeAtPercent(qreal t) const;
121    bool intersects(const QPainterPath &p) const;
122    bool contains(const QPainterPath &p) const;
123    QPainterPath united(const QPainterPath &r) const;
124    QPainterPath intersected(const QPainterPath &r) const;
125    QPainterPath subtracted(const QPainterPath &r) const;
126    void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
127    void addRoundedRect(qreal x, qreal y, qreal w, qreal h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
128    void addEllipse(const QPointF &center, qreal rx, qreal ry);
129    QPainterPath simplified() const;
130    QPainterPath operator&(const QPainterPath &other) const;
131    QPainterPath operator|(const QPainterPath &other) const;
132    QPainterPath operator+(const QPainterPath &other) const;
133    QPainterPath operator-(const QPainterPath &other) const;
134    QPainterPath &operator&=(const QPainterPath &other);
135    QPainterPath &operator|=(const QPainterPath &other);
136    QPainterPath &operator+=(const QPainterPath &other);
137    QPainterPath &operator-=(const QPainterPath &other);
138    void translate(qreal dx, qreal dy);
139    QPainterPath translated(qreal dx, qreal dy) const;
140    void translate(const QPointF &offset);
141    QPainterPath translated(const QPointF &offset) const;
142    void swap(QPainterPath &other /Constrained/);
143%If (Qt_5_13_0 -)
144    void clear();
145%End
146%If (Qt_5_13_0 -)
147    void reserve(int size);
148%End
149%If (Qt_5_13_0 -)
150    int capacity() const;
151%End
152};
153
154QDataStream &operator<<(QDataStream &, const QPainterPath & /Constrained/) /ReleaseGIL/;
155QDataStream &operator>>(QDataStream &, QPainterPath & /Constrained/) /ReleaseGIL/;
156
157class QPainterPathStroker
158{
159%TypeHeaderCode
160#include <qpainterpath.h>
161%End
162
163public:
164    QPainterPathStroker();
165%If (Qt_5_3_0 -)
166    explicit QPainterPathStroker(const QPen &pen);
167%End
168    ~QPainterPathStroker();
169    void setWidth(qreal width);
170    qreal width() const;
171    void setCapStyle(Qt::PenCapStyle style);
172    Qt::PenCapStyle capStyle() const;
173    void setJoinStyle(Qt::PenJoinStyle style);
174    Qt::PenJoinStyle joinStyle() const;
175    void setMiterLimit(qreal length);
176    qreal miterLimit() const;
177    void setCurveThreshold(qreal threshold);
178    qreal curveThreshold() const;
179    void setDashPattern(Qt::PenStyle);
180    void setDashPattern(const QVector<qreal> &dashPattern);
181    QVector<qreal> dashPattern() const;
182    QPainterPath createStroke(const QPainterPath &path) const;
183    void setDashOffset(qreal offset);
184    qreal dashOffset() const;
185
186private:
187    QPainterPathStroker(const QPainterPathStroker &);
188};
189