|
Krita Source Code Documentation
|
#include <kis_shape_selection.h>
Inheritance diagram for KisShapeSelection:Signals | |
| void | sigMoveShapes (const QPointF &diff) |
Public Member Functions | |
| KisSelectionComponent * | clone (KisSelection *selection) override |
| bool | isEmpty () const override |
| KisShapeSelection (const KisShapeSelection &rhs, KisSelection *selection) | |
| KisShapeSelection (KoShapeControllerBase *shapeControllerBase, KisSelectionWSP selection) | |
| bool | loadSelection (KoStore *store, const QRect &imageRect) |
| void | moveX (qint32 x) override |
| void | moveY (qint32 y) override |
| QPainterPath | outlineCache () const override |
| bool | outlineCacheValid () const override |
| void | recalculateOutlineCache () override |
| void | renderToProjection (KisPaintDeviceSP projection) override |
| void | renderToProjection (KisPaintDeviceSP projection, const QRect &r) override |
| KUndo2Command * | resetToEmpty () override |
| bool | saveSelection (KoStore *store, const QRect &imageRect) const |
| void | setResolutionProxy (KisImageResolutionProxySP resolutionProxy) override |
| KoShapeManager * | shapeManager () const |
| KUndo2Command * | transform (const QTransform &transform) override |
| ~KisShapeSelection () override | |
Public Member Functions inherited from KoShapeLayer | |
| QRectF | boundingRect () const override |
| Get the bounding box of the shape. | |
| bool | hitTest (const QPointF &position) const override |
| Check if the shape is hit on position. | |
| KoShapeLayer () | |
| The default constructor. | |
| KoShapeLayer (KoShapeContainerModel *model) | |
| void | paintComponent (QPainter &painter) const override |
Public Member Functions inherited from KoShapeContainer | |
| void | addShape (KoShape *shape) |
| bool | inheritsTransform (const KoShape *shape) const |
| bool | isClipped (const KoShape *child) const |
| KoShapeContainer (KoShapeContainerModel *model=0) | |
| KoShapeContainerModel * | model () const |
| void | paint (QPainter &painter) const override |
| reimplemented | |
| Private (const Private &rhs, KoShapeContainer *q) | |
| Private (KoShapeContainer *q) | |
| void | removeShape (KoShape *shape) |
| void | setClipped (const KoShape *child, bool clipping) |
| void | setInheritsTransform (const KoShape *shape, bool inherit) |
| int | shapeCount () const |
| ShapeInterface * | shapeInterface () |
| QList< KoShape * > | shapes () const |
| virtual void | update () const |
| void | update () const override |
| reimplemented | |
| ~KoShapeContainer () override | |
| virtual | ~Private () |
Public Member Functions inherited from KoShape | |
| QRectF | absoluteOutlineRect () const |
| QPointF | absolutePosition (KoFlake::AnchorPosition anchor=KoFlake::Center) const |
| QTransform | absoluteTransformation () const |
| bool | addDependee (KoShape *shape) |
| QString | additionalAttribute (const QString &name) const |
| void | addShapeChangeListener (ShapeChangeListener *listener) |
| KoShapeAnchor * | anchor () const |
| void | applyAbsoluteTransformation (const QTransform &matrix) |
| void | applyTransformation (const QTransform &matrix) |
| virtual QSharedPointer< KoShapeBackground > | background () const |
| virtual ChildZOrderPolicy | childZOrderPolicy () |
| KoClipMask * | clipMask () const |
| Returns the currently set clip mask or 0 if there is no clip mask set. | |
| KoClipPath * | clipPath () const |
| Returns the currently set clip path or 0 if there is no clip path set. | |
| 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 |
| 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 | 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 | updateAbsolute (const QRectF &rect) const |
| KoShapeUserData * | userData () const |
| virtual void | waitUntilReady (bool asynchronous=true) const |
| qint16 | zIndex () const |
| virtual | ~KoShape () |
| Destructor. | |
Public Member Functions inherited from KisSelectionComponent | |
| KisSelectionComponent () | |
| virtual | ~KisSelectionComponent () |
Protected Member Functions | |
| void | paintComponent (QPainter &painter) const override |
| Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does. | |
Protected Member Functions inherited from KoShapeContainer | |
| KoShapeContainer (const KoShapeContainer &rhs) | |
| void | setModel (KoShapeContainerModel *model) |
| void | setModelInit (KoShapeContainerModel *model) |
| void | shapeChanged (ChangeType type, KoShape *shape=0) override |
| virtual void | shapeCountChanged () |
Protected Member Functions inherited from KoShape | |
| KoShape (const KoShape &rhs) | |
| QList< ShapeChangeListener * > | listeners () const |
| void | setSizeImpl (const QSizeF &size) const |
| void | shapeChangedPriv (KoShape::ChangeType type) |
| QTransform | transform () const |
| return the current matrix that contains the rotation/scale/position of this shape | |
Private Slots | |
| void | slotMoveShapes (const QPointF &diff) |
Private Member Functions | |
| void | init (KisImageResolutionProxySP resolutionProxy, KoShapeControllerBase *shapeControllerBase) |
| KisShapeSelectionModel * | initModel (KisImageWSP image, KisSelectionWSP selection) |
| KisShapeSelection (const KisShapeSelection &rhs) | |
| void | renderSelection (KisPaintDeviceSP projection, const QRect &requestedRect) |
| void | setUpdatesEnabled (bool enabled) |
| bool | updatesEnabled () const |
Private Attributes | |
| KisShapeSelectionCanvas * | m_canvas {nullptr} |
| KisImageViewConverter * | m_converter {nullptr} |
| KisShapeSelectionModel * | m_model |
| QPainterPath | m_outline |
| KisImageResolutionProxySP | m_resolutionProxy |
| KoShapeControllerBase * | m_shapeControllerBase {nullptr} |
Friends | |
| class | KisShapeSelectionModel |
| class | KisTakeAllShapesCommand |
Definition at line 42 of file kis_shape_selection.h.
|
private |
| KisShapeSelection::KisShapeSelection | ( | KoShapeControllerBase * | shapeControllerBase, |
| KisSelectionWSP | selection ) |
Definition at line 50 of file kis_shape_selection.cpp.
References init(), and m_resolutionProxy.
|
override |
Definition at line 81 of file kis_shape_selection.cpp.
References m_canvas, m_converter, m_model, and KisShapeSelectionModel::setShapeSelection().
| KisShapeSelection::KisShapeSelection | ( | const KisShapeSelection & | rhs, |
| KisSelection * | selection ) |
Definition at line 58 of file kis_shape_selection.cpp.
References KoShapeContainer::addShape(), KoShapeManager::addShape(), KoShape::cloneShape(), init(), KIS_SAFE_ASSERT_RECOVER, m_canvas, m_model, m_resolutionProxy, m_shapeControllerBase, KoShapeManager::setUpdatesBlocked(), KisShapeSelectionModel::setUpdatesEnabled(), KisShapeSelectionCanvas::shapeManager(), and KoShapeContainer::shapes().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 109 of file kis_shape_selection.cpp.
References KisShapeSelection().
|
private |
Definition at line 88 of file kis_shape_selection.cpp.
References KoShapeManager::addShape(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_canvas, m_converter, m_model, m_shapeControllerBase, KoShape::setSelectable(), KoShape::setShapeId(), KisShapeSelectionCanvas::shapeManager(), sigMoveShapes(), and slotMoveShapes().
|
private |
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 169 of file kis_shape_selection.cpp.
References KisShapeSelectionModel::count(), and m_model.
| bool KisShapeSelection::loadSelection | ( | KoStore * | store, |
| const QRect & | imageRect ) |
Definition at line 122 of file kis_shape_selection.cpp.
References KoShapeContainer::addShape(), KoStore::close(), KisShapeLayer::createShapesFromSvg(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_canvas, m_resolutionProxy, KoStore::open(), KoStoreDevice::open(), qFuzzyCompare(), KoCanvasBase::shapeController, and KoShapeContainer::shapes().
|
overridevirtual |
Reimplemented from KisSelectionComponent.
Definition at line 284 of file kis_shape_selection.cpp.
References m_resolutionProxy, and sigMoveShapes().
|
overridevirtual |
Reimplemented from KisSelectionComponent.
Definition at line 290 of file kis_shape_selection.cpp.
References m_resolutionProxy, and sigMoveShapes().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 174 of file kis_shape_selection.cpp.
References m_outline.
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 179 of file kis_shape_selection.cpp.
|
overrideprotectedvirtual |
Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does.
| painter | used for painting the shape |
Implements KoShapeContainer.
Definition at line 208 of file kis_shape_selection.cpp.
|
overridevirtual |
WARNING: we should unite all the shapes in image coordinates, not in points. Boolean operations inside the QPainterPath linearize the curves into lines and they use absolute values for thresholds.
See KritaUtils::pathShapeBooleanSpaceWorkaround() for more info
Implements KisSelectionComponent.
Definition at line 184 of file kis_shape_selection.cpp.
References KoShape::absoluteTransformation(), m_outline, m_resolutionProxy, KoShape::outline(), and KoShapeContainer::shapes().
|
private |
Definition at line 227 of file kis_shape_selection.cpp.
References KisPaintDevice::clear(), KisPaintDevice::colorSpace(), KoColor::createTransparent(), KisDefaultBoundsBase::currentLevelOfDetail(), KoColor::data(), KisPaintDevice::defaultBounds(), KisPaintDevice::defaultPixel(), KisPaintDevice::fill(), KIS_SAFE_ASSERT_RECOVER_RETURN, KisLodTransform::map(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixel(), OPACITY_TRANSPARENT_U8, outlineCache(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::rawData(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::x(), and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::y().
|
overridevirtual |
Renders the shapes to a selection. This method should only be called by KisSelection to update it's projection.
| projection | the target selection |
Implements KisSelectionComponent.
Definition at line 213 of file kis_shape_selection.cpp.
References KoShapeLayer::boundingRect(), outlineCache(), and renderSelection().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 221 of file kis_shape_selection.cpp.
References renderSelection().
|
overridevirtual |
Reimplemented from KisSelectionComponent.
Definition at line 164 of file kis_shape_selection.cpp.
References KisTakeAllShapesCommand.
| bool KisShapeSelection::saveSelection | ( | KoStore * | store, |
| const QRect & | imageRect ) const |
Definition at line 114 of file kis_shape_selection.cpp.
References m_resolutionProxy, KisShapeLayer::saveShapesToStore(), and KoShapeContainer::shapes().
|
overridevirtual |
Reimplemented from KisSelectionComponent.
Definition at line 336 of file kis_shape_selection.cpp.
References m_model, m_resolutionProxy, and KisShapeSelectionModel::setResolutionProxy().
|
private |
Definition at line 154 of file kis_shape_selection.cpp.
References m_model, and KisShapeSelectionModel::setUpdatesEnabled().
| KoShapeManager * KisShapeSelection::shapeManager | ( | ) | const |
Definition at line 273 of file kis_shape_selection.cpp.
References m_canvas, and KisShapeSelectionCanvas::shapeManager().
|
signal |
|
privateslot |
Definition at line 296 of file kis_shape_selection.cpp.
References KoShape::position(), KoShape::setPosition(), shapeManager(), and KoShapeContainer::shapes().
|
overridevirtual |
Reimplemented from KisSelectionComponent.
Definition at line 307 of file kis_shape_selection.cpp.
References KoShape::absoluteTransformation(), KoViewConverter::documentToView(), m_canvas, m_converter, KoShape::parent(), KisShapeSelectionCanvas::shapeManager(), KoShapeContainer::shapes(), KoShapeManager::shapes, KoShape::transform(), KoShape::transformation(), and KoViewConverter::viewToDocument().
|
private |
Definition at line 159 of file kis_shape_selection.cpp.
References m_model, and KisShapeSelectionModel::updatesEnabled().
|
friend |
Definition at line 111 of file kis_shape_selection.h.
|
friend |
Definition at line 96 of file kis_shape_selection.h.
|
private |
Definition at line 107 of file kis_shape_selection.h.
|
private |
Definition at line 106 of file kis_shape_selection.h.
|
private |
Definition at line 108 of file kis_shape_selection.h.
|
private |
Definition at line 105 of file kis_shape_selection.h.
|
private |
Definition at line 109 of file kis_shape_selection.h.
|
private |
Definition at line 110 of file kis_shape_selection.h.