|
Krita Source Code Documentation
|
#include <KoShape.h>
Inheritance diagram for KoShape:Classes | |
| class | Private |
| struct | ShapeChangeListener |
| class | SharedData |
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. | |
| 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 |
| 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 |
| 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) |
| virtual void | setRunThrough (short int runThrough) |
| void | setSelectable (bool selectable) |
| void | setShadow (KoShapeShadow *shadow) |
| Sets the new shadow, removing the old one. | |
| void | setShapeId (const QString &id) |
| virtual void | setSize (const QSizeF &size) |
| Resize the shape. | |
| 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 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 |
| 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 | 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 |
| ShadowChanged | the shapes shadow 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 |
| TextRunAroundChanged | used after a setTextRunAroundSide() |
| 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 95 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 656 of file KoShape.h.
| enum KoShape::PaintOrder |
TODO
| Enumerator | |
|---|---|
| Background | |
| Foreground | |
The behavior text should do when intersecting this shape.
| Enumerator | |
|---|---|
| ContourBox | |
| ContourFull | Run other text around a bounding rect of the outline. Run other text around also on the inside |
| ContourOutside | Run other text around only on the outside. |
Definition at line 131 of file KoShape.h.
The behavior text should do when intersecting this shape.
Definition at line 120 of file KoShape.h.
| KoShape::KoShape | ( | ) |
Constructor.
Definition at line 163 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 176 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 368 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 373 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 653 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 382 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 1221 of file KoShape.cpp.
References 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 1279 of file KoShape.cpp.
| void KoShape::addShapeChangeListener | ( | KoShape::ShapeChangeListener * | listener | ) |
Definition at line 1360 of file KoShape.cpp.
References d, KIS_SAFE_ASSERT_RECOVER_RETURN, and KoShape::ShapeChangeListener::registerShape().
|
private |
Definition at line 148 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 400 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 410 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 926 of file KoShape.cpp.
References background(), parent(), and s.
|
virtual |
Get the bounding box of the shape.
This includes the line width and the shadow of the shape
Reimplemented in KoPathShape, KoSelection, KoShapeGroup, KoShapeLayer, KoSvgTextShape, and KisNodeShape.
Definition at line 335 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 359 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 429 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 1140 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 1128 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, EnhancedPathShape, RectangleShape, SpiralShape, StarShape, and KarbonCalligraphicShape.
Definition at line 200 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 207 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 434 of file KoShape.cpp.
References childZOrderPolicy(), ChildZParentChild, parent(), runThrough(), 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 679 of file KoShape.cpp.
References isContentProtected(), isGeometryProtected(), isPrintable(), isSelectable(), isVisible(), keepAspectRatio(), s, size(), and zIndex().
|
static |
Definition at line 1189 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 1177 of file KoShape.cpp.
References absoluteTransformation(), and KoViewConverter::documentToView().
|
static |
default paint order as per SVG specification
Definition at line 784 of file KoShape.cpp.
Returns list of shapes depending on this shape.
Definition at line 1248 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 1211 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 1216 of file KoShape.cpp.
References absoluteTransformation().
| KoFilterEffectStack * KoShape::filterEffectStack | ( | ) | const |
Returns the filter effect stack of the shape
Definition at line 1294 of file KoShape.cpp.
References s.
| 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 1274 of file KoShape.cpp.
| bool KoShape::hasCommonParent | ( | const KoShape * | shape | ) | const |
shape Definition at line 581 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 1243 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 715 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 308 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 949 of file KoShape.cpp.
References s.
| bool KoShape::inheritPaintOrder | ( | ) | const |
inheritPaintOrder
Definition at line 795 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 559 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 1098 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 1034 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 1024 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 1001 of file KoShape.cpp.
References s.
| bool KoShape::isSelectable | ( | ) | const |
Returns if this shape can be selected by the user.
Definition at line 1014 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 1165 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 979 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 1052 of file KoShape.cpp.
References s.
Definition at line 1381 of file KoShape.cpp.
References linearizeSubtree(), and KoShapeContainer::shapes().
Definition at line 1397 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 1150 of file KoShape.cpp.
References s.
| void KoShape::notifyChanged | ( | ) |
Update the position of the shape in the tree of the KoShapeManager.
Definition at line 698 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 630 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 637 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 230 of file KoShape.cpp.
References stroke().
|
virtual |
paintOrder
Reimplemented in KoSvgTextShape.
Definition at line 773 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 223 of file KoShape.cpp.
References stroke().
| KoShapeContainer * KoShape::parent | ( | ) | const |
Returns the parent, or 0 if there is no parent.
Definition at line 1039 of file KoShape.cpp.
| QPointF KoShape::position | ( | ) | const |
Get the position of the shape in pt.
Definition at line 825 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 1236 of file KoShape.cpp.
References d.
| void KoShape::removeShapeChangeListener | ( | KoShape::ShapeChangeListener * | listener | ) |
Definition at line 1368 of file KoShape.cpp.
References d, KIS_SAFE_ASSERT_RECOVER_RETURN, and KoShape::ShapeChangeListener::unregisterShape().
|
private |
Definition at line 153 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 250 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 800 of file KoShape.cpp.
| int KoShape::runThrough | ( | ) | const |
Retrieve the run through property of this shape. The run through property is used to determine if the shape is behind, inside or before text.
Definition at line 962 of file KoShape.cpp.
References s.
| 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 237 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 668 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 1264 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 918 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 1133 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 1121 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 1029 of file KoShape.cpp.
References s.
| void KoShape::setFilterEffectStack | ( | KoFilterEffectStack * | filterEffectStack | ) |
Sets the new filter effect stack, removing the old one.
Definition at line 1299 of file KoShape.cpp.
References KoFilterEffectStack::deref(), filterEffectStack(), notifyChanged(), KoFilterEffectStack::ref(), and 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 1019 of file KoShape.cpp.
References s.
| void KoShape::setHyperLink | ( | const QString & | hyperLink | ) |
Set hyperlink for this shape.
| hyperLink | name. |
Definition at line 1325 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 940 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 1090 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 1044 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 749 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 535 of file KoShape.cpp.
|
virtual |
Set the position of the shape in pt.
| position | the new position of the shape |
Reimplemented in KisNodeShape.
Definition at line 295 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 996 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 1416 of file KoShape.cpp.
|
virtual |
Set the run through property of this shape. The run through property is used to determine if the shape is behind, inside or before text.
| runThrough | the new run through; |
Reimplemented in KoTosContainer.
Definition at line 967 of file KoShape.cpp.
References runThrough(), and s.
| 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 1009 of file KoShape.cpp.
References s.
| void KoShape::setShadow | ( | KoShapeShadow * | shadow | ) |
Sets the new shadow, removing the old one.
Definition at line 1103 of file KoShape.cpp.
References notifyChanged(), KoShapeShadow::ref(), s, shadow(), ShadowChanged, and shapeChangedPriv().
| 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 1062 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, EnhancedPathShape, SpiralShape, StarShape, KarbonCalligraphicShape, KoParameterShape, KoPathShape, KoSelection, KoShapeGroup, and ImageShape.
Definition at line 276 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 1081 of file KoShape.cpp.
References notifyChanged(), s, shapeChangedPriv(), stroke(), and StrokeChanged.
| void KoShape::setTextRunAroundContour | ( | KoShape::TextRunAroundContour | contour | ) |
Set how tight text run around is done around this shape.
| contour | the new contour |
Definition at line 913 of file KoShape.cpp.
References s.
| void KoShape::setTextRunAroundDistanceBottom | ( | qreal | distance | ) |
Set the space between this shape's bottom edge and the text that run around this shape.
| distance | the space around this shape to keep free from text |
Definition at line 893 of file KoShape.cpp.
References distance(), and s.
| void KoShape::setTextRunAroundDistanceLeft | ( | qreal | distance | ) |
Set the space between this shape's left edge and the text that run around this shape.
| distance | the space around this shape to keep free from text |
Definition at line 873 of file KoShape.cpp.
References distance(), and s.
| void KoShape::setTextRunAroundDistanceRight | ( | qreal | distance | ) |
Set the space between this shape's right edge and the text that run around this shape.
| distance | the space around this shape to keep free from text |
Definition at line 883 of file KoShape.cpp.
References distance(), and s.
| void KoShape::setTextRunAroundDistanceTop | ( | qreal | distance | ) |
Set the space between this shape's top edge and the text that run around this shape.
| distance | the space around this shape to keep free from text |
Definition at line 863 of file KoShape.cpp.
References distance(), and s.
| void KoShape::setTextRunAroundSide | ( | TextRunAroundSide | side, |
| RunThroughLevel | runThrough = Background ) |
Set the side text should flow around this shape.
| side | the requested side |
| runThrough | run through the foreground or background or... |
Definition at line 836 of file KoShape.cpp.
References Background, notifyChanged(), RunThrough, runThrough(), s, setRunThrough(), shapeChangedPriv(), and TextRunAroundChanged.
| void KoShape::setTextRunAroundThreshold | ( | qreal | threshold | ) |
Set the threshold above which text should flow around this shape. The text will not flow around the shape on a side unless the space available on that side is above this threshold. Only used when the text run around side is EnoughRunAroundSide.
| threshold | the new threshold |
Definition at line 903 of file KoShape.cpp.
References s.
Set the tool delegates.
| delegates | the new delegates. |
Definition at line 1315 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 417 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 722 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 705 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 972 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 954 of file KoShape.cpp.
References notifyChanged(), s, and zIndex().
| KoShapeShadow * KoShape::shadow | ( | ) | const |
Returns the currently set shadow or 0 if there is no shadow set.
Definition at line 1116 of file KoShape.cpp.
References s.
|
virtual |
returns the outline of the shape in the form of a path for the use of painting a shadow.
Normally this would be the same as outline() if there is a fill (background) set on the shape and empty if not. However, a shape could reimplement this to return an outline even if no fill is defined. A typical example of this would be the picture shape which has a picture but almost never a background.
Definition at line 644 of file KoShape.cpp.
References background(), and outline().
|
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. |
Reimplemented in KoSvgTextShape, KoShapeContainer, KoShapeGroup, KoTosContainer, and EnhancedPathShape.
Definition at line 1253 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 132 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 1057 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 1201 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 1206 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 263 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, and KisNodeShape.
Definition at line 820 of file KoShape.cpp.
References s.
|
virtual |
Returns additional snap data the shape wants to have snapping to.
Definition at line 1259 of file KoShape.cpp.
|
virtual |
Returns the currently set stroke, or 0 if there is no stroke.
Reimplemented in KoSvgTextShape.
Definition at line 1067 of file KoShape.cpp.
| KoInsets KoShape::strokeInsets | ( | ) | const |
Return the insets of the stroke. Convenience method for KoShapeStrokeModel::strokeInsets()
Definition at line 741 of file KoShape.cpp.
References s.
| KoShape::TextRunAroundContour KoShape::textRunAroundContour | ( | ) | const |
Return the how tight text run around is done around this shape.
Definition at line 908 of file KoShape.cpp.
References s.
| qreal KoShape::textRunAroundDistanceBottom | ( | ) | const |
The space between this shape's bottom edge and text that runs around this shape.
Definition at line 888 of file KoShape.cpp.
References s.
| qreal KoShape::textRunAroundDistanceLeft | ( | ) | const |
The space between this shape's left edge and text that runs around this shape.
Definition at line 868 of file KoShape.cpp.
References s.
| qreal KoShape::textRunAroundDistanceRight | ( | ) | const |
The space between this shape's right edge and text that runs around this shape.
Definition at line 878 of file KoShape.cpp.
References s.
| qreal KoShape::textRunAroundDistanceTop | ( | ) | const |
The space between this shape's top edge and text that runs around this shape.
Definition at line 858 of file KoShape.cpp.
References s.
| KoShape::TextRunAroundSide KoShape::textRunAroundSide | ( | ) | const |
Return the side text should flow around this shape. This implements the ODF style:wrap attribute that specifies how text is displayed around a frame or graphic object.
Definition at line 831 of file KoShape.cpp.
References s.
| qreal KoShape::textRunAroundThreshold | ( | ) | const |
Return the threshold above which text should flow around this shape. The text will not flow around the shape on a side unless the space available on that side is above this threshold. Only used when the text run around side is EnoughRunAroundSide.
Definition at line 898 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 1310 of file KoShape.cpp.
References d.
|
protected |
return the current matrix that contains the rotation/scale/position of this shape
Definition at line 1145 of file KoShape.cpp.
References s.
| QTransform KoShape::transformation | ( | ) | const |
Returns the shapes local transformation matrix.
Definition at line 424 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 730 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 605 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 616 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 1160 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 600 of file KoShape.cpp.
|
friend |
|
static |
|
static |
|
private |