|
Krita Source Code Documentation
|
#include <EnhancedPathShape.h>
Inheritance diagram for EnhancedPathShape:Public Member Functions | |
| void | addCommand (const QString &command) |
| Add command for instance "M 0 0". | |
| void | addFormula (const QString &name, const QString &formula) |
| Add formula with given name and textual representation. | |
| void | addHandle (const QMap< QString, QVariant > &handle) |
| Add a single handle with format: x y minX maxX minY maxY. | |
| void | addModifiers (const QString &modifiers) |
| Add modifiers with format: modifier0 modifier1 modifier2 ... | |
| KoShape * | cloneShape () const override |
| creates a deep copy of the shape or shape's subtree | |
| EnhancedPathShape (const QRect &viewBox) | |
| qreal | evaluateConstantOrReference (const QString &val) |
| qreal | evaluateReference (const QString &reference) |
| void | modifyReference (const QString &reference, qreal value) |
| QPointF | normalize () override |
| Normalizes the path data. | |
| EnhancedPathParameter * | parameter (const QString &text) |
| Returns parameter from given textual representation. | |
| void | setMirrorHorizontally (bool mirrorHorizontally) |
| Sets if the shape is to be mirrored horizontally before applying any other transformations. | |
| void | setMirrorVertically (bool mirrorVertically) |
| Sets if the shape is to be mirrored vertically before applying any other transformations. | |
| void | setPathStretchPointX (qreal pathStretchPointX) |
| void | setPathStretchPointY (qreal pathStretchPointY) |
| void | setSize (const QSizeF &newSize) override |
| Resize the shape. | |
| QPointF | shapeToViewbox (const QPointF &point) const |
| Converts from shape coordinates to viewbox coordinates. | |
| QRect | viewBox () const |
| Returns the viewbox of the enhanced path shape. | |
| ~EnhancedPathShape () override | |
Public Member Functions inherited from KoParameterShape | |
| int | handleCount () const |
| return the number of handles set on the shape | |
| int | handleIdAt (const QRectF &rect) const |
| Get the id of the handle within the given rect. | |
| QPointF | handlePosition (int handleId) const |
| Get the handle position. | |
| bool | isParametricShape () const |
| Check if object is a parametric shape. | |
| KoParameterShape () | |
| void | moveHandle (int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier) |
| Move handle to point. | |
| QPointF | normalize () override |
| Normalizes the path data. | |
| void | paintHandle (KisHandlePainterHelper &handlesHelper, int handleId) |
| Paint the given handles. | |
| void | paintHandles (KisHandlePainterHelper &handlesHelper) |
| Paint the handles. | |
| Private () | |
| Private (const KoParameterShape::Private &rhs) | |
| void | setParametricShape (bool parametric) |
| Set if the shape can be modified using parameters. | |
| void | setSize (const QSizeF &size) override |
| reimplemented from KoShape | |
| ~KoParameterShape () override | |
| virtual | ~Private ()=default |
Public Member Functions inherited from KoPathShape | |
| 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. | |
| 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 | |
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. | |
Protected Member Functions | |
| void | moveHandleAction (int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier) override |
| Updates the internal state of a KoParameterShape. | |
| void | shapeChanged (ChangeType type, KoShape *shape=0) override |
| void | updatePath (const QSizeF &size) override |
| Update the path of the parameter shape. | |
Protected Member Functions inherited from KoParameterShape | |
| QList< QPointF > | handles () const |
| KoParameterShape (const KoParameterShape &rhs) | |
| constructor | |
| void | setHandles (const QList< QPointF > &handles) |
Protected Member Functions inherited from KoPathShape | |
| 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 Types | |
| typedef QMap< QString, EnhancedPathFormula * > | FormulaStore |
| typedef QList< qreal > | ModifierStore |
| typedef QMap< QString, EnhancedPathParameter * > | ParameterStore |
Private Member Functions | |
| void | addCommand (const QString &command, bool triggerUpdate) |
| Adds a new command. | |
| void | enableResultCache (bool enable) |
| Enables caching results. | |
| EnhancedPathShape (const EnhancedPathShape &rhs) | |
| void | evaluateHandles () |
| void | parsePathData (const QString &data) |
| parses the enhanced path data | |
| void | reset () |
| void | updateTextArea () |
| Updates the size and position of an optionally existing text-on-shape text area. | |
| bool | useStretchPoints (const QSizeF &size, qreal &scale) |
Private Attributes | |
| bool | m_cacheResults |
| indicates if result cache is enabled | |
| QList< EnhancedPathCommand * > | m_commands |
| the commands creating the outline | |
| QList< EnhancedPathHandle * > | m_enhancedHandles |
| the handles for modifying the shape | |
| FormulaStore | m_formulae |
| the formulae | |
| bool | m_mirrorHorizontally |
| whether or not the shape is to be mirrored horizontally before transforming it | |
| QTransform | m_mirrorMatrix |
| matrix to used for mirroring | |
| bool | m_mirrorVertically |
| whether or not the shape is to be mirrored vertically before transforming it | |
| ModifierStore | m_modifiers |
| the modifier values | |
| ParameterStore | m_parameters |
| the shared parameters | |
| qreal | m_pathStretchPointX |
| draw:path-stretchpoint-x attribute | |
| qreal | m_pathStretchPointY |
| draw:path-stretchpoint-y attribute | |
| QHash< QString, qreal > | m_resultCache |
| cache for intermediate results used when evaluating path | |
| QStringList | m_textArea |
| QRectF | m_viewBound |
| the bounding box of the path in viewbox coordinates | |
| QRect | m_viewBox |
| the viewbox rectangle | |
| QPointF | m_viewBoxOffset |
| QTransform | m_viewMatrix |
| matrix to convert from viewbox coordinates to shape coordinates | |
Additional Inherited Members | |
Public Types inherited from KoTosContainer | |
| enum | ResizeBehavior { TextFollowsSize , FollowTextSize , IndependentSizes , TextFollowsPreferredTextRect } |
| different kinds of resizing behavior to determine how to treat text overflow More... | |
Public Types inherited from KoShape | |
| enum | ChangeType { PositionChanged , RotationChanged , ScaleChanged , ShearChanged , SizeChanged , GenericMatrixChange , KeepAspectRatioChange , ParentChanged , Deleted , StrokeChanged , BackgroundChanged , ShadowChanged , BorderChanged , ParameterChanged , ContentChanged , TextRunAroundChanged , ChildChanged , ConnectionPointChanged , ClipPathChanged , ClipMaskChanged , TransparencyChanged } |
| Used by shapeChanged() to select which change was made. More... | |
| enum | ChildZOrderPolicy { ChildZDefault , ChildZParentChild = ChildZDefault , ChildZPassThrough } |
| Used by compareShapeZIndex() to order shapes. More... | |
| enum | PaintOrder { Fill , Stroke , Markers } |
| enum | RunThroughLevel { Background , Foreground } |
| enum | TextRunAroundContour { ContourBox , ContourFull , ContourOutside } |
| The behavior text should do when intersecting this shape. More... | |
| enum | TextRunAroundSide { BiggestRunAroundSide , LeftRunAroundSide , RightRunAroundSide , EnoughRunAroundSide , BothRunAroundSide , NoRunAround , RunThrough } |
| The behavior text should do when intersecting this shape. More... | |
Static Public Member Functions inherited from KoPathShape | |
| 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) |
Public Attributes inherited from KoParameterShape | |
| QList< QPointF > | handles |
| the handles that the user can grab and change | |
| bool | parametric |
Public Attributes inherited from KoShapeContainer | |
| KoShapeContainerModel * | model |
| KoShapeContainer::ShapeInterface | shapeInterface |
Static Public Attributes inherited from KoShape | |
| static const qint16 | maxZIndex = std::numeric_limits<qint16>::max() |
| static const qint16 | minZIndex = std::numeric_limits<qint16>::min() |
An enhanced shape is a custom shape which can be defined by enhanced geometry data. The data consists of a list of commands like moveto, lineto, curveto, etc. which are used to create the outline of the shape. The coordinates or parameters of the commands can be constant values, named variables (identifiers), modifiers, functions or formulae.
Definition at line 37 of file EnhancedPathShape.h.
|
private |
Definition at line 145 of file EnhancedPathShape.h.
|
private |
Definition at line 146 of file EnhancedPathShape.h.
|
private |
Definition at line 147 of file EnhancedPathShape.h.
| EnhancedPathShape::EnhancedPathShape | ( | const QRect & | viewBox | ) |
Definition at line 28 of file EnhancedPathShape.cpp.
|
override |
Definition at line 61 of file EnhancedPathShape.cpp.
References reset().
|
private |
Definition at line 39 of file EnhancedPathShape.cpp.
| void EnhancedPathShape::addCommand | ( | const QString & | command | ) |
Add command for instance "M 0 0".
Definition at line 370 of file EnhancedPathShape.cpp.
References addCommand().
|
private |
Adds a new command.
Definition at line 375 of file EnhancedPathShape.cpp.
References EnhancedPathCommand::addParameter(), m_commands, parameter(), KoPathShape::size(), and updatePath().
| void EnhancedPathShape::addFormula | ( | const QString & | name, |
| const QString & | formula ) |
Add formula with given name and textual representation.
Definition at line 297 of file EnhancedPathShape.cpp.
References m_formulae, and KoShape::name().
| void EnhancedPathShape::addHandle | ( | const QMap< QString, QVariant > & | handle | ) |
Add a single handle with format: x y minX maxX minY maxY.
Definition at line 306 of file EnhancedPathShape.cpp.
References evaluateHandles(), m_enhancedHandles, parameter(), KoShape::position(), EnhancedPathHandle::setPolarCenter(), EnhancedPathHandle::setPosition(), EnhancedPathHandle::setRadiusRange(), EnhancedPathHandle::setRangeX(), and EnhancedPathHandle::setRangeY().
| void EnhancedPathShape::addModifiers | ( | const QString & | modifiers | ) |
Add modifiers with format: modifier0 modifier1 modifier2 ...
Definition at line 357 of file EnhancedPathShape.cpp.
References m_modifiers, and toDouble().
|
overridevirtual |
creates a deep copy of the shape or shape's subtree
Reimplemented from KoShape.
Definition at line 66 of file EnhancedPathShape.cpp.
References EnhancedPathShape().
|
private |
Enables caching results.
Definition at line 524 of file EnhancedPathShape.cpp.
References m_cacheResults, and m_resultCache.
| qreal EnhancedPathShape::evaluateConstantOrReference | ( | const QString & | val | ) |
Evaluates the given constant or reference to a identifier, modifier or formula.
| val | the value to evaluate |
Definition at line 237 of file EnhancedPathShape.cpp.
References evaluateReference().
|
private |
Definition at line 175 of file EnhancedPathShape.cpp.
References KoParameterShape::handleCount(), KoParameterShape::handles, m_enhancedHandles, KoShape::position(), and KoParameterShape::setHandles().
| qreal EnhancedPathShape::evaluateReference | ( | const QString & | reference | ) |
Evaluates the given reference to a identifier, modifier or formula.
| reference | the reference to evaluate |
Definition at line 190 of file EnhancedPathShape.cpp.
References EnhancedPathFormula::evaluate(), m_cacheResults, m_formulae, m_modifiers, m_resultCache, and p.
| void EnhancedPathShape::modifyReference | ( | const QString & | reference, |
| qreal | value ) |
Attempts to modify a given reference.
Only modifiers can me modified, others silently ignore the attempt.
| reference | the reference to modify |
| value | the new value |
Definition at line 247 of file EnhancedPathShape.cpp.
References m_modifiers, and value().
|
overrideprotectedvirtual |
Updates the internal state of a KoParameterShape.
This method is called from moveHandle.
| handleId | of the handle |
| point | to move the handle to in shape coordinates |
| modifiers | used during move to point |
Implements KoParameterShape.
Definition at line 89 of file EnhancedPathShape.cpp.
References EnhancedPathHandle::changePosition(), m_enhancedHandles, and shapeToViewbox().
|
overridevirtual |
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 from KoPathShape.
Definition at line 161 of file EnhancedPathShape.cpp.
References m_viewBoxOffset, and KoParameterShape::normalize().
| EnhancedPathParameter * EnhancedPathShape::parameter | ( | const QString & | text | ) |
Returns parameter from given textual representation.
Definition at line 264 of file EnhancedPathShape.cpp.
References EnhancedPathNamedParameter::identifierFromString(), IdentifierUnknown, m_parameters, and parameter().
|
private |
parses the enhanced path data
Definition at line 449 of file EnhancedPathShape.cpp.
References addCommand(), KoPathShape::size(), and updatePath().
|
private |
Definition at line 71 of file EnhancedPathShape.cpp.
References KoPathShape::clear(), m_commands, m_enhancedHandles, m_formulae, m_modifiers, m_parameters, m_textArea, m_viewBoxOffset, m_viewMatrix, and KoParameterShape::setHandles().
| void EnhancedPathShape::setMirrorHorizontally | ( | bool | mirrorHorizontally | ) |
Sets if the shape is to be mirrored horizontally before applying any other transformations.
Definition at line 483 of file EnhancedPathShape.cpp.
References m_mirrorHorizontally, KoPathShape::size(), and updatePath().
| void EnhancedPathShape::setMirrorVertically | ( | bool | mirrorVertically | ) |
Sets if the shape is to be mirrored vertically before applying any other transformations.
Definition at line 492 of file EnhancedPathShape.cpp.
References m_mirrorVertically, KoPathShape::size(), and updatePath().
| void EnhancedPathShape::setPathStretchPointX | ( | qreal | pathStretchPointX | ) |
Definition at line 530 of file EnhancedPathShape.cpp.
References m_pathStretchPointX.
| void EnhancedPathShape::setPathStretchPointY | ( | qreal | pathStretchPointY | ) |
Definition at line 538 of file EnhancedPathShape.cpp.
References m_pathStretchPointY.
|
overridevirtual |
Resize the shape.
| size | the new size of the shape. This is different from scaling as scaling is a so called secondary operation which is comparable to zooming in instead of changing the size of the basic shape. Easiest example of this difference is that using this method will not distort the size of pattern-fills and strokes. |
Reimplemented from KoShape.
Definition at line 145 of file EnhancedPathShape.cpp.
References m_viewBound, m_viewMatrix, KoParameterShape::setSize(), and updatePath().
|
overrideprotectedvirtual |
A hook that allows inheriting classes to do something after a KoShape property changed This is called whenever the shape, position rotation or scale properties were altered.
| type | an indicator which type was changed. |
| shape | the shape. |
Reimplemented from KoShape.
Definition at line 500 of file EnhancedPathShape.cpp.
References KoShape::ParameterChanged, KoShape::ParentChanged, KoShape::shapeChanged(), and updateTextArea().
| QPointF EnhancedPathShape::shapeToViewbox | ( | const QPointF & | point | ) | const |
Converts from shape coordinates to viewbox coordinates.
Definition at line 170 of file EnhancedPathShape.cpp.
References m_mirrorMatrix, m_viewBoxOffset, and m_viewMatrix.
|
overrideprotectedvirtual |
Update the path of the parameter shape.
| size | of the shape |
Implements KoParameterShape.
Definition at line 98 of file EnhancedPathShape.cpp.
References KoPathShape::clear(), enableResultCache(), EnhancedPathCommand::execute(), KoParameterShape::handleCount(), KoParameterShape::handles, KoParameterShape::isParametricShape(), m_commands, m_enhancedHandles, m_mirrorHorizontally, m_mirrorMatrix, m_mirrorVertically, m_viewBound, m_viewBoxOffset, m_viewMatrix, KoPathPoint::map(), normalize(), KoPathShape::outline(), KoParameterShape::setHandles(), KoPathShape::size(), KoPathShape::subpaths(), and useStretchPoints().
|
private |
Updates the size and position of an optionally existing text-on-shape text area.
Definition at line 511 of file EnhancedPathShape.cpp.
References evaluateConstantOrReference(), m_textArea, m_viewBox, m_viewBoxOffset, m_viewMatrix, and KoTosContainer::setPreferredTextRect().
|
private |
Definition at line 402 of file EnhancedPathShape.cpp.
References KoPathPoint::controlPoint1, KoPathPoint::controlPoint2, m_pathStretchPointX, m_pathStretchPointY, m_viewBox, KoPathShape::notifyPointsChanged(), KoPathPoint::point, KoShape::scale(), KoPathPoint::setControlPoint1(), KoPathPoint::setControlPoint2(), KoPathPoint::setPoint(), KoPathShape::size(), and KoPathShape::subpaths().
| QRect EnhancedPathShape::viewBox | ( | ) | const |
Returns the viewbox of the enhanced path shape.
Definition at line 185 of file EnhancedPathShape.cpp.
References m_viewBox.
|
private |
indicates if result cache is enabled
Definition at line 165 of file EnhancedPathShape.h.
|
private |
the commands creating the outline
Definition at line 155 of file EnhancedPathShape.h.
|
private |
the handles for modifying the shape
Definition at line 156 of file EnhancedPathShape.h.
|
private |
the formulae
Definition at line 157 of file EnhancedPathShape.h.
|
private |
whether or not the shape is to be mirrored horizontally before transforming it
Definition at line 161 of file EnhancedPathShape.h.
|
private |
matrix to used for mirroring
Definition at line 152 of file EnhancedPathShape.h.
|
private |
whether or not the shape is to be mirrored vertically before transforming it
Definition at line 160 of file EnhancedPathShape.h.
|
private |
the modifier values
Definition at line 158 of file EnhancedPathShape.h.
|
private |
the shared parameters
Definition at line 159 of file EnhancedPathShape.h.
|
private |
draw:path-stretchpoint-x attribute
Definition at line 162 of file EnhancedPathShape.h.
|
private |
draw:path-stretchpoint-y attribute
Definition at line 163 of file EnhancedPathShape.h.
|
private |
cache for intermediate results used when evaluating path
Definition at line 164 of file EnhancedPathShape.h.
|
private |
Definition at line 154 of file EnhancedPathShape.h.
|
private |
the bounding box of the path in viewbox coordinates
Definition at line 150 of file EnhancedPathShape.h.
|
private |
the viewbox rectangle
Definition at line 149 of file EnhancedPathShape.h.
|
private |
Definition at line 153 of file EnhancedPathShape.h.
|
private |
matrix to convert from viewbox coordinates to shape coordinates
Definition at line 151 of file EnhancedPathShape.h.