|
Krita Source Code Documentation
|
#include <KoShape.h>
Inheritance diagram for KoShape:Classes | |
| class | Private |
| struct | ShapeChangeListener |
| class | SharedData |
Public Types | |
| enum | ChangeType { PositionChanged , RotationChanged , ScaleChanged , ShearChanged , SizeChanged , GenericMatrixChange , KeepAspectRatioChange , ParentChanged , Deleted , StrokeChanged , BackgroundChanged , BorderChanged , ParameterChanged , ContentChanged , TextContourMarginChanged , 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 } |
Public Member Functions | |
| 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 QRectF | boundingRect () const |
| Get the bounding box of the shape. | |
| 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. | |
| virtual KoShape * | cloneShape () const |
| creates a deep copy of the shape or shape's subtree | |
| 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. | |
| 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 |
| virtual bool | hitTest (const QPointF &position) const |
| Check if the shape is hit on position. | |
| 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 QPainterPath | outline () const |
| virtual QRectF | outlineRect () const |
| virtual void | paint (QPainter &painter) const =0 |
Paint the shape fill The class extending this one is responsible for painting itself. painter is expected to be preconfigured to work in "document" pixels. | |
| 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 |
| 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 | 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 | setShapeId (const QString &id) |
| virtual void | setSize (const QSizeF &size) |
| Resize the shape. | |
| virtual void | setStroke (KoShapeStrokeModelSP stroke) |
| 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) |
| 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 QSizeF | size () const |
| Get the size of the shape in pt. | |
| virtual KoSnapData | snapData () const |
| Returns additional snap data the shape wants to have snapping to. | |
| virtual KoShapeStrokeModelSP | stroke () const |
| KoInsets | strokeInsets () const |
| QSet< KoShape * > | toolDelegates () const |
| QTransform | transformation () const |
| Returns the shapes local transformation matrix. | |
| qreal | transparency (bool recursive=false) const |
| virtual void | update () 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 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) |
Static Public Attributes | |
| static const qint16 | maxZIndex = std::numeric_limits<qint16>::max() |
| static const qint16 | minZIndex = std::numeric_limits<qint16>::min() |
Protected Member Functions | |
| KoShape (const KoShape &rhs) | |
| QList< ShapeChangeListener * > | listeners () const |
| void | setSizeImpl (const QSizeF &size) const |
| virtual void | shapeChanged (ChangeType type, KoShape *shape=0) |
| 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 | addShapeManager (KoShapeManager *manager) |
| void | removeShapeManager (KoShapeManager *manager) |
Private Attributes | |
| QScopedPointer< Private > | d |
| QSharedDataPointer< SharedData > | s |
Friends | |
| class | KoShapeManager |
Base class for all flake shapes. Shapes extend this class to allow themselves to be manipulated. This class just represents a graphical shape in the document and can be manipulated by some default tools in this library.
Due to the limited responsibility of this class, the extending object can have any data backend and is responsible for painting itself.
We strongly suggest that any extending class will use a Model View Controller (MVC) design where the View part is all in this class, as well as the one that inherits from this one. This allows the data that rests in the model to be reused in different parts of the document. For example by having two flake objects that show that same data. Or each showing a section of it.
The KoShape data is completely in postscript-points (pt) (see KoUnit for conversion methods to and from points). This image will explain the real-world use of the shape and its options. 
The Rotation center can be returned with absolutePosition()
Flake objects can be created in three ways:
We had several notification methods that allow your shape to be notified of changes in other shapes positions or rotation etc.
| enum KoShape::ChangeType |
Used by shapeChanged() to select which change was made.
| Enumerator | |
|---|---|
| PositionChanged | used after a setPosition() |
| RotationChanged | used after a setRotation() |
| ScaleChanged | used after a scale() |
| ShearChanged | used after a shear() |
| SizeChanged | used after a setSize() |
| GenericMatrixChange | used after the matrix was changed without knowing which property explicitly changed |
| KeepAspectRatioChange | used after setKeepAspectRatio() |
| ParentChanged | used after a setParent() |
| Deleted | the shape was deleted |
| StrokeChanged | the shapes stroke has changed |
| BackgroundChanged | the shapes background has changed |
| BorderChanged | the shapes border has changed |
| ParameterChanged | the shapes parameter has changed (KoParameterShape only) |
| ContentChanged | the content of the shape changed e.g. a new image inside a pixmap/text change inside a textshape |
| TextContourMarginChanged | used after text properties changed and modified the contour margin in the text shape |
| ChildChanged | a child of a container was changed/removed. This is propagated to all parents |
| ConnectionPointChanged | a connection point has changed |
| ClipPathChanged | the shapes clip path has changed |
| ClipMaskChanged | the shapes clip path has changed |
| TransparencyChanged | the shapetransparency value has changed |
Definition at line 92 of file KoShape.h.
Used by compareShapeZIndex() to order shapes.
| Enumerator | |
|---|---|
| ChildZDefault | |
| ChildZParentChild | normal parent/child ordering |
| ChildZPassThrough | children are considered equal to this shape |
Definition at line 523 of file KoShape.h.
| enum KoShape::PaintOrder |
| KoShape::KoShape | ( | ) |
Constructor.
Definition at line 135 of file KoShape.cpp.
References notifyChanged().
|
virtual |
Destructor.
The shape must have already been detached from all the parents and shape managers. Otherwise we might accidentally request some RTTI information, which is not available anymore (we are in d-tor).
TL;DR: fix the code that caused this destruction without unparenting instead of trying to remove these assert!
Definition at line 148 of file KoShape.cpp.
References d, Deleted, KIS_SAFE_ASSERT_RECOVER, KoShapeManager::ShapeInterface::notifyShapeDestructed(), shapeChangedPriv(), and KoShapeManager::shapeInterface.
|
protected |
| QRectF KoShape::absoluteOutlineRect | ( | ) | const |
Definition at line 321 of file KoShape.cpp.
References absoluteTransformation(), and outline().
Same as a member function, but applies to a list of shapes and returns a united rect.
Definition at line 326 of file KoShape.cpp.
References absoluteOutlineRect().
| QPointF KoShape::absolutePosition | ( | KoFlake::AnchorPosition | anchor = KoFlake::Center | ) | const |
Return the position of this shape regardless of rotation/skew/scaling and regardless of this shape having a parent (being in a group) or not.
| anchor | The place on the (unaltered) shape that you want the position of. |
Definition at line 573 of file KoShape.cpp.
References absoluteTransformation(), anchor(), KoFlake::anchorToPoint(), and outlineRect().
| QTransform KoShape::absoluteTransformation | ( | ) | const |
Create a matrix that describes all the transformations done on this shape.
The absolute transformation is the combined transformation of this shape and all its parents and grandparents.
Definition at line 335 of file KoShape.cpp.
References absolutePosition(), absoluteTransformation(), d, KoShapeContainer::inheritsTransform(), parent(), s, and size().
| bool KoShape::addDependee | ( | KoShape * | shape | ) |
Adds a shape which depends on this shape. Making a shape dependent on this one means it will get shapeChanged() called on each update of this shape.
If this shape already depends on the given shape, establishing the dependency is refused to prevent circular dependencies.
| shape | the shape which depends on this shape |
Definition at line 1026 of file KoShape.cpp.
References addShapeChangeListener(), d, and hasDependee().
| QString KoShape::additionalAttribute | ( | const QString & | name | ) | const |
Get additional attribute
| name | The name of the attribute in the following form prefix:tag e.g. presentation:placeholder |
Definition at line 1092 of file KoShape.cpp.
| void KoShape::addShapeChangeListener | ( | KoShape::ShapeChangeListener * | listener | ) |
Definition at line 1157 of file KoShape.cpp.
References d, KIS_SAFE_ASSERT_RECOVER_RETURN, and KoShape::ShapeChangeListener::registerShape().
|
private |
Definition at line 120 of file KoShape.cpp.
References d.
| KoShapeAnchor * KoShape::anchor | ( | ) | const |
Return the KoShapeAnchor, or 0
| void KoShape::applyAbsoluteTransformation | ( | const QTransform & | matrix | ) |
Applies a transformation to this shape.
The transformation given is relative to the global coordinate system, i.e. the document. This is a convenience function to apply a global transformation to this shape.
| matrix | the transformation matrix to apply |
Definition at line 353 of file KoShape.cpp.
References absoluteTransformation(), and applyTransformation().
| void KoShape::applyTransformation | ( | const QTransform & | matrix | ) |
Applies a transformation to this shape.
The transformation given is relative to the shape coordinate system.
| matrix | the transformation matrix to apply |
Definition at line 363 of file KoShape.cpp.
References GenericMatrixChange, notifyChanged(), s, and shapeChangedPriv().
|
virtual |
Return the brush used to paint the background of this shape with. A QBrush can have a plain color, be fully transparent or have a complex fill. setting such a brush will allow the shape to fill itself using that brush and will be able to tell if its transparent or not.
Reimplemented in KoSvgTextShape.
Definition at line 759 of file KoShape.cpp.
References background(), parent(), and s.
|
virtual |
Get the bounding box of the shape.
This includes the line width of the shape
Reimplemented in KoPathShape, KoSelection, KoShapeGroup, KoShapeLayer, KoSvgTextShape, and KisNodeShape.
Definition at line 299 of file KoShape.cpp.
References absoluteTransformation(), KoInsets::bottom, KoInsets::left, outlineRect(), KoInsets::right, s, KoInsets::top, and transform().
Get the united bounding box of a group of shapes. This is a utility function used in many places in Krita.
Definition at line 312 of file KoShape.cpp.
References boundingRect().
|
virtual |
Returns if during compareShapeZIndex() how this shape portrays the values of its children. The default behaviour is to let this shape's z values take the place of its children's values, so you get a parent/child relationship. The children are naturally still ordered relatively to their z values
But for special cases (like Calligra's TextShape) it can be overloaded to return ChildZPassThrough which means the children keep their own z values
Definition at line 388 of file KoShape.cpp.
References ChildZDefault.
| KoClipMask * KoShape::clipMask | ( | ) | const |
Returns the currently set clip mask or 0 if there is no clip mask set.
Definition at line 945 of file KoShape.cpp.
References s.
| KoClipPath * KoShape::clipPath | ( | ) | const |
Returns the currently set clip path or 0 if there is no clip path set.
Definition at line 933 of file KoShape.cpp.
References KoClipPath::clipPath, and s.
|
virtual |
creates a deep copy of the shape or shape's subtree
Reimplemented in KoPathShape, KoShapeGroup, KoSvgTextShape, KisReferenceImage, ImageShape, EllipseShape, RectangleShape, SpiralShape, StarShape, and KarbonCalligraphicShape.
Definition at line 172 of file KoShape.cpp.
References KIS_SAFE_ASSERT_RECOVER_NOOP, and shapeId().
| KoShape * KoShape::cloneShapeAndBakeAbsoluteTransform | ( | ) | const |
creates a deep copy of the shape/shapes tree and bakes the absolute transform of this into the resulting shape.
After cloning clonedShape->transformation() is equal to this->absoluteTransformation(), even though the new shape has no parents.
This is just a convenience wrapper for cloneShape()
The shape is cloned without its parent's transformation, so we should adjust it manually.
Definition at line 179 of file KoShape.cpp.
References absoluteTransformation(), applyAbsoluteTransformation(), cloneShape(), and parent().
This is a method used to sort a list using the STL sorting methods.
| s1 | the first shape |
| s2 | the second shape |
WARNING: Our definition of zIndex is not yet compatible with SVG2's definition. In SVG stacking context of groups with the same zIndex are merged, while in Krita the contents of groups is never merged. One group will always below than the other. Therefore, when zIndex of two groups inside the same parent coincide, the resulting painting order in Krita is UNDEFINED.
To avoid this trouble we use KoShapeReorderCommand::mergeInShape() inside KoShapeCreateCommand.
The algorithm below doesn't correctly handle the case when the two pointers actually point to the same shape. So just check it in advance to guarantee strict weak ordering relation requirement
Definition at line 393 of file KoShape.cpp.
References childZOrderPolicy(), ChildZParentChild, parent(), s1, s2, and zIndex().
Copy all the settings from the parameter shape and apply them to this shape. Settings like the position and rotation to visible and locked. The parent is a notable exclusion.
| shape | the shape to use as original |
Definition at line 599 of file KoShape.cpp.
References isContentProtected(), isGeometryProtected(), isPrintable(), isSelectable(), isVisible(), keepAspectRatio(), s, size(), and zIndex().
|
static |
Definition at line 994 of file KoShape.cpp.
References absoluteTransformation().
|
static |
A convenience method that creates a handles helper with applying transformations at the same time. Please note that you shouldn't save/restore additionally. All the work on restoring original painter's transformations is done by the helper.
Definition at line 982 of file KoShape.cpp.
References absoluteTransformation(), and KoViewConverter::documentToView().
|
static |
default paint order as per SVG specification
Definition at line 704 of file KoShape.cpp.
Returns list of shapes depending on this shape.
Definition at line 1054 of file KoShape.cpp.
References d.
| QPointF KoShape::documentToShape | ( | const QPointF & | point | ) | const |
Transforms point from document coordinates to shape coordinates.
| point | in document coordinates |
Definition at line 1016 of file KoShape.cpp.
References absoluteTransformation().
| QRectF KoShape::documentToShape | ( | const QRectF & | rect | ) | const |
Transform rect from document coordinates to shape coordinates.
| rect | in document coordinates |
Definition at line 1021 of file KoShape.cpp.
References absoluteTransformation().
| bool KoShape::hasAdditionalAttribute | ( | const QString & | name | ) | const |
Check if additional attribute is set
| name | The name of the attribute in the following form prefix:tag e.g. presentation:placeholder |
Definition at line 1087 of file KoShape.cpp.
| bool KoShape::hasCommonParent | ( | const KoShape * | shape | ) | const |
shape Definition at line 510 of file KoShape.cpp.
References parent().
| bool KoShape::hasDependee | ( | KoShape * | shape | ) | const |
Returns if the given shape is dependent on this shape.
Definition at line 1049 of file KoShape.cpp.
References d.
|
virtual |
Returns true if there is some transparency, false if the shape is fully opaque. The default implementation will just return if the background has some transparency, you should override it and always return true if your shape is not square.
Definition at line 635 of file KoShape.cpp.
References background(), and s.
|
virtual |
Check if the shape is hit on position.
| position | the position where the user clicked. |
Reimplemented in KoPathShape, KoSelection, KoShapeGroup, and KoShapeLayer.
Definition at line 280 of file KoShape.cpp.
References absoluteTransformation(), KoInsets::bottom, d, KoInsets::left, outlineRect(), position(), KoInsets::right, s, and KoInsets::top.
| QString KoShape::hyperLink | ( | ) | const |
| bool KoShape::inheritBackground | ( | ) | const |
inheritBackground shows if the shape inherits background from its parent
Definition at line 782 of file KoShape.cpp.
References s.
| bool KoShape::inheritPaintOrder | ( | ) | const |
inheritPaintOrder
Definition at line 715 of file KoShape.cpp.
References s.
inheritsTransformFromAny checks if the shape inherits transformation from any of the shapes listed in ancestorsInQuestion. The inheritance is checked in recursive way.
ancestorsInQuestion Definition at line 488 of file KoShape.cpp.
References KoShapeContainer::inheritsTransform(), and parent().
| bool KoShape::inheritStroke | ( | ) | const |
inheritStroke shows if the shape inherits the stroke from its parent
Definition at line 921 of file KoShape.cpp.
References s.
| bool KoShape::isContentProtected | ( | ) | const |
Returns current content protection state of this shape. Content protection is a hint for tools to disallow the user editing the content.
Definition at line 857 of file KoShape.cpp.
References s.
| bool KoShape::isGeometryProtected | ( | ) | const |
Returns current geometry protection state of this shape. The geometry being protected means the user can not change shape or position of the shape. This includes any matrix operation such as rotation.
Definition at line 847 of file KoShape.cpp.
References s.
| bool KoShape::isPrintable | ( | ) | const |
Returns the current printable state of this shape.
A shape can be visible but not printable, not printable and not visible or visible and printable, but not invisible and still printable.
Definition at line 824 of file KoShape.cpp.
References s.
| bool KoShape::isSelectable | ( | ) | const |
Returns if this shape can be selected by the user.
Definition at line 837 of file KoShape.cpp.
References s.
|
virtual |
checks recursively if the shape or one of its parents is not visible or locked
Reimplemented in KisShapeLayer.
Definition at line 970 of file KoShape.cpp.
| bool KoShape::isVisible | ( | bool | recursive = true | ) | const |
Returns current visibility state of this shape. Being visible means being painted, as well as being used for things like guidelines or searches.
| recursive | when true, checks visibility recursively |
Definition at line 802 of file KoShape.cpp.
References isVisible(), parent(), and s.
| bool KoShape::keepAspectRatio | ( | ) | const |
Setting the shape to keep its aspect-ratio has the effect that user-scaling will keep the width/height ratio intact so as not to distort shapes that rely on that ratio.
Definition at line 875 of file KoShape.cpp.
References s.
Definition at line 1178 of file KoShape.cpp.
References linearizeSubtree(), and KoShapeContainer::shapes().
Definition at line 1194 of file KoShape.cpp.
References compareShapeZIndex(), linearizeSubtreeSorted(), and KoShapeContainer::shapes().
|
protected |
| qreal KoShape::minimumHeight | ( | ) | const |
Return the minimum height of the shape.
| QString KoShape::name | ( | ) | const |
Returns the name of the shape.
Definition at line 955 of file KoShape.cpp.
References s.
| void KoShape::notifyChanged | ( | ) |
Update the position of the shape in the tree of the KoShapeManager.
Definition at line 618 of file KoShape.cpp.
References d, and KoShapeManager::notifyShapeChanged().
|
virtual |
returns the outline of the shape in the form of a path. The outline returned will always be relative to the position() of the shape, so moving the shape will not alter the result. The outline is used to draw the stroke on, for example.
Reimplemented in KoPathShape, and KoSvgTextShape.
Definition at line 559 of file KoShape.cpp.
References outlineRect().
|
virtual |
returns the outline of the shape in the form of a rect. The outlineRect returned will always be relative to the position() of the shape, so moving the shape will not alter the result. The outline is used to calculate the boundingRect.
Reimplemented in KoPathShape, KoSelection, KoShapeGroup, and KoSvgTextShape.
Definition at line 566 of file KoShape.cpp.
|
pure virtual |
Paint the shape fill The class extending this one is responsible for painting itself. painter is expected to be preconfigured to work in "document" pixels.
| painter | used for painting the shape |
Implemented in KisReferenceImage, KoPathShape, KoSelection, KoShapeContainer, KoSvgTextShape, KisNodeShape, and ImageShape.
|
virtual |
paintStroke paints the shape's markers
| painter | used for painting the shape |
Definition at line 202 of file KoShape.cpp.
References stroke().
|
virtual |
paintOrder
Reimplemented in KoSvgTextShape.
Definition at line 693 of file KoShape.cpp.
References defaultPaintOrder(), paintOrder(), parent(), and s.
|
virtual |
paintStroke paints the shape's stroked outline
| painter | used for painting the shape |
Reimplemented in KoSvgTextShape.
Definition at line 195 of file KoShape.cpp.
References stroke().
| KoShapeContainer * KoShape::parent | ( | ) | const |
Returns the parent, or 0 if there is no parent.
Definition at line 862 of file KoShape.cpp.
| QPointF KoShape::position | ( | ) | const |
Get the position of the shape in pt.
Definition at line 745 of file KoShape.cpp.
References outlineRect(), and s.
| void KoShape::removeAdditionalAttribute | ( | const QString & | name | ) |
| void KoShape::removeAdditionalStyleAttribute | ( | const char * | name | ) |
Removes as shape depending on this shape.
Definition at line 1043 of file KoShape.cpp.
References d, and removeShapeChangeListener().
| void KoShape::removeShapeChangeListener | ( | KoShape::ShapeChangeListener * | listener | ) |
Definition at line 1165 of file KoShape.cpp.
References d, KIS_SAFE_ASSERT_RECOVER_RETURN, and KoShape::ShapeChangeListener::unregisterShape().
|
private |
Definition at line 125 of file KoShape.cpp.
References d.
| void KoShape::rotate | ( | qreal | angle | ) |
Rotate the shape (relative)
The shape will be rotated from the current rotation using the center of the shape using the size()
| angle | change the angle of rotation increasing it with 'angle' degrees |
Definition at line 222 of file KoShape.cpp.
References notifyChanged(), RotationChanged, s, shapeChangedPriv(), and size().
| qreal KoShape::rotation | ( | ) | const |
Return the current rotation in degrees. It returns NaN if the shape has a shearing or scaling transformation applied.
Definition at line 720 of file KoShape.cpp.
| void KoShape::scale | ( | qreal | sx, |
| qreal | sy ) |
Scale the shape using the zero-point which is the top-left corner.
| sx | scale in x direction |
| sy | scale in y direction |
Definition at line 209 of file KoShape.cpp.
References notifyChanged(), position(), s, ScaleChanged, and shapeChangedPriv().
| void KoShape::setAbsolutePosition | ( | const QPointF & | newPosition, |
| KoFlake::AnchorPosition | anchor = KoFlake::Center ) |
Move this shape to an absolute position where the end location will be the same regardless of the shape's rotation/skew/scaling and regardless of this shape having a parent (being in a group) or not.
The newPosition is going to be the center of the shape. This has the convenient effect that:
shape->setAbsolutePosition(QPointF(0,0)); shape->rotate(45);
Will result in the same visual position of the shape as the opposite:
shape->rotate(45); shape->setAbsolutePosition(QPointF(0,0));
| newPosition | the new absolute center of the shape. |
| anchor | The place on the (unaltered) shape that you set the position of. |
Definition at line 588 of file KoShape.cpp.
References absolutePosition(), anchor(), applyAbsoluteTransformation(), notifyChanged(), PositionChanged, and shapeChangedPriv().
| void KoShape::setAdditionalAttribute | ( | const QString & | name, |
| const QString & | value ) |
Set additional attribute
This can be used to attach additional attributes to a shape for attributes that are application specific like presentation:placeholder
| name | The name of the attribute in the following form prefix:tag e.g. presentation:placeholder |
| value | The value of the attribute |
Definition at line 1077 of file KoShape.cpp.
| void KoShape::setAdditionalStyleAttribute | ( | const char * | name, |
| const QString & | value ) |
| void KoShape::setAnchor | ( | KoShapeAnchor * | anchor | ) |
Set the KoShapeAnchor
|
virtual |
Set the background of the shape. A shape background can be a plain color, a gradient, a pattern, be fully transparent or have a complex fill. Setting such a background will allow the shape to be filled and will be able to tell if it is transparent or not.
If the shape inherited the background from its parent, its stops inheriting it, that is inheritBackground property resets to false.
| background | the new shape background. |
Reimplemented in KoSvgTextShape.
Definition at line 751 of file KoShape.cpp.
References BackgroundChanged, notifyChanged(), s, and shapeChangedPriv().
| void KoShape::setClipMask | ( | KoClipMask * | clipMask | ) |
Sets a new clip mask, removing the old one. The mask is owned by the shape.
Definition at line 938 of file KoShape.cpp.
References clipMask(), ClipMaskChanged, notifyChanged(), s, and shapeChangedPriv().
| void KoShape::setClipPath | ( | KoClipPath * | clipPath | ) |
Sets a new clip path, removing the old one.
Definition at line 926 of file KoShape.cpp.
References clipPath(), ClipPathChanged, notifyChanged(), s, and shapeChangedPriv().
| void KoShape::setContentProtected | ( | bool | protect | ) |
Marks the shape to have its content protected against editing. Content protection is a hint for tools to disallow the user editing the content.
| protect | when true set the shapes content to be protected from user modification. |
Definition at line 852 of file KoShape.cpp.
References s.
| void KoShape::setGeometryProtected | ( | bool | on | ) |
Tells the shape to have its position/rotation and size protected from user-changes. The geometry being protected means the user can not change shape or position of the shape. This includes any matrix operation such as rotation.
| on | when true; set the shape to have its geometry protected. |
Definition at line 842 of file KoShape.cpp.
References s.
| void KoShape::setHyperLink | ( | const QString & | hyperLink | ) |
Set hyperlink for this shape.
| hyperLink | name. |
Definition at line 1122 of file KoShape.cpp.
References hyperLink(), and s.
| void KoShape::setInheritBackground | ( | bool | value | ) |
setInheritBackground marks a shape as inheriting the background from the parent shape. NOTE: The currently selected background is destroyed.
| value | true if the shape should inherit the filling background |
Definition at line 773 of file KoShape.cpp.
| void KoShape::setInheritPaintOrder | ( | bool | value | ) |
| void KoShape::setInheritStroke | ( | bool | value | ) |
setInheritStroke marks a shape as inheriting the stroke from the parent shape. NOTE: The currently selected stroke is destroyed.
| value | true if the shape should inherit the stroke style |
Definition at line 913 of file KoShape.cpp.
| void KoShape::setKeepAspectRatio | ( | bool | keepAspect | ) |
Setting the shape to keep its aspect-ratio has the effect that user-scaling will keep the width/height ratio intact so as not to distort shapes that rely on that ratio.
| keepAspect | the new value |
Definition at line 867 of file KoShape.cpp.
References KeepAspectRatioChange, notifyChanged(), s, and shapeChangedPriv().
| void KoShape::setMinimumHeight | ( | qreal | height | ) |
Set the minimum height of the shape. Currently it's not respected but only for informational purpose
| height | the minimum height of the frame. |
| void KoShape::setName | ( | const QString & | name | ) |
|
virtual |
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.
| first | first thing to paint |
| second | second thing to paint. |
Reimplemented in KoSvgTextShape.
Definition at line 669 of file KoShape.cpp.
References defaultPaintOrder(), Fill, KIS_SAFE_ASSERT_RECOVER_RETURN, and s.
| void KoShape::setParent | ( | KoShapeContainer * | parent | ) |
Set the parent of this shape.
| parent | the new parent of this shape. Can be 0 if the shape has no parent anymore. |
Definition at line 464 of file KoShape.cpp.
References KoShapeContainer::ShapeInterface::addShape(), d, KIS_SAFE_ASSERT_RECOVER_NOOP, notifyChanged(), parent(), ParentChanged, KoShapeContainer::ShapeInterface::removeShape(), shapeChangedPriv(), and KoShapeContainer::shapeInterface.
|
virtual |
Set the position of the shape in pt.
| position | the new position of the shape |
Reimplemented in KisNodeShape.
Definition at line 267 of file KoShape.cpp.
References notifyChanged(), position(), PositionChanged, s, and shapeChangedPriv().
| void KoShape::setPrintable | ( | bool | on | ) |
Changes the shape to be printable or not. The default is true.
If a Shape's print flag is true, the shape will be printed. If false, the shape will not be printed. If a shape is not visible (
Definition at line 819 of file KoShape.cpp.
References s.
|
virtual |
Update the image resolution in pixels per inch. Shapes should override this if they need to know the image resolution.
| xRes | |
| yRes |
Reimplemented in KoSvgTextShape.
Definition at line 1213 of file KoShape.cpp.
| void KoShape::setSelectable | ( | bool | selectable | ) |
Makes it possible for the user to select this shape. This parameter defaults to true.
| selectable | when true; set the shape to be selectable by the user. |
Definition at line 832 of file KoShape.cpp.
References s.
| void KoShape::setShapeId | ( | const QString & | id | ) |
Set the Id of this shape. A shapeFactory is expected to set the Id at creation so applications can find out what kind of shape this is.
| id | the ID from the factory that created this shape |
Definition at line 885 of file KoShape.cpp.
References s.
|
virtual |
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 in EllipseShape, SpiralShape, StarShape, KarbonCalligraphicShape, KoParameterShape, KoPathShape, KoSelection, KoShapeGroup, KoSvgTextShape, and ImageShape.
Definition at line 248 of file KoShape.cpp.
References notifyChanged(), setSizeImpl(), shapeChangedPriv(), size(), and SizeChanged.
|
protected |
|
virtual |
Set a new stroke, removing the old one. The stroke inheritance becomes disabled.
| stroke | the new stroke, or 0 if there should be no stroke. |
Reimplemented in KoSvgTextShape.
Definition at line 904 of file KoShape.cpp.
References notifyChanged(), s, shapeChangedPriv(), stroke(), and StrokeChanged.
Set the tool delegates.
| delegates | the new delegates. |
Definition at line 1112 of file KoShape.cpp.
References d.
| void KoShape::setTransformation | ( | const QTransform & | matrix | ) |
Sets a new transformation matrix describing the local transformations on this shape.
| matrix | the new transformation matrix |
Definition at line 374 of file KoShape.cpp.
References GenericMatrixChange, notifyChanged(), s, and shapeChangedPriv().
| void KoShape::setTransparency | ( | qreal | transparency | ) |
Sets shape level transparency.
| transparency | the new shape level transparency |
Definition at line 642 of file KoShape.cpp.
References notifyChanged(), s, shapeChangedPriv(), transparency(), and TransparencyChanged.
| void KoShape::setUserData | ( | KoShapeUserData * | userData | ) |
Set a data object on the shape to be used by an application. This is specifically useful when a shape is created in a plugin and that data from that shape should be accessible outside the plugin.
| userData | the new user data, or 0 to delete the current one. |
Definition at line 625 of file KoShape.cpp.
References s, and userData().
| void KoShape::setVisible | ( | bool | on | ) |
Changes the Shape to be visible or invisible. Being visible means being painted, as well as being used for things like guidelines or searches.
| on | when true; set the shape to be visible. |
Definition at line 795 of file KoShape.cpp.
References s.
| void KoShape::setZIndex | ( | qint16 | zIndex | ) |
Set the z-coordinate of this shape. The zIndex property is used to determine which shape lies on top of other objects. An shape with a higher z-order is on top, and can obscure, another shape.
Just like two objects having the same x or y coordinate will make them 'touch', so will two objects with the same z-index touch on the z plane. In layering the shape this, however, can cause a little confusion as one always has to be on top. The layering if two overlapping objects have the same index is implementation dependent and probably depends on the order in which they are added to the shape manager.
| zIndex | the new z-index; |
Definition at line 787 of file KoShape.cpp.
References notifyChanged(), s, and zIndex().
|
protectedvirtual |
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. |
NOTE: we don't need to handle Deleted type for the shapes in d->dependees list here, becasue this function is called on the other side of the relation, i.e. in the actual "dependee". We handle that in Private::DependeesLifetimeListener.
Reimplemented in KoSvgTextShape, KoShapeContainer, and KoShapeGroup.
Definition at line 1059 of file KoShape.cpp.
|
protected |
Notify the shape that a change was done. To be used by inheriting shapes.
| type | the change type |
Definition at line 104 of file KoShape.cpp.
References d, dependees(), KoShape::ShapeChangeListener::notifyShapeChangedImpl(), and shapeChanged().
| QString KoShape::shapeId | ( | ) | const |
Return the Id of this shape, identifying the type of shape by the id of the factory.
Definition at line 880 of file KoShape.cpp.
References s.
| QPointF KoShape::shapeToDocument | ( | const QPointF & | point | ) | const |
Transforms point from shape coordinates to document coordinates.
| point | in shape coordinates |
Definition at line 1006 of file KoShape.cpp.
References absoluteTransformation().
| QRectF KoShape::shapeToDocument | ( | const QRectF & | rect | ) | const |
Transforms rect from shape coordinates to document coordinates.
| rect | in shape coordinates |
Definition at line 1011 of file KoShape.cpp.
References absoluteTransformation().
| void KoShape::shear | ( | qreal | sx, |
| qreal | sy ) |
Shear the shape The shape will be sheared using the zero-point which is the top-left corner.
| sx | shear in x direction |
| sy | shear in y direction |
Definition at line 235 of file KoShape.cpp.
References notifyChanged(), position(), s, shapeChangedPriv(), and ShearChanged.
|
virtual |
Get the size of the shape in pt.
The size is in shape coordinates.
Reimplemented in KoPathShape, KoSelection, KoShapeGroup, KoSvgTextShape, and KisNodeShape.
Definition at line 740 of file KoShape.cpp.
References s.
|
virtual |
Returns additional snap data the shape wants to have snapping to.
Definition at line 1072 of file KoShape.cpp.
|
virtual |
Returns the currently set stroke, or 0 if there is no stroke.
Reimplemented in KoSvgTextShape.
Definition at line 890 of file KoShape.cpp.
| KoInsets KoShape::strokeInsets | ( | ) | const |
Return the insets of the stroke. Convenience method for KoShapeStrokeModel::strokeInsets()
Definition at line 661 of file KoShape.cpp.
References s.
| QSet< KoShape * > KoShape::toolDelegates | ( | ) | const |
Return the tool delegates for this shape. In Flake a shape being selected will cause the tool manager to make available all tools that can edit the selected shapes. In some cases selecting one shape should allow the tool to edit a related shape be available too. The tool delegates allows this to happen by taking all the shapes in the set into account on tool selection. Notice that if the set is non-empty 'this' shape is no longer looked at. You can choose to add itself to the set too.
Definition at line 1107 of file KoShape.cpp.
References d.
|
protected |
return the current matrix that contains the rotation/scale/position of this shape
Definition at line 950 of file KoShape.cpp.
References s.
| QTransform KoShape::transformation | ( | ) | const |
Returns the shapes local transformation matrix.
Definition at line 383 of file KoShape.cpp.
References s.
| qreal KoShape::transparency | ( | bool | recursive = false | ) | const |
Returns the shape level transparency.
| recursive | when true takes the parents transparency into account |
Definition at line 650 of file KoShape.cpp.
References parent(), s, and transparency().
|
virtual |
Request a repaint to be queued. The repaint will be of the entire Shape, including its selection handles should this shape be selected.
This method will return immediately and only request a repaint. Successive calls will be merged into an appropriate repaint action.
Reimplemented in KoShapeContainer, and KoShapeContainer.
Definition at line 534 of file KoShape.cpp.
References boundingRect(), d, and KoShapeManager::update().
|
virtual |
Request a repaint to be queued. The repaint will be restricted to the parameters rectangle, which is expected to be in absolute coordinates of the canvas and it is expected to be normalized.
This method will return immediately and only request a repaint. Successive calls will be merged into an appropriate repaint action.
| rect | the rectangle (in pt) to queue for repaint. |
Definition at line 545 of file KoShape.cpp.
References d, isVisible(), and KoShapeManager::update().
| KoShapeUserData * KoShape::userData | ( | ) | const |
|
virtual |
A shape can be in a state that it is doing processing data like loading or text layout. In this case it can be shown on screen probably partially but it should really not be printed until it is fully done processing. Warning! This method can be blocking for a long time
| asynchronous | If set to true the processing will can take place in a different thread and the function will not block until the shape is finished. In case of printing Flake will call this method from a non-main thread and only start printing it when the in case of printing method returned. If set to false the processing needs to be done synchronously and will block until the result is finished. |
Definition at line 965 of file KoShape.cpp.
| qint16 KoShape::zIndex | ( | ) | const |
Retrieve the z-coordinate of this shape. The zIndex property is used to determine which shape lies on top of other objects. An shape with a higher z-order is on top, and can obscure another shape.
Definition at line 529 of file KoShape.cpp.
|
friend |
|
static |
|
static |
|
private |