|
Krita Source Code Documentation
|
The position of a path point within a path shape. More...
#include <KoPathShape.h>
Inheritance diagram for KoPathShape:Classes | |
| struct | PointSelectionChangeListener |
| class | Private |
Public Member Functions | |
| bool | addSubpath (KoSubpath *subpath, int subpathIndex) |
| Adds a subpath at the given index to the path. | |
| KoPathPoint * | arcTo (qreal rx, qreal ry, qreal startAngle, qreal sweepAngle) |
| Add an arc. | |
| bool | autoFillMarkers () const |
| QRectF | boundingRect () const override |
| reimplemented | |
| bool | breakAfter (const KoPathPointIndex &pointIndex) |
| Breaks the path after the point index. | |
| void | clear () |
| Removes all subpaths and their points from the path. | |
| KoShape * | cloneShape () const override |
| creates a deep copy of the shape or shape's subtree | |
| void | close () |
| Closes the current subpath. | |
| void | closeMerge () |
| Closes the current subpath. | |
| KoPathPointIndex | closeSubpath (const KoPathPointIndex &pointIndex) |
| Close a open subpath. | |
| int | combine (KoPathShape *path) |
| Combines two path shapes by appending the data of the specified path. | |
| KoPathPoint * | curveTo (const QPointF &c, const QPointF &p) |
| Adds a new quadratic Bezier curve segment. | |
| KoPathPoint * | curveTo (const QPointF &c1, const QPointF &c2, const QPointF &p) |
| Adds a new cubic Bezier curve segment. | |
| Qt::FillRule | fillRule () const |
| Returns the fill rule for the path object. | |
| bool | hasMarkers () const |
| bool | hitTest (const QPointF &position) const override |
| reimplemented | |
| bool | insertPoint (KoPathPoint *point, const KoPathPointIndex &pointIndex) |
| Inserts a new point into the given subpath at the specified position. | |
| bool | isClosedSubpath (int subpathIndex) const |
| Checks if a subpath is closed. | |
| bool | join (int subpathIndex) |
| Joins the given subpath with the following one. | |
| KoPathShape () | |
| constructor | |
| KoPathPoint * | lineTo (const QPointF &p) |
| Adds a new line segment. | |
| void | loadNodeTypes (const QString &nodeTypes) |
| Loads node types. | |
| KoMarker * | marker (KoFlake::MarkerPosition pos) const |
| bool | moveSubpath (int oldSubpathIndex, int newSubpathIndex) |
| Moves the position of a subpath within a path. | |
| KoPathPoint * | moveTo (const QPointF &p) |
| Starts a new Subpath. | |
| QString | nodeTypes () const |
| Saves the node types. | |
| virtual QPointF | normalize () |
| Normalizes the path data. | |
| KoPathPointIndex | openSubpath (const KoPathPointIndex &pointIndex) |
| Opens a closed subpath. | |
| QPainterPath | outline () const override |
| reimplemented | |
| QRectF | outlineRect () const override |
| reimplemented | |
| void | paint (QPainter &painter) const override |
| reimplemented | |
| virtual void | paintPoints (KisHandlePainterHelper &handlesHelper) |
| KoPathPointIndex | pathPointIndex (const KoPathPoint *point) const |
| Returns the path point index of a given path point. | |
| virtual QString | pathShapeId () const |
| QPainterPath | pathStroke (const QPen &pen) const |
| KoPathPoint * | pointByIndex (const KoPathPointIndex &pointIndex) const |
| Returns the path point specified by a path point index. | |
| int | pointCount () const |
| Returns the number of points in the path. | |
| QList< KoPathPoint * > | pointsAt (const QRectF &rect, const bool useControlPoints=false) const |
| Returns the path points within the given rectangle. | |
| void | recommendPointSelectionChange (const QList< KoPathPointIndex > &newSelection) |
| KoPathPoint * | removePoint (const KoPathPointIndex &pointIndex) |
| Removes a point from the path. | |
| KoSubpath * | removeSubpath (int subpathIndex) |
| Removes subpath from the path. | |
| bool | reverseSubpath (int subpathIndex) |
| Reverse subpath. | |
| KoPathSegment | segmentByIndex (const KoPathPointIndex &pointIndex) const |
| Returns the segment specified by a path point index. | |
| QList< KoPathSegment > | segmentsAt (const QRectF &rect) const |
| Returns the list of path segments within the given rectangle. | |
| bool | separate (QList< KoPathShape * > &separatedPaths) |
| Creates separate path shapes, one for each existing subpath. | |
| void | setAutoFillMarkers (bool value) |
| void | setFillRule (Qt::FillRule fillRule) |
| Sets the fill rule to be used for painting the background. | |
| void | setMarker (KoMarker *marker, KoFlake::MarkerPosition pos) |
| void | setSize (const QSizeF &size) override |
| QSizeF | size () const override |
| reimplemented | |
| int | subpathCount () const |
| Returns the number of subpaths in the path. | |
| int | subpathPointCount (int subpathIndex) const |
| Returns the number of points in a subpath. | |
| QString | toString (const QTransform &matrix=QTransform()) const |
| Returns a odf/svg string representation of the path data with the given matrix applied. | |
| ~KoPathShape () override | |
Public Member Functions inherited from KoTosContainer | |
| KoShape * | createTextShape (KoDocumentResourceManager *documentResources=0) |
| KoTosContainer () | |
| virtual bool | loadText (const QDomElement &element) |
| void | paintComponent (QPainter &painter) const override |
| Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does. | |
| ResizeBehavior | resizeBehavior () const |
| void | setPlainText (const QString &text) |
| void | setResizeBehavior (ResizeBehavior resizeBehavior) |
| void | setRunThrough (short int runThrough) override |
| void | setTextAlignment (Qt::Alignment alignment) |
| Qt::Alignment | textAlignment () const |
| ~KoTosContainer () override | |
Public Member Functions inherited from KoShapeContainer | |
| void | addShape (KoShape *shape) |
| bool | inheritsTransform (const KoShape *shape) const |
| bool | isClipped (const KoShape *child) const |
| KoShapeContainer (KoShapeContainerModel *model=0) | |
| KoShapeContainerModel * | model () const |
| void | paint (QPainter &painter) const override |
| reimplemented | |
| Private (const Private &rhs, KoShapeContainer *q) | |
| Private (KoShapeContainer *q) | |
| void | removeShape (KoShape *shape) |
| void | setClipped (const KoShape *child, bool clipping) |
| void | setInheritsTransform (const KoShape *shape, bool inherit) |
| int | shapeCount () const |
| ShapeInterface * | shapeInterface () |
| QList< KoShape * > | shapes () const |
| virtual void | update () const |
| void | update () const override |
| reimplemented | |
| ~KoShapeContainer () override | |
| virtual | ~Private () |
Public Member Functions inherited from KoShape | |
| QRectF | absoluteOutlineRect () const |
| QPointF | absolutePosition (KoFlake::AnchorPosition anchor=KoFlake::Center) const |
| QTransform | absoluteTransformation () const |
| bool | addDependee (KoShape *shape) |
| QString | additionalAttribute (const QString &name) const |
| void | addShapeChangeListener (ShapeChangeListener *listener) |
| KoShapeAnchor * | anchor () const |
| void | applyAbsoluteTransformation (const QTransform &matrix) |
| void | applyTransformation (const QTransform &matrix) |
| virtual QSharedPointer< KoShapeBackground > | background () const |
| virtual ChildZOrderPolicy | childZOrderPolicy () |
| KoClipMask * | clipMask () const |
| Returns the currently set clip mask or 0 if there is no clip mask set. | |
| KoClipPath * | clipPath () const |
| Returns the currently set clip path or 0 if there is no clip path set. | |
| KoShape * | cloneShapeAndBakeAbsoluteTransform () const |
creates a deep copy of the shape/shapes tree and bakes the absolute transform of this into the resulting shape. | |
| void | copySettings (const KoShape *shape) |
| QList< KoShape * > | dependees () const |
| Returns list of shapes depending on this shape. | |
| QPointF | documentToShape (const QPointF &point) const |
| Transforms point from document coordinates to shape coordinates. | |
| QRectF | documentToShape (const QRectF &rect) const |
| Transform rect from document coordinates to shape coordinates. | |
| KoFilterEffectStack * | filterEffectStack () const |
| bool | hasAdditionalAttribute (const QString &name) const |
| bool | hasCommonParent (const KoShape *shape) const |
| bool | hasDependee (KoShape *shape) const |
| Returns if the given shape is dependent on this shape. | |
| virtual bool | hasTransparency () const |
| QString | hyperLink () const |
| bool | inheritBackground () const |
| inheritBackground shows if the shape inherits background from its parent | |
| bool | inheritPaintOrder () const |
| inheritPaintOrder | |
| bool | inheritsTransformFromAny (const QList< KoShape * > ancestorsInQuestion) const |
inheritsTransformFromAny checks if the shape inherits transformation from any of the shapes listed in ancestorsInQuestion. The inheritance is checked in recursive way. | |
| bool | inheritStroke () const |
| inheritStroke shows if the shape inherits the stroke from its parent | |
| bool | isContentProtected () const |
| bool | isGeometryProtected () const |
| bool | isPrintable () const |
| bool | isSelectable () const |
| virtual bool | isShapeEditable (bool recursive=true) const |
| checks recursively if the shape or one of its parents is not visible or locked | |
| bool | isVisible (bool recursive=true) const |
| bool | keepAspectRatio () const |
| KoShape () | |
| Constructor. | |
| qreal | minimumHeight () const |
| QString | name () const |
| void | notifyChanged () |
| virtual void | paintMarkers (QPainter &painter) const |
| paintStroke paints the shape's markers | |
| virtual QVector< PaintOrder > | paintOrder () const |
| paintOrder | |
| virtual void | paintStroke (QPainter &painter) const |
| paintStroke paints the shape's stroked outline | |
| KoShapeContainer * | parent () const |
| QPointF | position () const |
| Get the position of the shape in pt. | |
| void | removeAdditionalAttribute (const QString &name) |
| void | removeAdditionalStyleAttribute (const char *name) |
| void | removeDependee (KoShape *shape) |
| void | removeShapeChangeListener (ShapeChangeListener *listener) |
| void | rotate (qreal angle) |
| Rotate the shape (relative) | |
| qreal | rotation () const |
| int | runThrough () const |
| void | scale (qreal sx, qreal sy) |
| Scale the shape using the zero-point which is the top-left corner. | |
| void | setAbsolutePosition (const QPointF &newPosition, KoFlake::AnchorPosition anchor=KoFlake::Center) |
| void | setAdditionalAttribute (const QString &name, const QString &value) |
| void | setAdditionalStyleAttribute (const char *name, const QString &value) |
| void | setAnchor (KoShapeAnchor *anchor) |
| virtual void | setBackground (QSharedPointer< KoShapeBackground > background) |
| void | setClipMask (KoClipMask *clipMask) |
| Sets a new clip mask, removing the old one. The mask is owned by the shape. | |
| void | setClipPath (KoClipPath *clipPath) |
| Sets a new clip path, removing the old one. | |
| void | setContentProtected (bool protect) |
| void | setFilterEffectStack (KoFilterEffectStack *filterEffectStack) |
| Sets the new filter effect stack, removing the old one. | |
| void | setGeometryProtected (bool on) |
| void | setHyperLink (const QString &hyperLink) |
| void | setInheritBackground (bool value) |
| setInheritBackground marks a shape as inheriting the background from the parent shape. NOTE: The currently selected background is destroyed. | |
| void | setInheritPaintOrder (bool value) |
| setInheritPaintOrder set inherit paint order. | |
| void | setInheritStroke (bool value) |
| setInheritStroke marks a shape as inheriting the stroke from the parent shape. NOTE: The currently selected stroke is destroyed. | |
| void | setKeepAspectRatio (bool keepAspect) |
| void | setMinimumHeight (qreal height) |
| void | setName (const QString &name) |
| virtual void | setPaintOrder (PaintOrder first, PaintOrder second) |
| setPaintOrder set the paint order. As there's only three entries in any given paintorder, you only need to have the first and second entry to set it. | |
| void | setParent (KoShapeContainer *parent) |
| virtual void | setPosition (const QPointF &position) |
| Set the position of the shape in pt. | |
| void | setPrintable (bool on) |
| virtual void | setResolution (qreal xRes, qreal yRes) |
| void | setSelectable (bool selectable) |
| void | setShadow (KoShapeShadow *shadow) |
| Sets the new shadow, removing the old one. | |
| void | setShapeId (const QString &id) |
| virtual void | setStroke (KoShapeStrokeModelSP stroke) |
| void | setTextRunAroundContour (TextRunAroundContour contour) |
| void | setTextRunAroundDistanceBottom (qreal distance) |
| void | setTextRunAroundDistanceLeft (qreal distance) |
| void | setTextRunAroundDistanceRight (qreal distance) |
| void | setTextRunAroundDistanceTop (qreal distance) |
| void | setTextRunAroundSide (TextRunAroundSide side, RunThroughLevel runThrough=Background) |
| void | setTextRunAroundThreshold (qreal threshold) |
| void | setToolDelegates (const QSet< KoShape * > &delegates) |
| void | setTransformation (const QTransform &matrix) |
| void | setTransparency (qreal transparency) |
| void | setUserData (KoShapeUserData *userData) |
| void | setVisible (bool on) |
| void | setZIndex (qint16 zIndex) |
| KoShapeShadow * | shadow () const |
| Returns the currently set shadow or 0 if there is no shadow set. | |
| virtual QPainterPath | shadowOutline () const |
| QString | shapeId () const |
| QPointF | shapeToDocument (const QPointF &point) const |
| Transforms point from shape coordinates to document coordinates. | |
| QRectF | shapeToDocument (const QRectF &rect) const |
| Transforms rect from shape coordinates to document coordinates. | |
| void | shear (qreal sx, qreal sy) |
| Shear the shape The shape will be sheared using the zero-point which is the top-left corner. | |
| virtual KoSnapData | snapData () const |
| Returns additional snap data the shape wants to have snapping to. | |
| virtual KoShapeStrokeModelSP | stroke () const |
| KoInsets | strokeInsets () const |
| TextRunAroundContour | textRunAroundContour () const |
| qreal | textRunAroundDistanceBottom () const |
| qreal | textRunAroundDistanceLeft () const |
| qreal | textRunAroundDistanceRight () const |
| qreal | textRunAroundDistanceTop () const |
| TextRunAroundSide | textRunAroundSide () const |
| qreal | textRunAroundThreshold () const |
| QSet< KoShape * > | toolDelegates () const |
| QTransform | transformation () const |
| Returns the shapes local transformation matrix. | |
| qreal | transparency (bool recursive=false) const |
| virtual void | updateAbsolute (const QRectF &rect) const |
| KoShapeUserData * | userData () const |
| virtual void | waitUntilReady (bool asynchronous=true) const |
| qint16 | zIndex () const |
| virtual | ~KoShape () |
| Destructor. | |
Static Public Member Functions | |
| static KoPathShape * | createShapeFromPainterPath (const QPainterPath &path) |
| Creates path shape from given QPainterPath. | |
Static Public Member Functions inherited from KoShape | |
| static QRectF | absoluteOutlineRect (const QList< KoShape * > &shapes) |
| static QRectF | boundingRect (const QList< KoShape * > &shapes) |
| static bool | compareShapeZIndex (KoShape *s1, KoShape *s2) |
| static KisHandlePainterHelper | createHandlePainterHelperDocument (QPainter *painter, KoShape *shape, qreal handleRadius, int decorationThickness) |
| static KisHandlePainterHelper | createHandlePainterHelperView (QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1) |
| static QVector< PaintOrder > | defaultPaintOrder () |
| default paint order as per SVG specification | |
| static QList< KoShape * > | linearizeSubtree (const QList< KoShape * > &shapes) |
| static QList< KoShape * > | linearizeSubtreeSorted (const QList< KoShape * > &shapes) |
Protected Member Functions | |
| int | arcToCurve (qreal rx, qreal ry, qreal startAngle, qreal sweepAngle, const QPointF &offset, QPointF *curvePoints) const |
| Add an arc. | |
| KoPathShape (const KoPathShape &rhs) | |
| void | map (const QTransform &matrix) |
| void | notifyPointsChanged () |
| QTransform | resizeMatrix (const QSizeF &newSize) const |
| KoSubpathList & | subpaths () |
| XXX: refactor this using setter? | |
| const KoSubpathList & | subpaths () const |
Protected Member Functions inherited from KoTosContainer | |
| KoTosContainer (const KoTosContainer &rhs) | |
| QRectF | preferredTextRect () const |
| void | setPreferredTextRect (const QRectF &rect) |
| void | shapeChanged (ChangeType type, KoShape *shape=0) override |
| KoShape * | textShape () const |
Protected Member Functions inherited from KoShapeContainer | |
| KoShapeContainer (const KoShapeContainer &rhs) | |
| void | setModel (KoShapeContainerModel *model) |
| void | setModelInit (KoShapeContainerModel *model) |
| virtual void | shapeCountChanged () |
Protected Member Functions inherited from KoShape | |
| KoShape (const KoShape &rhs) | |
| QList< ShapeChangeListener * > | listeners () const |
| void | setSizeImpl (const QSizeF &size) const |
| void | shapeChangedPriv (KoShape::ChangeType type) |
| QTransform | transform () const |
| return the current matrix that contains the rotation/scale/position of this shape | |
Private Member Functions | |
| void | closeMergeSubpathPriv (KoSubpath *subpath) |
| close-merges specified subpath | |
| void | closeSubpathPriv (KoSubpath *subpath) |
| closes specified subpath | |
| void | updateLastPriv (KoPathPoint **lastPoint) |
Private Attributes | |
| QScopedPointer< Private > | d |
The position of a path point within a path shape.
This is the base for all graphical objects.
All graphical objects are based on this object e.g. lines, rectangles, pies and so on.
The KoPathShape uses KoPathPoint's to describe the path of the shape.
Here a short example: 3 points connected by a curveTo's described by the following svg: M 100,200 C 100,100 250,100 250,200 C 250,200 400,300 400,200.
This will be stored in 3 KoPathPoint's as The first point contains in point 100,200 controlPoint2 100,100 The second point contains in point 250,200 controlPoint1 250,100 controlPoint2 250,300 The third point contains in point 400,300 controlPoint1 400,200
Not the segments are stored but the points. Out of the points the segments are generated. See the outline method. The reason for storing it like that is that it is the points that are modified by the user and not the segments.
Definition at line 62 of file KoPathShape.h.
| KoPathShape::KoPathShape | ( | ) |
constructor
Definition at line 60 of file KoPathShape.cpp.
|
override |
Definition at line 85 of file KoPathShape.cpp.
References clear().
|
protected |
constructor: to be used in cloneShape(), not in descendants!
Definition at line 66 of file KoPathShape.cpp.
References d, and subpaths().
| bool KoPathShape::addSubpath | ( | KoSubpath * | subpath, |
| int | subpathIndex ) |
Adds a subpath at the given index to the path.
| subpath | the subpath to add |
| subpathIndex | the index at which the new subpath should be inserted |
Definition at line 937 of file KoPathShape.cpp.
References d, notifyPointsChanged(), and KoPathPoint::setParent().
| KoPathPoint * KoPathShape::arcTo | ( | qreal | rx, |
| qreal | ry, | ||
| qreal | startAngle, | ||
| qreal | sweepAngle ) |
Add an arc.
Adds an arc starting at the current point. The arc will be converted to bezier curves.
| rx | x radius of the ellipse |
| ry | y radius of the ellipse |
| startAngle | the angle where the arc will be started |
| sweepAngle | the length of the angle TODO add param to have angle of the ellipse |
Definition at line 396 of file KoPathShape.cpp.
References arcToCurve(), KoPathPoint::CloseSubpath, curveTo(), d, moveTo(), KoPathPoint::point, and KoPathPoint::properties.
|
protected |
Add an arc.
Adds an arc starting at the current point. The arc will be converted to bezier curves.
| rx | x radius of the ellipse |
| ry | y radius of the ellipse |
| startAngle | the angle where the arc will be started |
| sweepAngle | the length of the angle TODO add param to have angle of the ellipse |
| offset | to the first point in the arc |
| curvePoints | an array which take the curve points, pass a 'QPointF curvePoints[12]'; |
Definition at line 418 of file KoPathShape.cpp.
| bool KoPathShape::autoFillMarkers | ( | ) | const |
Definition at line 1330 of file KoPathShape.cpp.
References d.
|
overridevirtual |
reimplemented
First we approximate the insets of the stroke by rendering a fat bezier curve with width set to the maximum inset of miters and markers. The are swept by this curve will be a good approximation of the real curve bounding rect.
NOTE: stroking the entire shape might be too expensive, so try to estimate the bounds using insets only...
Reimplemented from KoShape.
Definition at line 250 of file KoPathShape.cpp.
References KoShape::absoluteTransformation(), KoInsets::bottom, boundingRect(), KoFilterEffectStack::clipRectForBoundingRect(), KoShape::filterEffectStack(), KoShapeShadow::insets(), kisGrowRect(), KoInsets::left, outline(), pathStroke(), KoInsets::right, KoShape::shadow(), size(), KoShape::stroke(), KoInsets::top, and KoShape::transform().
| bool KoPathShape::breakAfter | ( | const KoPathPointIndex & | pointIndex | ) |
Breaks the path after the point index.
The new subpath will be behind the one that was broken. The segment between the given point and the one behind will be removed. If you want to split at one point insert first a copy of the point behind it. This does not work when the subpath is closed. Use openSubpath for this. It does not break at the last position of a subpath or if there is only one point in the subpath.
| pointIndex | index of the point after which the path should be broken |
Definition at line 755 of file KoPathShape.cpp.
References d, isClosedSubpath(), notifyPointsChanged(), size(), KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| void KoPathShape::clear | ( | ) |
Removes all subpaths and their points from the path.
Definition at line 95 of file KoPathShape.cpp.
References d, and notifyPointsChanged().
|
overridevirtual |
creates a deep copy of the shape or shape's subtree
Reimplemented from KoShape.
Reimplemented in RectangleShape, SpiralShape, and StarShape.
Definition at line 90 of file KoPathShape.cpp.
References KoPathShape().
| void KoPathShape::close | ( | ) |
Closes the current subpath.
Definition at line 476 of file KoPathShape.cpp.
References closeSubpathPriv(), and d.
| void KoPathShape::closeMerge | ( | ) |
Closes the current subpath.
It tries to merge the last and first point of the subpath to one point and then closes the subpath. If merging is not possible as the two point are to far from each other a close will be done. TODO define a maximum distance between the two points until this is working
Definition at line 484 of file KoPathShape.cpp.
References closeMergeSubpathPriv(), and d.
close-merges specified subpath
Definition at line 1025 of file KoPathShape.cpp.
References KoPathPoint::activeControlPoint1, KoPathPoint::CloseSubpath, closeSubpathPriv(), KoPathPoint::controlPoint1, notifyPointsChanged(), KoPathPoint::point, KoPathPoint::setControlPoint1(), KoPathPoint::setProperty(), KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| KoPathPointIndex KoPathShape::closeSubpath | ( | const KoPathPointIndex & | pointIndex | ) |
Close a open subpath.
The subpath is closed be inserting a segment between the start and end point, making the given point the new start point of the subpath.
Definition at line 856 of file KoPathShape.cpp.
References closeSubpathPriv(), d, isClosedSubpath(), notifyPointsChanged(), pathPointIndex(), KoPathPoint::StartSubpath, KoPathPoint::StopSubpath, and KoPathPoint::unsetProperty().
closes specified subpath
Definition at line 1014 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, and notifyPointsChanged().
| int KoPathShape::combine | ( | KoPathShape * | path | ) |
Combines two path shapes by appending the data of the specified path.
| path | the path to combine with |
Definition at line 952 of file KoPathShape.cpp.
References KoShape::absoluteTransformation(), d, KoPathPoint::map(), normalize(), and notifyPointsChanged().
|
static |
Creates path shape from given QPainterPath.
Definition at line 1247 of file KoPathShape.cpp.
References curveTo(), KoPathShape(), KoPathShapeId, lineTo(), moveTo(), and KoShape::setShapeId().
| KoPathPoint * KoPathShape::curveTo | ( | const QPointF & | c, |
| const QPointF & | p ) |
Adds a new quadratic Bezier curve segment.
Adds a quadratic Bezier curve between the last point and the given point p, using the control point specified by c.
| c | control point |
| p | the endpoint of this curve segment |
Definition at line 382 of file KoPathShape.cpp.
References d, moveTo(), notifyPointsChanged(), p, KoPathPoint::setControlPoint2(), KoPathPoint::StopSubpath, and updateLastPriv().
| KoPathPoint * KoPathShape::curveTo | ( | const QPointF & | c1, |
| const QPointF & | c2, | ||
| const QPointF & | p ) |
Adds a new cubic Bezier curve segment.
Adds a cubic Bezier curve between the last point and the given point p, using the control points specified by c1 and c2.
| c1 | control point1 |
| c2 | control point2 |
| p | the endpoint of this curve segment |
Definition at line 367 of file KoPathShape.cpp.
References d, moveTo(), notifyPointsChanged(), p, KoPathPoint::setControlPoint1(), KoPathPoint::setControlPoint2(), KoPathPoint::StopSubpath, and updateLastPriv().
| Qt::FillRule KoPathShape::fillRule | ( | ) | const |
Returns the fill rule for the path object.
Definition at line 1237 of file KoPathShape.cpp.
References d.
| bool KoPathShape::hasMarkers | ( | ) | const |
Definition at line 1325 of file KoPathShape.cpp.
References d.
|
overridevirtual |
reimplemented
Reimplemented from KoShape.
Definition at line 1277 of file KoPathShape.cpp.
References KoShape::absoluteTransformation(), KoInsets::bottom, hitTest(), KoShapeContainer::isClipped(), KoInsets::left, map(), outline(), KoShape::Private::parent, KoShape::position(), KoInsets::right, KoShape::shadow(), KoShape::stroke(), and KoInsets::top.
| bool KoPathShape::insertPoint | ( | KoPathPoint * | point, |
| const KoPathPointIndex & | pointIndex ) |
Inserts a new point into the given subpath at the specified position.
This method keeps the subpath closed if it is closed, and open when it was open. So it can change the properties of the point inserted. You might need to update the point before/after to get the desired result e.g. when you insert the point into a curve.
| point | to insert |
| pointIndex | index at which the point should be inserted |
Definition at line 673 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, notifyPointsChanged(), KoPathPoint::properties, KoPathPoint::setParent(), KoPathPoint::setProperties(), KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| bool KoPathShape::isClosedSubpath | ( | int | subpathIndex | ) | const |
Checks if a subpath is closed.
| subpathIndex | index of the subpath to check |
Definition at line 660 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, and d.
| bool KoPathShape::join | ( | int | subpathIndex | ) |
Joins the given subpath with the following one.
Joins the given subpath with the following one by inserting a segment between the two subpaths. This does nothing if the specified subpath is the last subpath or one of both subpaths is closed.
| subpathIndex | index of the subpath being joined with the following subpath |
Definition at line 781 of file KoPathShape.cpp.
References d, isClosedSubpath(), notifyPointsChanged(), p, KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| KoPathPoint * KoPathShape::lineTo | ( | const QPointF & | p | ) |
Adds a new line segment.
Adds a straight line between the last point and the given point p.
Definition at line 354 of file KoPathShape.cpp.
References d, moveTo(), notifyPointsChanged(), p, KoPathPoint::StopSubpath, and updateLastPriv().
| void KoPathShape::loadNodeTypes | ( | const QString & | nodeTypes | ) |
Loads node types.
Definition at line 1211 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, nodeTypes(), KoPathPoint::StopSubpath, updateNodeType(), and warnFlake.
|
protected |
Definition at line 1064 of file KoPathShape.cpp.
References d.
| KoMarker * KoPathShape::marker | ( | KoFlake::MarkerPosition | pos | ) | const |
Definition at line 1320 of file KoPathShape.cpp.
References d.
| bool KoPathShape::moveSubpath | ( | int | oldSubpathIndex, |
| int | newSubpathIndex ) |
Moves the position of a subpath within a path.
| oldSubpathIndex | old index of the subpath |
| newSubpathIndex | new index of the subpath |
Definition at line 810 of file KoPathShape.cpp.
References d, and notifyPointsChanged().
| KoPathPoint * KoPathShape::moveTo | ( | const QPointF & | p | ) |
Starts a new Subpath.
Moves the pen to p and starts a new subpath.
Definition at line 344 of file KoPathShape.cpp.
References d, notifyPointsChanged(), p, KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| QString KoPathShape::nodeTypes | ( | ) | const |
Saves the node types.
This is inspired by inkscape and uses the same mechanism as they do. This attribute contains of a string which has the node type of each point in it. The following node types exist:
c corner s smooth z symmetric
The first point of a path is always of the type c. If the path is closed the type of the first point is saved in the last element E.g. you have a closed path with 2 points in it. The first one (start/end of path) is symmetric and the second one is smooth that will result in the nodeType="czs" So if there is a closed sub path the nodeTypes contain one more entry then there are points. That is due to the first and the last point of a closed sub path get merged into one when they are on the same position.
Definition at line 1177 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, nodeType(), and KoPathPoint::StopSubpath.
|
virtual |
Normalizes the path data.
The path points are transformed so that the top-left corner of the bounding rect is at (0,0). This should be called after adding points to the path or changing positions of path points.
Reimplemented in KoParameterShape, EllipseShape, EnhancedPathShape, SpiralShape, and KarbonCalligraphicShape.
Definition at line 492 of file KoPathShape.cpp.
References KoShape::applyTransformation(), boundingRect(), KoShape::ContentChanged, d, outline(), and KoShape::shapeChangedPriv().
|
protected |
Definition at line 1350 of file KoPathShape.cpp.
References KoShape::Private::listeners, and KoPathShape::PointSelectionChangeListener::notifyPathPointsChanged().
| KoPathPointIndex KoPathShape::openSubpath | ( | const KoPathPointIndex & | pointIndex | ) |
Opens a closed subpath.
The subpath is opened by removing the segment before the given point, making the given point the new start point of the subpath.
| pointIndex | the index of the point at which to open the closed subpath |
Definition at line 828 of file KoPathShape.cpp.
References d, isClosedSubpath(), notifyPointsChanged(), pathPointIndex(), KoPathPoint::StartSubpath, KoPathPoint::StopSubpath, and KoPathPoint::unsetProperty().
|
overridevirtual |
reimplemented
Reimplemented from KoShape.
Definition at line 185 of file KoPathShape.cpp.
References KoPathPoint::activeControlPoint1, KoPathPoint::activeControlPoint2, KoPathPoint::CloseSubpath, KoPathPoint::controlPoint1, KoPathPoint::controlPoint2, d, KoPathPoint::point, KoPathPoint::properties, qIsNaNPoint(), KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
|
overridevirtual |
reimplemented
Reimplemented from KoShape.
Definition at line 180 of file KoPathShape.cpp.
References outline().
|
overridevirtual |
reimplemented
Implements KoShape.
Definition at line 107 of file KoPathShape.cpp.
References KoShape::background(), d, and outline().
|
virtual |
Definition at line 169 of file KoPathShape.cpp.
References d, and KoPathPoint::Node.
| KoPathPointIndex KoPathShape::pathPointIndex | ( | const KoPathPoint * | point | ) | const |
Returns the path point index of a given path point.
| point | the point for which you want to get the index |
Definition at line 589 of file KoPathShape.cpp.
References d.
|
virtual |
Returns the specific path shape id.
Path shape derived shapes have a different shape id which link them to their respective shape factories. In most cases they do not have a special tool for editing them. This function returns the specific shape id for finding the shape factory from KoShapeRegistry. The default KoPathShapeId is returned from KoShape::shapeId() so that the generic path editing tool gets activated when the shape is selected.
Reimplemented in EllipseShape, RectangleShape, SpiralShape, StarShape, and KarbonCalligraphicShape.
Definition at line 1077 of file KoPathShape.cpp.
References KoPathShapeId.
| QPainterPath KoPathShape::pathStroke | ( | const QPen & | pen | ) | const |
Definition at line 1360 of file KoPathShape.cpp.
| KoPathPoint * KoPathShape::pointByIndex | ( | const KoPathPointIndex & | pointIndex | ) | const |
Returns the path point specified by a path point index.
| pointIndex | index of the point to get |
Definition at line 602 of file KoPathShape.cpp.
References d.
| int KoPathShape::pointCount | ( | ) | const |
Returns the number of points in the path.
Definition at line 634 of file KoPathShape.cpp.
References d.
| QList< KoPathPoint * > KoPathShape::pointsAt | ( | const QRectF & | rect, |
| const bool | useControlPoints = false ) const |
Returns the path points within the given rectangle.
| rect | the rectangle the requested points are in |
| useControlPoints | whether to add control points to result or not |
Definition at line 543 of file KoPathShape.cpp.
References d.
| void KoPathShape::recommendPointSelectionChange | ( | const QList< KoPathPointIndex > & | newSelection | ) |
Definition at line 1340 of file KoPathShape.cpp.
References KoShape::Private::listeners, and KoPathShape::PointSelectionChangeListener::recommendPointSelectionChange().
| KoPathPoint * KoPathShape::removePoint | ( | const KoPathPointIndex & | pointIndex | ) |
Removes a point from the path.
Note that the ownership of the point will pass to the caller.
| pointIndex | index of the point which should be removed |
Definition at line 715 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, notifyPointsChanged(), pointCount(), KoPathPoint::properties, KoPathPoint::setParent(), KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| KoSubpath * KoPathShape::removeSubpath | ( | int | subpathIndex | ) |
Removes subpath from the path.
| subpathIndex | the index of the subpath to remove |
Definition at line 921 of file KoPathShape.cpp.
References d, notifyPointsChanged(), and KoPathPoint::setParent().
|
protected |
Get the resize matrix
This makes sure that also if the newSize isNull that there will be a very small size of 0.000001 pixels
Definition at line 323 of file KoPathShape.cpp.
References size().
| bool KoPathShape::reverseSubpath | ( | int | subpathIndex | ) |
Reverse subpath.
The last point becomes the first point and the first one becomes the last one.
| subpathIndex | the index of the subpath to reverse |
Definition at line 884 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, notifyPointsChanged(), p, KoPathPoint::properties, KoPathPoint::setProperties(), size(), KoPathPoint::StartSubpath, and KoPathPoint::StopSubpath.
| KoPathSegment KoPathShape::segmentByIndex | ( | const KoPathPointIndex & | pointIndex | ) | const |
Returns the segment specified by a path point index.
A segment is defined by the point index of the first point in the segment. A segment contains the defined point and its following point. If the subpath is closed and the and the pointIndex point to the last point in the subpath, the following point is the first point in the subpath.
| pointIndex | index of the first point of the segment |
Definition at line 612 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, KoPathPoint::properties, and size().
| QList< KoPathSegment > KoPathShape::segmentsAt | ( | const QRectF & | rect | ) | const |
Returns the list of path segments within the given rectangle.
| rect | the rectangle the requested segments are in |
Definition at line 564 of file KoPathShape.cpp.
References d, isClosedSubpath(), pointCount(), KoShape::s, and subpathCount().
| bool KoPathShape::separate | ( | QList< KoPathShape * > & | separatedPaths | ) |
Creates separate path shapes, one for each existing subpath.
| separatedPaths | the list which contains the separated path shapes |
Definition at line 981 of file KoPathShape.cpp.
References KoShape::absoluteTransformation(), KoShape::background(), d, KoPathShape(), KoPathPoint::map(), normalize(), KoShape::setBackground(), KoShape::setShapeId(), KoShape::setStroke(), KoShape::setZIndex(), KoShape::shapeId(), KoShape::stroke(), and KoShape::zIndex().
| void KoPathShape::setAutoFillMarkers | ( | bool | value | ) |
Definition at line 1335 of file KoPathShape.cpp.
| void KoPathShape::setFillRule | ( | Qt::FillRule | fillRule | ) |
Sets the fill rule to be used for painting the background.
Definition at line 1242 of file KoPathShape.cpp.
References d, and fillRule().
| void KoPathShape::setMarker | ( | KoMarker * | marker, |
| KoFlake::MarkerPosition | pos ) |
Definition at line 1308 of file KoPathShape.cpp.
References d, marker(), KoShape::notifyChanged(), KoShape::shapeChangedPriv(), and KoShape::StrokeChanged.
|
overridevirtual |
Resize the shape
This makes sure that the pathshape will not be resized to 0 if the new size is null as that makes it impossible to undo the change.
All functions that overwrite this function should also use the resizeMatrix function to get and use the same data in resizing.
Reimplemented from KoShape.
Reimplemented in SpiralShape, and StarShape.
Definition at line 315 of file KoPathShape.cpp.
References d, resizeMatrix(), and KoShape::setSize().
|
overridevirtual |
reimplemented
Reimplemented from KoShape.
Definition at line 308 of file KoPathShape.cpp.
References outlineRect().
| int KoPathShape::subpathCount | ( | ) | const |
Returns the number of subpaths in the path.
Definition at line 645 of file KoPathShape.cpp.
References d.
| int KoPathShape::subpathPointCount | ( | int | subpathIndex | ) | const |
Returns the number of points in a subpath.
Definition at line 650 of file KoPathShape.cpp.
References d.
|
protected |
|
protected |
| QString KoPathShape::toString | ( | const QTransform & | matrix = QTransform() | ) | const |
Returns a odf/svg string representation of the path data with the given matrix applied.
Definition at line 1082 of file KoPathShape.cpp.
References KoPathPoint::activeControlPoint1, KoPathPoint::activeControlPoint2, KoPathPoint::CloseSubpath, KoPathPoint::controlPoint1, KoPathPoint::controlPoint2, d, KoPathSegment::first, p, KoPathPoint::point, KoPathPoint::properties, KoPathSegment::second, KoPathPoint::StartSubpath, KoPathPoint::StopSubpath, and KoPathSegment::toCubic().
|
private |
Definition at line 519 of file KoPathShape.cpp.
References KoPathPoint::CloseSubpath, d, KoPathPoint::Normal, KoPathPoint::setProperties(), KoPathPoint::StopSubpath, and KoPathPoint::unsetProperty().
|
private |
Definition at line 524 of file KoPathShape.h.