|
Krita Source Code Documentation
|
A KoPathPoint represents a point in a path. More...
#include <KoPathPoint.h>
Inheritance diagram for KoPathPoint:Public Types | |
| enum | PointProperty { Normal = 0 , StartSubpath = 1 , StopSubpath = 2 , CloseSubpath = 8 , IsSmooth = 16 , IsSymmetric = 32 } |
| property enum More... | |
| enum | PointType { None = 0 , Node = 1 , ControlPoint1 = 2 , ControlPoint2 = 4 , All = 7 } |
| the type for identifying part of a KoPathPoint More... | |
Public Member Functions | |
| bool | activeControlPoint1 () const |
| Checks if there is a controlPoint1. | |
| bool | activeControlPoint2 () const |
| Checks if there is a controlPoint2. | |
| QRectF | boundingRect (bool active=true) const |
| Get the bounding rect of the point. | |
| QPointF | controlPoint1 () const |
| get the control point 1 | |
| QPointF | controlPoint2 () const |
| get the second control point | |
| bool | isSmooth (KoPathPoint *previous, KoPathPoint *next) const |
| KoPathPoint () | |
| Default constructor. | |
| KoPathPoint (const KoPathPoint &pathPoint) | |
| Copy Constructor. | |
| KoPathPoint (const KoPathPoint &pathPoint, KoPathShape *newParent) | |
| KoPathPoint (KoPathShape *path, const QPointF &point, PointProperties properties=Normal) | |
| Constructor. | |
| void | map (const QTransform &matrix) |
| apply matrix on the point | |
| KoPathPoint & | operator= (const KoPathPoint &other) |
| Assignment operator. | |
| bool | operator== (const KoPathPoint &other) const |
| Compare operator. | |
| void | paint (KisHandlePainterHelper &handlesHelper, PointTypes types, bool active=true) |
| KoPathShape * | parent () const |
| Get the path shape the point belongs to. | |
| QPointF | point () const |
| return the position relative to the shape origin | |
| Private () | |
| PointProperties | properties () const |
| Get the properties of a point. | |
| void | removeControlPoint1 () |
| Removes the first control point. | |
| void | removeControlPoint2 () |
| Removes the second control point. | |
| void | reverse () |
| Reverses the path point. | |
| void | setControlPoint1 (const QPointF &point) |
| Set the control point 1. | |
| void | setControlPoint2 (const QPointF &point) |
| Set the control point 2. | |
| void | setParent (KoPathShape *parent) |
| Sets the parent path shape. | |
| void | setPoint (const QPointF &point) |
| alter the point | |
| void | setProperties (PointProperties properties) |
| Set the properties of a point. | |
| void | setProperty (PointProperty property) |
| Sets a single property of a point. | |
| void | unsetProperty (PointProperty property) |
| Removes a property from the point. | |
| ~KoPathPoint () | |
| Destructor. | |
Public Attributes | |
| bool | activeControlPoint1 |
| bool | activeControlPoint2 |
| QPointF | controlPoint1 |
| QPointF | controlPoint2 |
| QPointF | point |
| PointProperties | properties |
| KoPathShape * | shape |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Friends | |
| class | KoPathShapePrivate |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
A KoPathPoint represents a point in a path.
A KoPathPoint stores a point in a path. Additional to this point 2 control points are stored. controlPoint1 is used to describe the second point of a cubic bezier ending at the point. controlPoint2 is used to describe the first point of a cubic bezier curve starting at the point.
Definition at line 24 of file KoPathPoint.cpp.
property enum
Definition at line 36 of file KoPathPoint.h.
the type for identifying part of a KoPathPoint
| Enumerator | |
|---|---|
| None | |
| Node | the node point |
| ControlPoint1 | the first control point |
| ControlPoint2 | the second control point |
| All | |
Definition at line 47 of file KoPathPoint.h.
| KoPathPoint::KoPathPoint | ( | ) |
| KoPathPoint::KoPathPoint | ( | KoPathShape * | path, |
| const QPointF & | point, | ||
| PointProperties | properties = Normal ) |
Constructor.
| path | is a pointer to the path shape this point is used in |
| point | the position relative to the shape origin |
| properties | describing the point |
Definition at line 62 of file KoPathPoint.cpp.
References d, point, and properties.
| KoPathPoint::KoPathPoint | ( | const KoPathPoint & | pathPoint | ) |
Copy Constructor.
Definition at line 39 of file KoPathPoint.cpp.
References d.
| KoPathPoint::KoPathPoint | ( | const KoPathPoint & | pathPoint, |
| KoPathShape * | newParent ) |
Definition at line 51 of file KoPathPoint.cpp.
References d.
| KoPathPoint::~KoPathPoint | ( | ) |
| bool KoPathPoint::activeControlPoint1 | ( | ) | const |
Checks if there is a controlPoint1.
The control point is active if a control point was set by calling setControlPoint1. However a start point of a subpath (StartSubpath) can only have an active control 1 if the subpath is closed (CloseSubpath on first and last point).
| bool KoPathPoint::activeControlPoint2 | ( | ) | const |
Checks if there is a controlPoint2.
The control point is active if a control point was set by calling setControlPoint2. However a end point of a subpath (StopSubpath) can only have an active control point 2 if there subpath is closed (CloseSubpath on first and last point).
| QRectF KoPathPoint::boundingRect | ( | bool | active = true | ) | const |
Get the bounding rect of the point.
This takes into account if there are control points
| active | If true only the active points are used in calculation of the bounding rectangle. If false all points are used. |
Definition at line 295 of file KoPathPoint.cpp.
References activeControlPoint1, activeControlPoint2, d, r1, and r2.
| QPointF KoPathPoint::controlPoint1 | ( | ) | const |
get the control point 1
This points is used for controlling a curve ending at this point
| QPointF KoPathPoint::controlPoint2 | ( | ) | const |
get the second control point
This points is used for controlling a curve starting at this point
| bool KoPathPoint::isSmooth | ( | KoPathPoint * | previous, |
| KoPathPoint * | next ) const |
Returns if this point is a smooth join of adjacent path segments.
The smoothness is defined by the parallelness of the tangents emanating from the knot point, i.e. the normalized vectors from the knot to the first and second control point. The previous and next path points are used to determine the smoothness in case this path point has not two control points.
| previous | the previous path point |
| next | the next path point |
Definition at line 327 of file KoPathPoint.cpp.
References activeControlPoint1, activeControlPoint2, controlPoint1, controlPoint2, point, and qFuzzyCompare().
| void KoPathPoint::map | ( | const QTransform & | matrix | ) |
apply matrix on the point
This does a matrix multiplication on all points of the point
| matrix | which will be applied to all points |
Definition at line 242 of file KoPathPoint.cpp.
References d.
| KoPathPoint & KoPathPoint::operator= | ( | const KoPathPoint & | other | ) |
Assignment operator.
Definition at line 77 of file KoPathPoint.cpp.
References d.
| bool KoPathPoint::operator== | ( | const KoPathPoint & | other | ) | const |
Compare operator.
Definition at line 93 of file KoPathPoint.cpp.
References d.
| void KoPathPoint::paint | ( | KisHandlePainterHelper & | handlesHelper, |
| PointTypes | types, | ||
| bool | active = true ) |
Paints the path point with the actual brush and pen
| painter | used for painting the shape point |
| handleRadius | size of point handles in pixel |
| types | the points which should be painted |
| active | If true only the given active points are painted If false all given points are used. |
Definition at line 252 of file KoPathPoint.cpp.
References activeControlPoint1, activeControlPoint2, controlPoint1, ControlPoint1, controlPoint2, ControlPoint2, KisHandlePainterHelper::drawConnectionLine(), KisHandlePainterHelper::drawGradientHandle(), KisHandlePainterHelper::drawHandleCircle(), KisHandlePainterHelper::drawHandleRect(), KisHandlePainterHelper::drawHandleSmallCircle(), IsSmooth, IsSymmetric, point, and properties.
| KoPathShape * KoPathPoint::parent | ( | ) | const |
Get the path shape the point belongs to.
Definition at line 389 of file KoPathPoint.cpp.
References d.
| QPointF KoPathPoint::point | ( | ) | const |
return the position relative to the shape origin
|
inline |
Definition at line 27 of file KoPathPoint.cpp.
| PointProperties KoPathPoint::properties | ( | ) | const |
Get the properties of a point.
| void KoPathPoint::removeControlPoint1 | ( | ) |
| void KoPathPoint::removeControlPoint2 | ( | ) |
| void KoPathPoint::reverse | ( | ) |
Reverses the path point.
The control points are swapped and the point properties are adjusted. The position dependent properties like StartSubpath and CloseSubpath are not changed.
Definition at line 314 of file KoPathPoint.cpp.
References CloseSubpath, d, IsSmooth, IsSymmetric, Normal, StartSubpath, and StopSubpath.
| void KoPathPoint::setControlPoint1 | ( | const QPointF & | point | ) |
Set the control point 1.
| point | to set |
Definition at line 117 of file KoPathPoint.cpp.
References d, point, and qIsNaNPoint().
| void KoPathPoint::setControlPoint2 | ( | const QPointF & | point | ) |
Set the control point 2.
| point | to set |
Definition at line 127 of file KoPathPoint.cpp.
References d, point, and qIsNaNPoint().
| void KoPathPoint::setParent | ( | KoPathShape * | parent | ) |
Sets the parent path shape.
| parent | the new parent path shape |
Definition at line 288 of file KoPathPoint.cpp.
| void KoPathPoint::setPoint | ( | const QPointF & | point | ) |
| void KoPathPoint::setProperties | ( | PointProperties | properties | ) |
Set the properties of a point.
| properties | the new properties |
Definition at line 155 of file KoPathPoint.cpp.
References activeControlPoint1, activeControlPoint2, d, properties, StartSubpath, and StopSubpath.
| void KoPathPoint::setProperty | ( | PointProperty | property | ) |
Sets a single property of a point.
| property | the property to set |
Definition at line 172 of file KoPathPoint.cpp.
References activeControlPoint1, activeControlPoint2, CloseSubpath, d, IsSmooth, IsSymmetric, StartSubpath, and StopSubpath.
| void KoPathPoint::unsetProperty | ( | PointProperty | property | ) |
Removes a property from the point.
| property | the property to remove |
Definition at line 198 of file KoPathPoint.cpp.
References CloseSubpath, d, IsSmooth, IsSymmetric, StartSubpath, and StopSubpath.
|
friend |
Definition at line 255 of file KoPathPoint.h.
| bool KoPathPoint::activeControlPoint1 |
Definition at line 35 of file KoPathPoint.cpp.
| bool KoPathPoint::activeControlPoint2 |
Definition at line 36 of file KoPathPoint.cpp.
| QPointF KoPathPoint::controlPoint1 |
Definition at line 32 of file KoPathPoint.cpp.
| QPointF KoPathPoint::controlPoint2 |
Definition at line 33 of file KoPathPoint.cpp.
|
private |
Definition at line 258 of file KoPathPoint.h.
| QPointF KoPathPoint::point |
Definition at line 31 of file KoPathPoint.cpp.
| KoPathPoint::PointProperties KoPathPoint::properties |
Definition at line 34 of file KoPathPoint.cpp.
| KoPathShape* KoPathPoint::shape |
Definition at line 30 of file KoPathPoint.cpp.