Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathPoint.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
3 SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org>
4 SPDX-FileCopyrightText: 2006-2008 Jan Hambrecht <jaham@gmx.net>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KOPATHPOINT_H
10#define KOPATHPOINT_H
11
12#include "kritaflake_export.h"
13
14#include <QFlags>
15
16class KoPathShape;
17class QPointF;
18class QTransform;
19class QRectF;
20class QPainter;
22
32class KRITAFLAKE_EXPORT KoPathPoint
33{
34public:
37 Normal = 0,
38 StartSubpath = 1,
39 StopSubpath = 2,
40 CloseSubpath = 8,
41 IsSmooth = 16,
42 IsSymmetric = 32
43 };
44 Q_DECLARE_FLAGS(PointProperties, PointProperty)
45
46
47 enum PointType {
48 None = 0,
49 Node = 1,
50 ControlPoint1 = 2,
51 ControlPoint2 = 4,
52 All = 7
53 };
54 Q_DECLARE_FLAGS(PointTypes, PointType)
55
56
58
66 KoPathPoint(KoPathShape *path, const QPointF &point, PointProperties properties = Normal);
67
71 KoPathPoint(const KoPathPoint &pathPoint);
72 KoPathPoint(const KoPathPoint &pathPoint, KoPathShape *newParent);
73
77 KoPathPoint& operator=(const KoPathPoint &other);
78
80 bool operator == (const KoPathPoint &other) const;
81
86
92 QPointF point() const;
93
101 QPointF controlPoint1() const;
102
110 QPointF controlPoint2() const;
111
117 void setPoint(const QPointF &point);
118
124 void setControlPoint1(const QPointF &point);
125
131 void setControlPoint2(const QPointF &point);
132
134 void removeControlPoint1();
135
137 void removeControlPoint2();
138
144 PointProperties properties() const;
145
150 void setProperties(PointProperties properties);
151
156 void setProperty(PointProperty property);
157
162 void unsetProperty(PointProperty property);
163
175
187
195 void map(const QTransform &matrix);
196
205 void paint(KisHandlePainterHelper &handlesHelper, PointTypes types, bool active = true);
206
211 void setParent(KoPathShape* parent);
212
217 KoPathShape *parent() const;
218
229 QRectF boundingRect(bool active = true) const;
230
238 void reverse();
239
252 bool isSmooth(KoPathPoint *previous, KoPathPoint *next) const;
253
254protected:
255 friend class KoPathShapePrivate;
256private:
257 class Private;
258 Private * const d;
259};
260
261// /// a KoSubpath contains a path from a moveTo until a close or a new moveTo
262// typedef QList<KoPathPoint *> KoSubpath;
263// typedef QList<KoSubpath *> KoSubpathList;
264// /// A KoPathSegment is a pair two neighboring KoPathPoints
265// typedef QPair<KoPathPoint*,KoPathPoint*> KoPathSegment;
266// /// The position of a path point within a path shape
267// typedef QPair<KoSubpath*, int> KoPointPosition;
268
269Q_DECLARE_OPERATORS_FOR_FLAGS(KoPathPoint::PointProperties)
270Q_DECLARE_OPERATORS_FOR_FLAGS(KoPathPoint::PointTypes)
271
272#endif
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
Q_DECLARE_FLAGS(KisUpdaterContextSnapshotEx, KisUpdaterContextSnapshotExTag)
The KisHandlePainterHelper class is a special helper for painting handles around objects....
A KoPathPoint represents a point in a path.
QPointF controlPoint2() const
get the second control point
bool activeControlPoint2() const
Checks if there is a controlPoint2.
QPointF point() const
return the position relative to the shape origin
PointProperties properties() const
Get the properties of a point.
PointProperty
property enum
Definition KoPathPoint.h:36
PointType
the type for identifying part of a KoPathPoint
Definition KoPathPoint.h:47
bool activeControlPoint1() const
Checks if there is a controlPoint1.
Private *const d
QPointF controlPoint1() const
get the control point 1
The position of a path point within a path shape.
Definition KoPathShape.h:63
Definition Node.h:24
Q_DECLARE_OPERATORS_FOR_FLAGS(KisBaseRectsWalker::SubtreeVisitFlags)