Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathSegment.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2008-2009 Jan Hambrecht <jaham@gmx.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KOPATHSEGMENT_H
8#define KOPATHSEGMENT_H
9
10#include "kritaflake_export.h"
11#include <QList>
12#include <QPair>
13
14class KoPathPoint;
15class QTransform;
16class QPointF;
17class QRectF;
18
20class KRITAFLAKE_EXPORT KoPathSegment
21{
22public:
28 explicit KoPathSegment(KoPathPoint * first = 0, KoPathPoint * second = 0);
29
31 KoPathSegment(const KoPathSegment &segment);
32
34 KoPathSegment(const QPointF &p0, const QPointF &p1);
36 KoPathSegment(const QPointF &p0, const QPointF &p1, const QPointF &p2);
38 KoPathSegment(const QPointF &p0, const QPointF &p1, const QPointF &p2, const QPointF &p3);
39
41 KoPathSegment& operator=(const KoPathSegment &other);
42
45
48
50 void setFirst(KoPathPoint *first);
51
54
56 void setSecond(KoPathPoint *second);
57
59 bool isValid() const;
60
62 bool operator==(const KoPathSegment &other) const;
63
65 int degree() const;
66
68 QList<QPointF> intersections(const KoPathSegment &segment) const;
69
71 QList<QPointF> convexHull() const;
72
74 QPair<KoPathSegment, KoPathSegment> splitAt(qreal t) const;
75
77 QPointF pointAt(qreal t) const;
78
80 QRectF boundingRect() const;
81
83 QRectF controlPointRect() const;
84
86 KoPathSegment mapped(const QTransform &matrix) const;
87
89 KoPathSegment toCubic() const;
90
95 qreal length(qreal error = 0.005) const;
96
106 qreal lengthAt(qreal t, qreal error = 0.005) const;
107
118 qreal paramAtLength(qreal length, qreal tolerance = 0.001) const;
119
124 bool isFlat(qreal tolerance = 0.01) const;
125
131 qreal nearestPoint(const QPointF &point) const;
132
134 QList<QPointF> controlPoints() const;
135
140 static KoPathSegment interpolate(const QPointF &p0, const QPointF &p1, const QPointF &p2, qreal t);
141
142private:
143 class Private;
144 Private * const d;
145};
146
147#endif // KOPATHSEGMENT_H
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
QPointF p0
QPointF p2
QPointF p3
QPointF p1
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
QPair< std::array< QPointF, 4 >, std::array< QPointF, 4 > > splitAt(const std::array< QPointF, 4 > &points, qreal t)
A KoPathPoint represents a point in a path.
A KoPathSegment consist of two neighboring KoPathPoints.
Private *const d
KoPathPoint * first() const
Returns the first point of the segment.
KoPathPoint * second() const
Returns the second point of the segment.