Krita Source Code Documentation
Loading...
Searching...
No Matches
KisShapeLayer Class Reference

#include <kis_shape_layer.h>

+ Inheritance diagram for KisShapeLayer:

Classes

struct  Private
 

Signals

void currentLayerChanged (const KoShapeLayer *layer)
 
void selectionChanged ()
 
void sigMoveShapes (const QPointF &diff)
 
- Signals inherited from KisNode
void sigNodeChangedInternal ()
 
- Signals inherited from KisBaseNode
void keyframeChannelAdded (KisKeyframeChannel *channel)
 
void opacityChanged (quint8 value)
 

Public Member Functions

bool accept (KisNodeVisitor &) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
bool allowAsChild (KisNodeSP) const override
 
bool antialiased () const
 
KisNodeSP clone () const override
 
KUndo2Command * convertTo (const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags()) override
 
KisLayerSP createMergedLayerTemplate (KisLayerSP prevLayer) override
 
KUndo2Command * crop (const QRect &rect) override
 
void fillMergedLayerTemplate (KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer) override
 
void forceUpdateHiddenAreaOnOriginal () override
 
void forceUpdateTimedNode () override
 
bool hasPendingTimedUpdates () const override
 
QIcon icon () const override
 
bool isSelectable () const
 
bool isShapeEditable (bool recursive) const override
 checks recursively if the shape or one of its parents is not visible or locked
 
 KisShapeLayer (const KisShapeLayer &_rhs)
 
 KisShapeLayer (const KisShapeLayer &_rhs, KoShapeControllerBase *controller)
 
 KisShapeLayer (const KisShapeLayer &_rhs, KoShapeControllerBase *controller, std::function< KisShapeLayerCanvasBase *()> canvasFactory)
 
 KisShapeLayer (const KisShapeLayer &baseTemplate, const QList< KoShape * > &newShapes)
 
 KisShapeLayer (KoShapeControllerBase *shapeController, KisImageWSP image, const QString &name, quint8 opacity)
 
bool loadLayer (KoStore *store, QStringList *warnings=0)
 
KisPaintDeviceSP original () const override
 
KisPaintDeviceSP paintDevice () const override
 
void resetCache (const KoColorSpace *colorSpace) override
 
bool saveLayer (KoStore *store) const
 
KisBaseNode::PropertyList sectionModelProperties () const override
 
KoSelectedShapesProxy * selectedShapesProxy ()
 selectedShapesProxy
 
void setAntialiased (const bool antialiased)
 
void setImage (KisImageWSP image) override
 
void setParent (KoShapeContainer *parent)
 
KUndo2Command * setProfile (const KoColorProfile *profile) override
 
void setSectionModelProperties (const KisBaseNode::PropertyList &properties) override
 
void setUserLocked (bool value) override
 
void setVisible (bool visible, bool isLoading=false) override
 
void setX (qint32) override
 
void setY (qint32) override
 
KoShapeManager * shapeManager () const
 
QRect theoreticalBoundingRect () const override
 
KUndo2Command * transform (const QTransform &transform) override
 
KisLayerSP tryCreateInternallyMergedLayerFromMutipleLayers (QList< KisLayerSP > layers) override
 
bool visible (bool recursive=false) const override
 
qint32 x () const override
 
qint32 y () const override
 
 ~KisShapeLayer () override
 
- Public Member Functions inherited from KisExternalLayer
 KisExternalLayer (KisImageWSP image, const QString &name, quint8 opacity)
 
virtual bool supportsPerspectiveTransform () const
 
- Public Member Functions inherited from KisLayer
bool alphaChannelDisabled () const
 
void buildProjectionUpToNode (KisPaintDeviceSP projection, KisNodeSP lastNode, const QRect &rect)
 
QBitArray & channelFlags () const
 
KisFilterMaskSP colorOverlayMask () const
 
const KoColorSpace * colorSpace () const override
 returns the image's colorSpace or null, if there is no image
 
const KoCompositeOp * compositeOp () const override
 returns the layer's composite op for the colorspace of the layer's parent.
 
QImage createThumbnail (qint32 w, qint32 h, Qt::AspectRatioMode aspectRatioMode, KisThumbnailBoundsMode boundsMode) override
 
QImage createThumbnailForFrame (qint32 w, qint32 h, int time, Qt::AspectRatioMode aspectRatioMode, KisThumbnailBoundsMode boundsMode) override
 
void disableAlphaChannel (bool disable)
 
QList< KisEffectMaskSP > effectMasks () const
 
QList< KisEffectMaskSP > effectMasks (KisNodeSP lastNode) const
 
QRect exactBounds () const override
 
QRect extent () const override
 
bool hasClones () const
 
bool hasEffectMasks () const
 
virtual KisLayerProjectionPlaneSP internalProjectionPlane () const
 
 KisLayer (const KisLayer &rhs)
 
 KisLayer (KisImageWSP image, const QString &name, quint8 opacity)
 
KisPSDLayerStyleSP layerStyle () const
 
QRect looseUserVisibleBounds () const
 
KisMetaData::Store * metaData ()
 
virtual bool needProjection () const
 
void notifyChildMaskChanged ()
 
KisLayerSP parentLayer () const
 
QRect partialChangeRect (KisNodeSP lastNode, const QRect &rect)
 
 Private (KisLayer *q)
 
KisPaintDeviceSP projection () const override
 
KisAbstractProjectionPlaneSP projectionPlane () const override
 
void registerClone (KisCloneLayerWSP clone)
 
const QList< KisCloneLayerWSP > registeredClones () const
 
virtual KisSelectionSP selection () const
 
virtual KisSelectionMaskSP selectionMask () const
 
virtual void setChannelFlags (const QBitArray &channelFlags)
 
void setLayerStyle (KisPSDLayerStyleSP layerStyle)
 
void setTemporary (bool t)
 
bool temporary () const
 
int thumbnailSeqNo () const override
 
QRect tightUserVisibleBounds () const
 
void unregisterClone (KisCloneLayerWSP clone)
 
void updateClones (const QRect &rect, bool dontInvalidateFrames)
 
 ~KisLayer () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisNode
KisNodeSP at (quint32 index) const
 
KisBusyProgressIndicator * busyProgressIndicator () const
 
quint32 childCount () const
 
QList< KisNodeSP > childNodes (const QStringList &nodeTypes, const KoProperties &properties) const
 
const KisNode * findSymmetricClone (const KisNode *srcRoot, const KisNode *dstRoot, const KisNode *srcTarget)
 
KisNodeSP firstChild () const
 
virtual KisPaintDeviceList getLodCapableDevices () const
 
KisNodeGraphListener * graphListener () const
 
int graphSequenceNumber () const
 
void handleKeyframeChannelFrameAboutToBeRemoved (const KisKeyframeChannel *channel, int time)
 
virtual void handleKeyframeChannelFrameAdded (const KisKeyframeChannel *channel, int time)
 
virtual void handleKeyframeChannelFrameChange (const KisKeyframeChannel *channel, int time)
 
void handleKeyframeChannelFrameHasBeenRemoved (const KisKeyframeChannel *channel, int time)
 
KisFrameChangeUpdateRecipe handleKeyframeChannelUpdateImpl (const KisKeyframeChannel *channel, int time)
 
int index (const KisNodeSP node) const
 
void invalidateFrames (const KisTimeSpan &range, const QRect &rect)
 
 KisNode (const KisNode &rhs)
 
 KisNode (KisImageWSP image)
 
KisNodeSP lastChild () const
 
KisNodeSP nextSibling () const
 
KisNodeProgressProxy * nodeProgressProxy () const
 
KisNodeSP parent () const
 
KisNodeSP prevSibling () const
 
 Private (KisNode *node)
 
void processDuplicatedClones (const KisNode *srcDuplicationRoot, const KisNode *dstDuplicationRoot, KisNode *node)
 
virtual KisProjectionLeafSP projectionLeaf () const
 
void requestTimeSwitch (int time)
 
virtual void setDirty ()
 
void setDirty (const KisRegion &region)
 
void setDirty (const QRect &rect)
 
virtual void setDirty (const QVector< QRect > &rects)
 
void setDirtyDontResetAnimationCache ()
 
void setDirtyDontResetAnimationCache (const QRect &rect)
 
void setDirtyDontResetAnimationCache (const QVector< QRect > &rects)
 setDirtyDontResetAnimationCache does almost the same thing as usual setDirty() call, but doesn't reset the animation cache (since onion skins are not used when rendering animation.
 
void setGraphListener (KisNodeGraphListener *graphListener)
 
virtual void syncLodCache ()
 
 ~KisNode () override
 
- Public Member Functions inherited from KisBaseNode
bool belongsToIsolatedGroup () const
 
bool check (const KoProperties &properties) const
 
bool collapsed () const
 
int colorLabelIndex () const
 
virtual KisPaintDeviceSP colorSampleSourceDevice () const
 
const QString & compositeOpId () const
 
QImage createPreferredThumbnail (qint32 w, qint32 h, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio)
 
QImage createPreferredThumbnailForFrame (qint32 w, qint32 h, int time, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio)
 
void enableAnimation ()
 
KisKeyframeChannel * getKeyframeChannel (const QString &id) const
 
KisKeyframeChannel * getKeyframeChannel (const QString &id, bool create)
 
bool hasEditablePaintDevice () const
 
KisImageWSP image () const
 
bool isAnimated () const
 
bool isEditable (bool checkVisibility=true) const
 
virtual bool isFakeNode () const
 
bool isIsolatedRoot () const
 
bool isPinnedToTimeline () const
 
QMap< QString, KisKeyframeChannel * > keyframeChannels () const
 
 KisBaseNode (const KisBaseNode &rhs)
 
 KisBaseNode (KisImageWSP image)
 
void mergeNodeProperties (const KoProperties &properties)
 
QString name () const
 
const KoProperties & nodeProperties () const
 
quint8 opacity () const
 
quint8 percentOpacity () const
 
KisThumbnailBoundsMode preferredThumbnailBoundsMode () const
 
 Private (const Private &rhs)
 
 Private (KisImageWSP p_image)
 
void setCollapsed (bool collapsed)
 
void setColorLabelIndex (int index)
 
void setCompositeOpId (const QString &compositeOpId)
 
void setName (const QString &name)
 
void setNodeProperty (const QString &name, const QVariant &value)
 
void setOpacity (quint8 val)
 
void setPercentOpacity (quint8 val)
 
void setPinnedToTimeline (bool pinned)
 
void setPreferredThumbnailBoundsMode (KisThumbnailBoundsMode value) const
 
void setUuid (const QUuid &id)
 
virtual bool supportsKeyframeChannel (const QString &id)
 
bool supportsLodMoves () const
 
virtual bool supportsLodPainting () const
 
virtual void updateSettings ()
 
bool userLocked () const
 
QUuid uuid () const
 
 ~KisBaseNode () override
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 
- 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
 
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 KisDelayedUpdateNodeInterface
virtual ~KisDelayedUpdateNodeInterface ()
 
- Public Member Functions inherited from KisCroppedOriginalLayerInterface
virtual ~KisCroppedOriginalLayerInterface ()
 

Static Public Member Functions

static QList< KoShape * > createShapesFromSvg (QIODevice *device, const QString &baseXmlDir, const QRectF &rectInPixels, qreal resolutionPPI, KoDocumentResourceManager *resourceManager, bool loadingFromKra, QSizeF *fragmentSize, QStringList *warnings=0, QStringList *errors=0)
 
static bool saveShapesToStore (KoStore *store, QList< KoShape * > shapes, const QSizeF &sizeInPt)
 
- Static Public Member Functions inherited from KoShape
static QRectF absoluteOutlineRect (const QList< KoShape * > &shapes)
 
static QRectF boundingRect (const QList< KoShape * > &shapes)
 
static bool compareShapeZIndex (KoShape *s1, KoShape *s2)
 
static KisHandlePainterHelper createHandlePainterHelperDocument (QPainter *painter, KoShape *shape, qreal handleRadius, int decorationThickness)
 
static KisHandlePainterHelper createHandlePainterHelperView (QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1)
 
static QVector< PaintOrder > defaultPaintOrder ()
 default paint order as per SVG specification
 
static QList< KoShape * > linearizeSubtree (const QList< KoShape * > &shapes)
 
static QList< KoShape * > linearizeSubtreeSorted (const QList< KoShape * > &shapes)
 

Protected Member Functions

KisShapeLayerCanvasBase * canvas () const
 
const KoViewConverter * converter () const
 
bool isVisible (bool recursive=true) const
 
 KisShapeLayer (KoShapeControllerBase *shapeController, KisImageWSP image, const QString &name, quint8 opacity, std::function< KisShapeLayerCanvasBase *()> canvasFactory)
 
bool loadSvg (QIODevice *device, const QString &baseXmlDir, QStringList *warnings=0)
 
KoShapeControllerBase * shapeController () const
 
- Protected Member Functions inherited from KisLayer
virtual QRect amortizedProjectionRectForCleanupInChangePass () const
 
QRect applyMasks (const KisPaintDeviceSP source, KisPaintDeviceSP destination, const QRect &requestedRect, KisNodeSP filthyNode, KisNodeSP lastNode, KisRenderPassFlags flags) const
 
bool canMergeAndKeepBlendOptions (KisLayerSP otherLayer)
 
QRect changeRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
void childNodeChanged (KisNodeSP changedChildNode) override
 
virtual void copyOriginalToProjection (const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect &rect) const
 
virtual QRect incomingChangeRect (const QRect &rect) const
 
QRect masksChangeRect (const QList< KisEffectMaskSP > &masks, const QRect &requestedRect, bool &rectVariesFlag) const
 
QRect masksNeedRect (const QList< KisEffectMaskSP > &masks, const QRect &changeRect, QStack< QRect > &applyRects, bool &rectVariesFlag) const
 
QRect needRectForOriginal (const QRect &rect) const
 
virtual QRect outgoingChangeRect (const QRect &rect) const
 
QList< KisEffectMaskSP > searchEffectMasks (KisNodeSP lastNode) const
 
QRect updateProjection (const QRect &rect, KisNodeSP filthyNode, KisRenderPassFlags flags)
 
- Protected Member Functions inherited from KisNode
virtual QRect accessRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const
 
void addKeyframeChannel (KisKeyframeChannel *channel) override
 
void baseNodeChangedCallback () override
 
void baseNodeCollapsedChangedCallback () override
 
void baseNodeInvalidateAllFramesCallback () override
 
virtual KisFrameChangeUpdateRecipe handleKeyframeChannelFrameAboutToBeRemovedImpl (const KisKeyframeChannel *channel, int time)
 
virtual QRect needRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const
 
void notifyParentVisibilityChanged (bool value) override
 
KisBaseNodeSP parentCallback () const override
 
- Protected Member Functions inherited from KisBaseNode
virtual KisKeyframeChannel * requestKeyframeChannel (const QString &id)
 
void setSupportsLodMoves (bool value)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 
- 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 slotImageResolutionChanged ()
 
void slotMoveShapes (const QPointF &diff)
 
void slotTransformShapes (const QTransform &transform)
 

Private Member Functions

void initShapeLayerImpl (KoShapeControllerBase *controller, KisShapeLayerCanvasBase *overrideCanvas)
 
QList< KoShape * > shapesToBeTransformed ()
 

Private Attributes

Private *const m_d
 

Friends

class ShapeLayerContainerModel
 
class TransformShapeLayerDeferred
 

Additional Inherited Members

- Public Types inherited from KisNode
enum  PositionToFilthy { N_ABOVE_FILTHY = 0x08 , N_FILTHY_PROJECTION = 0x20 , N_FILTHY = 0x40 , N_BELOW_FILTHY = 0x80 }
 
- Public Types inherited from KisBaseNode
typedef QList< Property > PropertyList
 
- Public Types inherited from KoShape
enum  ChangeType {
  PositionChanged , RotationChanged , ScaleChanged , ShearChanged ,
  SizeChanged , GenericMatrixChange , KeepAspectRatioChange , ParentChanged ,
  Deleted , StrokeChanged , BackgroundChanged , BorderChanged ,
  ParameterChanged , ContentChanged , TextContourMarginChanged , ChildChanged ,
  ConnectionPointChanged , ClipPathChanged , ClipMaskChanged , TransparencyChanged ,
  GeometryProtectedChanged
}
 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 Attributes inherited from KisLayer
QBitArray channelFlags
 
KisCloneLayersList clonesList
 
KisPSDLayerStyleSP layerStyle
 
KisLayerStyleProjectionPlaneSP layerStyleProjectionPlane
 
KisLayerMasksCache masksCache
 
KisMetaData::Store * metaDataStore {nullptr}
 
KisLayerProjectionPlaneSP projectionPlane
 
KisSafeNodeProjectionStoreSP safeProjection
 
- Public Attributes inherited from Private
KisCanvas2 * canvas
 
int displayedFrame
 
int intendedFrame
 
- Public Attributes inherited from KisNode
KisBusyProgressIndicator * busyProgressIndicator
 
std::optional< KisFrameChangeUpdateRecipe > frameRemovalUpdateRecipe
 
KisNodeGraphListener * graphListener
 
KisNodeProgressProxy * nodeProgressProxy
 
KisSafeReadNodeList nodes
 
QReadWriteLock nodeSubgraphLock
 
KisNodeWSP parent
 
KisProjectionLeafSP projectionLeaf
 
- Public Attributes inherited from KisBaseNode
bool animated {false}
 
bool collapsed {false}
 
QString compositeOp
 
KisBaseNode::Property hack_visible
 
QUuid id
 
KisImageWSP image
 
QMap< QString, KisKeyframeChannel * > keyframeChannels
 
KisAnimatedOpacityProperty opacityProperty
 
bool pinnedToTimeline {false}
 
KoProperties properties
 
bool supportsLodMoves {false}
 
KisThumbnailBoundsMode thumbnailBoundsMode { KisThumbnailBoundsMode::Precise }
 
- Public Attributes inherited from KoShapeContainer
KoShapeContainerModel * model
 
KoShapeContainer::ShapeInterface shapeInterface
 
- Static Public Attributes inherited from KoShape
static const qint16 maxZIndex = std::numeric_limits<qint16>::max()
 
static const qint16 minZIndex = std::numeric_limits<qint16>::min()
 

Detailed Description

A KisShapeLayer contains any number of non-krita flakes, such as path shapes, text shapes and anything else people come up with.

The KisShapeLayer has a shapemanager and a canvas of its own. The canvas paints onto the projection, and the projection is what we render in Krita. This means that no matter how many views you have, you cannot have a different view on your shapes per view.

XXX: what about removing shapes?

Definition at line 43 of file kis_shape_layer.h.

Constructor & Destructor Documentation

◆ KisShapeLayer() [1/6]

KisShapeLayer::KisShapeLayer ( KoShapeControllerBase * shapeController,
KisImageWSP image,
const QString & name,
quint8 opacity )

Definition at line 142 of file kis_shape_layer.cc.

146 : KisShapeLayer(controller, image, name, opacity,
147 [&] () { return new KisShapeLayerCanvas(image->colorSpace(), new KisDefaultBounds(image), this);})
148{
149}
const KoColorSpace * colorSpace() const
KisShapeLayer(KoShapeControllerBase *shapeController, KisImageWSP image, const QString &name, quint8 opacity)
QString name() const
Definition KoShape.cpp:953
KisImageWSP image
quint8 opacity() const

References KisImage::colorSpace(), and KisBaseNode::image.

◆ KisShapeLayer() [2/6]

KisShapeLayer::KisShapeLayer ( const KisShapeLayer & _rhs)

Definition at line 151 of file kis_shape_layer.cc.

152 : KisShapeLayer(rhs,
153 rhs.m_d->controller)
154{
155}

◆ KisShapeLayer() [3/6]

KisShapeLayer::KisShapeLayer ( const KisShapeLayer & _rhs,
KoShapeControllerBase * controller )

Definition at line 157 of file kis_shape_layer.cc.

158 : KisShapeLayer(rhs,
159 controller,
160 [&] () {
161 const KisShapeLayerCanvas* shapeLayerCanvas = dynamic_cast<const KisShapeLayerCanvas*>(rhs.m_d->canvas);
162 KIS_ASSERT(shapeLayerCanvas);
163 return new KisShapeLayerCanvas(*shapeLayerCanvas, this);})
164{
165}
#define KIS_ASSERT(cond)
Definition kis_assert.h:33

References KisShapeLayer::Private::canvas, KIS_ASSERT, and m_d.

◆ KisShapeLayer() [4/6]

KisShapeLayer::KisShapeLayer ( const KisShapeLayer & _rhs,
KoShapeControllerBase * controller,
std::function< KisShapeLayerCanvasBase *()> canvasFactory )

The transformations of the added shapes are automatically merged into the transformation of the layer, so we should apply this extra transform separately

Definition at line 167 of file kis_shape_layer.cc.

169 : KisExternalLayer(_rhs)
170 , KoShapeLayer(new ShapeLayerContainerModel(this)) //no _rhs here otherwise both layer have the same KoShapeContainerModel
171 , m_d(new Private())
172{
173 initShapeLayerImpl(controller, canvasFactory());
175
180 const QTransform thisInvertedTransform = this->absoluteTransformation().inverted();
181
183
184 Q_FOREACH (KoShape *shape, _rhs.shapes()) {
185 KoShape *clonedShape = shape->cloneShape();
186 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
187 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
188 addShape(clonedShape);
189 }
190
192}
KisExternalLayer(KisImageWSP image, const QString &name, quint8 opacity)
KoShapeManager * shapeManager() const override
Private *const m_d
void initShapeLayerImpl(KoShapeControllerBase *controller, KisShapeLayerCanvasBase *overrideCanvas)
friend class ShapeLayerContainerModel
QList< KoShape * > shapes() const
void addShape(KoShape *shape)
KoShapeLayer()
The default constructor.
void setUpdatesBlocked(bool value)
QTransform absoluteTransformation() const
Definition KoShape.cpp:330
void setTransformation(const QTransform &matrix)
Definition KoShape.cpp:369
virtual KoShape * cloneShape() const
creates a deep copy of the shape or shape's subtree
Definition KoShape.cpp:173
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
KisShapeLayerCanvasBase * canvas

References KoShape::absoluteTransformation(), KoShapeContainer::addShape(), KisShapeLayer::Private::canvas, KoShape::cloneShape(), initShapeLayerImpl(), KisShapeLayer::Private::isAntialiased, KIS_SAFE_ASSERT_RECOVER, m_d, KoShape::setTransformation(), KoShapeManager::setUpdatesBlocked(), KisShapeLayerCanvasBase::shapeManager(), and KoShapeContainer::shapes().

◆ KisShapeLayer() [5/6]

KisShapeLayer::KisShapeLayer ( const KisShapeLayer & baseTemplate,
const QList< KoShape * > & newShapes )

Merge constructor

Creates a new layer as a merge of two existing layers. The shapes of baseTemplate are not used. You need to add them into newShapes to be used in the final layer.

newShapes are the shapes used in the new shape layer, they should be z-order sorted homogenized externally before calling this constructor

With current implementation this matrix will always be an identity, because we do not copy the transformation from any of the source layers. But we should handle this anyway, to not be caught by this in the future.

Definition at line 194 of file kis_shape_layer.cc.

195 : KisExternalLayer(baseTemplate)
196 , KoShapeLayer(new ShapeLayerContainerModel(this)) //no _merge here otherwise both layer have the same KoShapeContainerModel
197 , m_d(new Private())
198{
199 // Make sure our new layer is visible otherwise the shapes cannot be painted.
200 setVisible(true);
201
202 m_d->isAntialiased = baseTemplate.m_d->isAntialiased;
203
204 const KisShapeLayerCanvas* shapeLayerCanvas = dynamic_cast<const KisShapeLayerCanvas*>(baseTemplate.canvas());
205 KIS_ASSERT(shapeLayerCanvas);
206 initShapeLayerImpl(baseTemplate.m_d->controller, new KisShapeLayerCanvas(*shapeLayerCanvas, this));
207
213 const QTransform thisInvertedTransform = this->absoluteTransformation().inverted();
214
215 QList<KoShape *> clonedShapes;
216
217 // copy all the new shapes; we expect them to be sorted and homogenized
218
219 const bool isSorted = std::is_sorted(newShapes.begin(), newShapes.end(), KoShape::compareShapeZIndex);
221
222 Q_FOREACH (KoShape *shape, newShapes) {
223 KoShape *clonedShape = shape->cloneShape();
224 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
225 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
226 clonedShapes.append(clonedShape);
227 }
228
229 Q_FOREACH (KoShape *shape, clonedShapes) {
230 addShape(shape);
231 }
232}
void setVisible(bool visible, bool isLoading=false) override
KisShapeLayerCanvasBase * canvas() const
static bool compareShapeZIndex(KoShape *s1, KoShape *s2)
Definition KoShape.cpp:388
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
KoShapeControllerBase * controller

References KoShape::absoluteTransformation(), KoShapeContainer::addShape(), canvas(), KoShape::cloneShape(), KoShape::compareShapeZIndex(), KisShapeLayer::Private::controller, initShapeLayerImpl(), KisShapeLayer::Private::isAntialiased, KIS_ASSERT, KIS_SAFE_ASSERT_RECOVER, KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KoShape::setTransformation(), and setVisible().

◆ ~KisShapeLayer()

KisShapeLayer::~KisShapeLayer ( )
override

Small hack alert: we should avoid updates on shape deletion

Definition at line 246 of file kis_shape_layer.cc.

247{
252
253 Q_FOREACH (KoShape *shape, shapes()) {
254 shape->setParent(0);
255 delete shape;
256 }
257
258 delete m_d->canvas;
259 delete m_d;
260}
void setParent(KoShapeContainer *parent)
Definition KoShape.cpp:459

References KisShapeLayer::Private::canvas, m_d, KisShapeLayerCanvasBase::prepareForDestroying(), KoShape::setParent(), and KoShapeContainer::shapes().

◆ KisShapeLayer() [6/6]

KisShapeLayer::KisShapeLayer ( KoShapeControllerBase * shapeController,
KisImageWSP image,
const QString & name,
quint8 opacity,
std::function< KisShapeLayerCanvasBase *()> canvasFactory )
protected

Definition at line 234 of file kis_shape_layer.cc.

241 , m_d(new Private())
242{
243 initShapeLayerImpl(controller, canvasFactory());
244}

References initShapeLayerImpl().

Member Function Documentation

◆ accept() [1/2]

bool KisShapeLayer::accept ( KisNodeVisitor & )
overridevirtual

Accept the KisNodeVisitor (for the Visitor design pattern), should call the correct function on the KisNodeVisitor for this node type, so you need to override it for all leaf classes in the node inheritance hierarchy.

return false if the visitor could not successfully act on this node instance.

Reimplemented from KisNode.

Definition at line 504 of file kis_shape_layer.cc.

505{
506 return visitor.visit(this);
507}

References KisNodeVisitor::visit().

◆ accept() [2/2]

void KisShapeLayer::accept ( KisProcessingVisitor & visitor,
KisUndoAdapter * undoAdapter )
overridevirtual

Accept the KisNodeVisitor (for the Visitor design pattern), should call the correct function on the KisProcessingVisitor for this node type, so you need to override it for all leaf classes in the node inheritance hierarchy.

The processing visitor differs from node visitor in the way that it accepts undo adapter, that allows the processing to be multithreaded

Reimplemented from KisNode.

Definition at line 509 of file kis_shape_layer.cc.

510{
511 return visitor.visit(this, undoAdapter);
512}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ allowAsChild()

bool KisShapeLayer::allowAsChild ( KisNodeSP ) const
overridevirtual

Re-implement this method to add constraints for the subclasses that can be added as children to this node

Returns
false if the given node is not allowed as a child to this node

Implements KisNode.

Definition at line 294 of file kis_shape_layer.cc.

295{
296 return node->inherits("KisMask");
297}

◆ antialiased()

bool KisShapeLayer::antialiased ( ) const

Definition at line 811 of file kis_shape_layer.cc.

812{
813 return m_d->isAntialiased;
814}

References KisShapeLayer::Private::isAntialiased, and m_d.

◆ canvas()

KisShapeLayerCanvasBase * KisShapeLayer::canvas ( ) const
protected

Definition at line 794 of file kis_shape_layer.cc.

795{
796 return m_d->canvas;
797}

References KisShapeLayer::Private::canvas, and m_d.

◆ clone()

KisNodeSP KisShapeLayer::clone ( ) const
inlineoverridevirtual

Implements KisNode.

Definition at line 79 of file kis_shape_layer.h.

79 {
80 return new KisShapeLayer(*this);
81 }

◆ converter()

const KoViewConverter * KisShapeLayer::converter ( ) const
protected

Definition at line 519 of file kis_shape_layer.cc.

520{
521 return m_d->canvas->viewConverter();
522}
const KoViewConverter * viewConverter() const override

References KisShapeLayer::Private::canvas, m_d, and KisShapeLayerCanvasBase::viewConverter().

◆ convertTo()

KUndo2Command * KisShapeLayer::convertTo ( const KoColorSpace * dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags() )
overridevirtual

Reimplemented from KisExternalLayer.

Definition at line 778 of file kis_shape_layer.cc.

779{
780 using namespace KisDoSomethingCommandOps;
781
782 KUndo2Command *cmd = new KUndo2Command();
784 m_d->paintDevice->convertTo(dstColorSpace, renderingIntent, conversionFlags, cmd);
786 return cmd;
787}
void convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags(), KUndo2Command *parentCommand=nullptr, KoUpdater *progressUpdater=nullptr)
KisPaintDeviceSP paintDevice

References KisPaintDevice::convertTo(), m_d, and KisShapeLayer::Private::paintDevice.

◆ createMergedLayerTemplate()

KisLayerSP KisShapeLayer::createMergedLayerTemplate ( KisLayerSP prevLayer)
overridevirtual

Create and return a layer that is the result of merging this with layer.

This method is designed to be called only within KisImage::mergeLayerDown().

Descendants override this to create specific merged types when possible. The KisLayer one creates a KisPaintLayerSP via a bitBlt, and can work on all layer types.

Descendants that perform their own version do NOT call KisLayer::createMergedLayer

Reimplemented from KisLayer.

Definition at line 377 of file kis_shape_layer.cc.

378{
379 KisLayerSP newLayer;
380
381 KisShapeLayer *prevShape = dynamic_cast<KisShapeLayer*>(prevLayer.data());
382 if (prevShape) {
383 newLayer = tryCreateInternallyMergedLayerFromMutipleLayers({prevLayer, this});
385 }
386
387 return newLayer ? newLayer : KisExternalLayer::createMergedLayerTemplate(prevLayer);
388}
KisLayerSP tryCreateInternallyMergedLayerFromMutipleLayers(QList< KisLayerSP > layers) override
virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer)
Definition kis_layer.cc:407

References KisLayer::createMergedLayerTemplate(), KisSharedPtr< T >::data(), KIS_SAFE_ASSERT_RECOVER_NOOP, and tryCreateInternallyMergedLayerFromMutipleLayers().

◆ createShapesFromSvg()

QList< KoShape * > KisShapeLayer::createShapesFromSvg ( QIODevice * device,
const QString & baseXmlDir,
const QRectF & rectInPixels,
qreal resolutionPPI,
KoDocumentResourceManager * resourceManager,
bool loadingFromKra,
QSizeF * fragmentSize,
QStringList * warnings = 0,
QStringList * errors = 0 )
static

We set default text version to 1, it will make all the files not having an explicit krita:textVersion tag load as "legacy" files with the bug.

The tag is not needed when loading from pure SVG, because most probably they were not saved by a buggy Krita version.

Definition at line 598 of file kis_shape_layer.cc.

599{
600
601 QString errorMsg;
602 int errorLine = 0;
603 int errorColumn;
604
605 QDomDocument doc = SvgParser::createDocumentFromSvg(device, &errorMsg, &errorLine, &errorColumn);
606 if (doc.isNull()) {
607 errKrita << "Parsing error in contents.svg! Aborting!" << Qt::endl
608 << " In line: " << errorLine << ", column: " << errorColumn << Qt::endl
609 << " Error message: " << errorMsg << Qt::endl;
610
611 if (errors) {
612 *errors << i18n("Parsing error in the main document at line %1, column %2\nError message: %3"
613 , errorLine , errorColumn , errorMsg);
614 }
615 return QList<KoShape*>();
616 }
617
618 SvgParser parser(resourceManager);
619 parser.setXmlBaseDir(baseXmlDir);
620 parser.setResolution(rectInPixels /* px */, resolutionPPI /* ppi */);
621
622 if (loadingFromKra) {
631 parser.setDefaultKraTextVersion(1);
632 }
633
634 QList<KoShape *> result = parser.parseSvg(doc.documentElement(), fragmentSize);
635
636 if (warnings) {
637 *warnings = parser.warnings();
638 }
639
640 return result;
641}
static QDomDocument createDocumentFromSvg(QIODevice *device, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0)
#define errKrita
Definition kis_debug.h:115

References SvgParser::createDocumentFromSvg(), errKrita, SvgParser::parseSvg(), SvgParser::setDefaultKraTextVersion(), SvgParser::setResolution(), SvgParser::setXmlBaseDir(), and SvgParser::warnings().

◆ crop()

KUndo2Command * KisShapeLayer::crop ( const QRect & rect)
overridevirtual

Reimplemented from KisExternalLayer.

Definition at line 705 of file kis_shape_layer.cc.

706{
707 QPoint oldPos(x(), y());
708 QPoint newPos = oldPos - rect.topLeft();
709
710 return new KisNodeMoveCommand2(this, oldPos, newPos);
711}
qint32 y() const override
qint32 x() const override

References x(), and y().

◆ currentLayerChanged

void KisShapeLayer::currentLayerChanged ( const KoShapeLayer * layer)
signal

◆ fillMergedLayerTemplate()

void KisShapeLayer::fillMergedLayerTemplate ( KisLayerSP dstLayer,
KisLayerSP prevLayer,
bool skipPaintingThisLayer )
overridevirtual

Reimplemented from KisLayer.

Definition at line 390 of file kis_shape_layer.cc.

391{
392 if (!dynamic_cast<KisShapeLayer*>(dstLayer.data())) {
393 KisLayer::fillMergedLayerTemplate(dstLayer, prevLayer, skipPaintingThisLayer);
394 }
395}
virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer=false)
Definition kis_layer.cc:422

References KisSharedPtr< T >::data(), and KisLayer::fillMergedLayerTemplate().

◆ forceUpdateHiddenAreaOnOriginal()

void KisShapeLayer::forceUpdateHiddenAreaOnOriginal ( )
overridevirtual

Force regeneration of the hidden part of original() device (the one outside image bounds). After regeneration is completed, the layer will Q_EMIT dirty signals itself, so no manual forced update is needed.

Implements KisCroppedOriginalLayerInterface.

Definition at line 567 of file kis_shape_layer.cc.

568{
570}
virtual void forceRepaintWithHiddenAreas()

References KisShapeLayer::Private::canvas, KisShapeLayerCanvasBase::forceRepaintWithHiddenAreas(), and m_d.

◆ forceUpdateTimedNode()

void KisShapeLayer::forceUpdateTimedNode ( )
overridevirtual

Forces a repaint of a shape layer without waiting for an event loop calling a delayed timer update. If you want to see the result of the shape layer right here and right now, you should do:

shapeLayer->setDirty(); shapeLayer->image()->waitForDone(); shapeLayer->forceUpdateTimedNode(); shapeLayer->image()->waitForDone();

Implements KisDelayedUpdateNodeInterface.

Definition at line 557 of file kis_shape_layer.cc.

558{
560}
virtual void forceRepaint()=0

References KisShapeLayer::Private::canvas, KisShapeLayerCanvasBase::forceRepaint(), and m_d.

◆ hasPendingTimedUpdates()

bool KisShapeLayer::hasPendingTimedUpdates ( ) const
overridevirtual
Returns
true if there are any pending updates in the delayed queue

Implements KisDelayedUpdateNodeInterface.

Definition at line 562 of file kis_shape_layer.cc.

563{
564 return m_d->canvas->hasPendingUpdates();
565}
virtual bool hasPendingUpdates() const =0

References KisShapeLayer::Private::canvas, KisShapeLayerCanvasBase::hasPendingUpdates(), and m_d.

◆ icon()

QIcon KisShapeLayer::icon ( ) const
overridevirtual
Returns
the icon used to represent the node type, for instance in the layerbox and in the menu.

Reimplemented from KisExternalLayer.

Definition at line 403 of file kis_shape_layer.cc.

404{
405 return KisIconUtils::loadIcon("vectorLayer");
406}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ initShapeLayerImpl()

void KisShapeLayer::initShapeLayerImpl ( KoShapeControllerBase * controller,
KisShapeLayerCanvasBase * overrideCanvas )
private

Definition at line 262 of file kis_shape_layer.cc.

264{
265 setSupportsLodMoves(false);
267
269
271
272 m_d->canvas = canvas;
273 m_d->canvas->moveToThread(this->thread());
274 m_d->controller = controller;
275
276 m_d->canvas->shapeManager()->selection()->disconnect(this);
277
278 connect(m_d->canvas->selectedShapesProxy(), SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
280 this, SIGNAL(currentLayerChanged(const KoShapeLayer*)));
281
282 connect(this, SIGNAL(sigMoveShapes(QPointF)), SLOT(slotMoveShapes(QPointF)));
283
286 model->setAssociatedRootShapeManager(m_d->canvas->shapeManager());
287
288 if (this->image()) {
289 m_d->imageConnections.addUniqueConnection(this->image(), SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotImageResolutionChanged()));
291 }
292}
virtual KisPaintDeviceSP projection() const =0
KoSelectedShapesProxy * selectedShapesProxy() const override
selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged...
void slotMoveShapes(const QPointF &diff)
void selectionChanged()
void currentLayerChanged(const KoShapeLayer *layer)
void slotImageResolutionChanged()
void sigMoveShapes(const QPointF &diff)
void addUniqueConnection(Sender sender, Signal signal, Receiver receiver, Method method)
KoShapeContainerModel * model
KoSelection * selection
void setShapeId(const QString &id)
Definition KoShape.cpp:883
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
const QString KIS_SHAPE_LAYER_ID
void setSupportsLodMoves(bool value)
KisSignalAutoConnectionsStore imageConnections

References KisSignalAutoConnectionsStore::addUniqueConnection(), KisShapeLayer::Private::canvas, canvas(), KisShapeLayer::Private::controller, currentLayerChanged(), KisBaseNode::image, KisShapeLayer::Private::imageConnections, KIS_SAFE_ASSERT_RECOVER_RETURN, KIS_SHAPE_LAYER_ID, m_d, KoShapeContainer::model, KisShapeLayer::Private::paintDevice, KisShapeLayerCanvasBase::projection(), KisShapeLayerCanvasBase::selectedShapesProxy(), KoShapeManager::selection, selectionChanged(), KoShape::setShapeId(), KisBaseNode::setSupportsLodMoves(), KisShapeLayerCanvasBase::shapeManager(), sigMoveShapes(), slotImageResolutionChanged(), and slotMoveShapes().

◆ isSelectable()

bool KisShapeLayer::isSelectable ( ) const
inline

Definition at line 94 of file kis_shape_layer.h.

94 {
95 return false;
96 }

◆ isShapeEditable()

bool KisShapeLayer::isShapeEditable ( bool recursive) const
overridevirtual

checks recursively if the shape or one of its parents is not visible or locked

Reimplemented from KoShape.

Definition at line 549 of file kis_shape_layer.cc.

550{
551 return KoShapeLayer::isShapeEditable(recursive) && isEditable(true);
552}
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
Definition KoShape.cpp:968
bool isEditable(bool checkVisibility=true) const

References KisBaseNode::isEditable(), and KoShape::isShapeEditable().

◆ isVisible()

bool KoShape::isVisible ( bool recursive = true) const
protected

Returns current visibility state of this shape. Being visible means being painted, as well as being used for things like guidelines or searches.

Parameters
recursivewhen true, checks visibility recursively
Returns
current visibility state of this shape.
See also
isGeometryProtected(), isContentProtected(), isSelectable()

Definition at line 407 of file KoShape.cpp.

798{
799 if (!recursive)
800 return s->visible;
801
802 if (!s->visible)
803 return false;
804
805 KoShapeContainer * parentShape = parent();
806
807 if (parentShape) {
808 return parentShape->isVisible(true);
809 }
810
811 return true;
812}
KoShapeContainer * parent
Definition KoShape_p.h:95
QSharedDataPointer< SharedData > s
Definition KoShape.h:978
bool isVisible(bool recursive=true) const
Definition KoShape.cpp:797

◆ loadLayer()

bool KisShapeLayer::loadLayer ( KoStore * store,
QStringList * warnings = 0 )

Definition at line 678 of file kis_shape_layer.cc.

679{
680 if (!store) {
681 warnKrita << "No store backend";
682 return false;
683 }
684
685 if (store->open("content.svg")) {
686 KoStoreDevice storeDev(store);
687 storeDev.open(QIODevice::ReadOnly);
688
689 loadSvg(&storeDev, "", warnings);
690
691 store->close();
692
693 return true;
694 }
695
696 return false;
697
698}
bool loadSvg(QIODevice *device, const QString &baseXmlDir, QStringList *warnings=0)
bool close()
Definition KoStore.cpp:156
bool open(const QString &name)
Definition KoStore.cpp:109
#define warnKrita
Definition kis_debug.h:94

References KoStore::close(), loadSvg(), KoStore::open(), KoStoreDevice::open(), and warnKrita.

◆ loadSvg()

bool KisShapeLayer::loadSvg ( QIODevice * device,
const QString & baseXmlDir,
QStringList * warnings = 0 )
protected

Definition at line 654 of file kis_shape_layer.cc.

655{
656 QSizeF fragmentSize; // unused!
657 KisImageSP image = this->image();
658
659 // FIXME: we handle xRes() only!
661 const qreal resolutionPPI = 72.0 * image->xRes();
662
664 createShapesFromSvg(device, baseXmlDir,
665 image->bounds(), resolutionPPI,
667 true,
668 &fragmentSize,
669 warnings);
670
671 Q_FOREACH (KoShape *shape, shapes) {
672 addShape(shape);
673 }
674
675 return true;
676}
double xRes() const
double yRes() const
QRect bounds() const override
static QList< KoShape * > createShapesFromSvg(QIODevice *device, const QString &baseXmlDir, const QRectF &rectInPixels, qreal resolutionPPI, KoDocumentResourceManager *resourceManager, bool loadingFromKra, QSizeF *fragmentSize, QStringList *warnings=0, QStringList *errors=0)
virtual KoDocumentResourceManager * resourceManager() const
static bool qFuzzyCompare(half p1, half p2)

References KoShapeContainer::addShape(), KisImage::bounds(), KisShapeLayer::Private::controller, createShapesFromSvg(), KisBaseNode::image, KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, qFuzzyCompare(), KoShapeControllerBase::resourceManager(), KoShapeContainer::shapes(), KisImage::xRes(), and KisImage::yRes().

◆ original()

KisPaintDeviceSP KisShapeLayer::original ( ) const
overridevirtual

Return the layer data before the effect masks have had their go at it.

Implements KisLayer.

Definition at line 408 of file kis_shape_layer.cc.

409{
410 return m_d->paintDevice;
411}

References m_d, and KisShapeLayer::Private::paintDevice.

◆ paintDevice()

KisPaintDeviceSP KisShapeLayer::paintDevice ( ) const
overridevirtual

Return the paintdevice you can use to change pixels on. For a paint layer these will be paint pixels, for an adjustment layer or a mask the selection paint device.

Returns
the paint device to paint on. Can be 0 if the actual node type does not support painting.

Implements KisBaseNode.

Definition at line 413 of file kis_shape_layer.cc.

414{
415 return 0;
416}

◆ resetCache()

void KisShapeLayer::resetCache ( const KoColorSpace * colorSpace)
overridevirtual

Reimplemented from KisExternalLayer.

Definition at line 700 of file kis_shape_layer.cc.

701{
703}
virtual void resetCache(const KoColorSpace *colorSpace)=0
const KoColorSpace * colorSpace() const override
returns the image's colorSpace or null, if there is no image
Definition kis_layer.cc:225

References KisShapeLayer::Private::canvas, KisLayer::colorSpace(), m_d, and KisShapeLayerCanvasBase::resetCache().

◆ saveLayer()

bool KisShapeLayer::saveLayer ( KoStore * store) const

Definition at line 644 of file kis_shape_layer.cc.

645{
646 // FIXME: we handle xRes() only!
647
648 const QSizeF sizeInPx = image()->bounds().size();
649 const QSizeF sizeInPt(sizeInPx.width() / image()->xRes(), sizeInPx.height() / image()->yRes());
650
651 return saveShapesToStore(store, this->shapes(), sizeInPt);
652}
static bool saveShapesToStore(KoStore *store, QList< KoShape * > shapes, const QSizeF &sizeInPt)

References KisImage::bounds(), KisBaseNode::image, saveShapesToStore(), and KoShapeContainer::shapes().

◆ saveShapesToStore()

bool KisShapeLayer::saveShapesToStore ( KoStore * store,
QList< KoShape * > shapes,
const QSizeF & sizeInPt )
static

Definition at line 577 of file kis_shape_layer.cc.

578{
579 if (!store->open("content.svg")) {
580 return false;
581 }
582
583 KoStoreDevice storeDev(store);
584 storeDev.open(QIODevice::WriteOnly);
585
586 std::sort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
587
588 SvgWriter writer(shapes);
589 writer.save(storeDev, sizeInPt);
590
591 if (!store->close()) {
592 return false;
593 }
594
595 return true;
596}
Implements exporting shapes to SVG.
Definition SvgWriter.h:33

References KoStore::close(), KoShape::compareShapeZIndex(), KoStore::open(), KoStoreDevice::open(), SvgWriter::save(), and KoShapeContainer::shapes().

◆ sectionModelProperties()

KisBaseNode::PropertyList KisShapeLayer::sectionModelProperties ( ) const
overridevirtual

Return a the properties of this base node (locked, visible etc, with the right icons for their representation and their state.

Subclasses can extend this list with new properties, like opacity for layers or visualized for masks.

The order of properties is, unfortunately, for now, important, so take care which properties superclasses of your class define.

KisBaseNode defines visible = 0, locked = 1 KisLayer defines opacity = 2, compositeOp = 3 KisMask defines active = 2 (KisMask does not inherit kislayer)

Reimplemented from KisLayer.

Definition at line 314 of file kis_shape_layer.cc.

315{
317
319
320 return l;
321}
static KisBaseNode::Property getProperty(const KoID &id, bool state)
bool antialiased() const
KisBaseNode::PropertyList sectionModelProperties() const override
Definition kis_layer.cc:272

References KisLayerPropertiesIcons::antialiased, antialiased(), KisLayerPropertiesIcons::getProperty(), and KisLayer::sectionModelProperties().

◆ selectedShapesProxy()

KoSelectedShapesProxy * KisShapeLayer::selectedShapesProxy ( )

selectedShapesProxy

Returns
returns the selectedShapesProxy of the KoCanvasBase of this layer, used for certain undo commands.

Definition at line 572 of file kis_shape_layer.cc.

573{
574 return m_d->canvas->selectedShapesProxy();
575}

References KisShapeLayer::Private::canvas, m_d, and KisShapeLayerCanvasBase::selectedShapesProxy().

◆ selectionChanged

void KisShapeLayer::selectionChanged ( )
signal

These signals are forwarded from the local shape manager This is done because we switch KoShapeManager and therefore KoSelection in KisCanvas2, so we need to connect local managers to the UI as well.

See also
comment in the constructor of KisCanvas2

◆ setAntialiased()

void KisShapeLayer::setAntialiased ( const bool antialiased)

Definition at line 816 of file kis_shape_layer.cc.

817{
818 const bool oldAntialiased = m_d->isAntialiased;
819
820 if (antialiased != oldAntialiased) {
822 // is it the best way to rerender the vector layer?
824 }
825}

References antialiased(), KisShapeLayer::Private::canvas, KisLayer::colorSpace(), KisShapeLayer::Private::isAntialiased, m_d, and KisShapeLayerCanvasBase::resetCache().

◆ setImage()

void KisShapeLayer::setImage ( KisImageWSP image)
overridevirtual

Set the image this layer belongs to.

Reimplemented from KisLayer.

Definition at line 299 of file kis_shape_layer.cc.

300{
302 KisLayer::setImage(_image);
303 m_d->canvas->setImage(_image);
304 if (m_d->paintDevice) {
306 }
307 if (_image) {
308 m_d->imageConnections.addUniqueConnection(_image, SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotImageResolutionChanged()));
310 }
311}
void setDefaultBounds(KisDefaultBoundsBaseSP bounds)
virtual void setImage(KisImageWSP image)
void setImage(KisImageWSP image) override
Definition kis_layer.cc:378

References KisSignalAutoConnectionsStore::addUniqueConnection(), KisShapeLayer::Private::canvas, KisSignalAutoConnectionsStore::clear(), KisShapeLayer::Private::imageConnections, m_d, KisShapeLayer::Private::paintDevice, KisPaintDevice::setDefaultBounds(), KisShapeLayerCanvasBase::setImage(), KisLayer::setImage(), and slotImageResolutionChanged().

◆ setParent()

void KisShapeLayer::setParent ( KoShapeContainer * parent)

Definition at line 397 of file kis_shape_layer.cc.

398{
399 Q_UNUSED(parent);
401}
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:75

References KIS_ASSERT_RECOVER_RETURN, and KoShape::Private::parent.

◆ setProfile()

KUndo2Command * KisShapeLayer::setProfile ( const KoColorProfile * profile)
overridevirtual

Reimplemented from KisExternalLayer.

Definition at line 766 of file kis_shape_layer.cc.

767{
768 using namespace KisDoSomethingCommandOps;
769
770 KUndo2Command *cmd = new KUndo2Command();
772 m_d->paintDevice->setProfile(profile, cmd);
774
775 return cmd;
776}
bool setProfile(const KoColorProfile *profile, KUndo2Command *parentCommand)

References m_d, KisShapeLayer::Private::paintDevice, and KisPaintDevice::setProfile().

◆ setSectionModelProperties()

void KisShapeLayer::setSectionModelProperties ( const KisBaseNode::PropertyList & properties)
overridevirtual

Change the section model properties.

Reimplemented from KisLayer.

Definition at line 323 of file kis_shape_layer.cc.

324{
325 Q_FOREACH (const KisBaseNode::Property &property, properties) {
326 if (property.name == i18n("Anti-aliasing")) {
327 setAntialiased(property.state.toBool());
328 }
329 }
330
332}
void setAntialiased(const bool antialiased)
KoProperties properties
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override
Definition kis_layer.cc:297

References KisBaseNode::Property::name, KisBaseNode::properties, setAntialiased(), KisLayer::setSectionModelProperties(), and KisBaseNode::Property::state.

◆ setUserLocked()

void KisShapeLayer::setUserLocked ( bool l)
overridevirtual

Set the locked status of this node. Locked nodes cannot be edited.

Reimplemented from KisBaseNode.

Definition at line 543 of file kis_shape_layer.cc.

544{
547}
float value(const T *src, size_t ch)
void setGeometryProtected(bool on)
Definition KoShape.cpp:837
virtual void setUserLocked(bool l)

References KoShape::setGeometryProtected(), KisBaseNode::setUserLocked(), and value().

◆ setVisible()

void KisShapeLayer::setVisible ( bool visible,
bool loading = false )
overridevirtual

Set the visible status of this node. Visible nodes are active in the graph (except for selections masks which can be active while hidden), that is to say, they are taken into account when merging. Invisible nodes play no role in the final image , but will be modified when modifying all layers, for instance when cropping.

Toggling the visibility of a node will not automatically lead to recomposition.

Parameters
visiblethe new visibility state
isLoadingif true, the property is set during loading.

Reimplemented from KisBaseNode.

Definition at line 529 of file kis_shape_layer.cc.

530{
531 const bool oldVisible = this->visible(false);
532
535
536 if (visible && !oldVisible &&
538
540 }
541}
virtual void rerenderAfterBeingInvisible()=0
bool visible(bool recursive=false) const override
void setVisible(bool on)
Definition KoShape.cpp:790
virtual void setVisible(bool visible, bool loading=false)

References KisShapeLayer::Private::canvas, KisShapeLayerCanvasBase::hasChangedWhileBeingInvisible(), m_d, KisShapeLayerCanvasBase::rerenderAfterBeingInvisible(), KoShape::setVisible(), KisBaseNode::setVisible(), and visible().

◆ setX()

void KisShapeLayer::setX ( qint32 )
overridevirtual

Set the x offset of this layer in the image place. Re-implement this where it makes sense, by default it does nothing. It should not move child nodes.

Reimplemented from KisLayer.

Definition at line 433 of file kis_shape_layer.cc.

434{
435 qint32 delta = x - this->x();
436 QPointF diff = QPointF(m_d->canvas->viewConverter()->viewToDocumentX(delta), 0);
437 Q_EMIT sigMoveShapes(diff);
438
439 // Save new value to satisfy LSP
440 m_d->x = x;
441}
virtual qreal viewToDocumentX(qreal viewX) const

References KisShapeLayer::Private::canvas, m_d, sigMoveShapes(), KisShapeLayerCanvasBase::viewConverter(), KoViewConverter::viewToDocumentX(), KisShapeLayer::Private::x, and x().

◆ setY()

void KisShapeLayer::setY ( qint32 )
overridevirtual

Set the y offset of this layer in the image place. Re-implement this where it makes sense, by default it does nothing. It should not move child nodes.

Reimplemented from KisLayer.

Definition at line 443 of file kis_shape_layer.cc.

444{
445 qint32 delta = y - this->y();
446 QPointF diff = QPointF(0, m_d->canvas->viewConverter()->viewToDocumentY(delta));
447 Q_EMIT sigMoveShapes(diff);
448
449 // Save new value to satisfy LSP
450 m_d->y = y;
451}
virtual qreal viewToDocumentY(qreal viewY) const

References KisShapeLayer::Private::canvas, m_d, sigMoveShapes(), KisShapeLayerCanvasBase::viewConverter(), KoViewConverter::viewToDocumentY(), KisShapeLayer::Private::y, and y().

◆ shapeController()

KoShapeControllerBase * KisShapeLayer::shapeController ( ) const
protected

Definition at line 789 of file kis_shape_layer.cc.

790{
791 return m_d->controller;
792}

References KisShapeLayer::Private::controller, and m_d.

◆ shapeManager()

KoShapeManager * KisShapeLayer::shapeManager ( ) const

Definition at line 514 of file kis_shape_layer.cc.

515{
516 return m_d->canvas->shapeManager();
517}

References KisShapeLayer::Private::canvas, m_d, and KisShapeLayerCanvasBase::shapeManager().

◆ shapesToBeTransformed()

QList< KoShape * > KisShapeLayer::shapesToBeTransformed ( )
private

Definition at line 468 of file kis_shape_layer.cc.

469{
471
472 // We expect that **all** the shapes inherit the transform from its parent
473
474 // SANITY_CHECK: we expect all the shapes inside the
475 // shape layer to inherit transform!
476 Q_FOREACH (KoShape *shape, shapes) {
477 if (shape->parent()) {
479 break;
480 }
481 }
482 }
483
484 shapes << this;
485 filterTransformableShapes(shapes);
486 return shapes;
487}
KoShapeManager * shapeManager() const
bool inheritsTransform(const KoShape *shape) const
QList< KoShape * > shapes
KoShapeContainer * parent() const
Definition KoShape.cpp:860

References KoShapeContainer::inheritsTransform(), KIS_SAFE_ASSERT_RECOVER, KoShape::parent(), shapeManager(), KoShapeContainer::shapes(), and KoShapeManager::shapes.

◆ sigMoveShapes

void KisShapeLayer::sigMoveShapes ( const QPointF & diff)
signal

A signal + slot to synchronize UI and image threads. Image thread emits the signal, UI thread performs the action

◆ slotImageResolutionChanged

void KisShapeLayer::slotImageResolutionChanged ( )
privateslot

Definition at line 799 of file kis_shape_layer.cc.

800{
803 if (this->image()) {
804 if (model->setResolution(image()->xRes() * 72.0, image()->yRes() * 72.0)) {
805 resetCache(nullptr);
806 }
807 }
808}
void resetCache(const KoColorSpace *colorSpace) override
bool setResolution(qreal xRes, qreal yRes)

References KisBaseNode::image, KIS_SAFE_ASSERT_RECOVER_RETURN, KoShapeContainer::model, resetCache(), and ShapeLayerContainerModel::setResolution().

◆ slotMoveShapes

void KisShapeLayer::slotMoveShapes ( const QPointF & diff)
privateslot

Definition at line 489 of file kis_shape_layer.cc.

490{
492 if (shapes.isEmpty()) return;
493
494 KoShapeMoveCommand cmd(shapes, diff);
495 cmd.redo();
496}
QList< KoShape * > shapesToBeTransformed()
The undo / redo command for shape moving.

References KoShapeMoveCommand::redo(), KoShapeContainer::shapes(), and shapesToBeTransformed().

◆ slotTransformShapes

void KisShapeLayer::slotTransformShapes ( const QTransform & transform)
privateslot

Definition at line 498 of file kis_shape_layer.cc.

499{
500 KoShapeTransformCommand cmd({this}, {transformation()}, {newTransform});
501 cmd.redo();
502}
void redo() override
redo the command
QTransform transformation() const
Returns the shapes local transformation matrix.
Definition KoShape.cpp:378

References KoShapeTransformCommand::redo(), and KoShape::transformation().

◆ theoreticalBoundingRect()

QRect KisShapeLayer::theoreticalBoundingRect ( ) const
overridevirtual

Some external layers use original() only as a projection and render some internal state into it, e.g. using KisSpontaneousProjection asynchronously. theoreticalBoundingRect() is used to get real bounding rect of a layer without relying on original().

Reimplemented from KisExternalLayer.

Definition at line 418 of file kis_shape_layer.cc.

419{
420 return kisGrowRect(m_d->canvas->viewConverter()->documentToView(this->boundingRect()).toAlignedRect(), 1);
421}
virtual QPointF documentToView(const QPointF &documentPoint) const
T kisGrowRect(const T &rect, U offset)
Definition kis_global.h:186

References KisShapeLayer::Private::canvas, KoViewConverter::documentToView(), kisGrowRect(), m_d, and KisShapeLayerCanvasBase::viewConverter().

◆ transform()

KUndo2Command * KisShapeLayer::transform ( const QTransform & transform)
overridevirtual

We cannot transform shapes in the worker thread. Therefor we Q_EMIT blocking-queued signal to transform them in the GUI thread and then return.

Reimplemented from KisExternalLayer.

Definition at line 748 of file kis_shape_layer.cc.

749{
751 if (shapes.isEmpty()) return 0;
752 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(shapes.size() == 1 && shapes.first() == this, 0);
753
758 const KisImageViewConverter *converter = dynamic_cast<const KisImageViewConverter*>(this->converter());
759 KIS_ASSERT(converter);
760 QTransform docSpaceTransform = converter->documentToView() *
762
763 return new TransformShapeLayerDeferred(this, docSpaceTransform);
764}
friend class TransformShapeLayerDeferred
const KoViewConverter * converter() const
QTransform transform() const
return the current matrix that contains the rotation/scale/position of this shape
Definition KoShape.cpp:948
virtual QPointF viewToDocument(const QPointF &viewPoint) const
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129

References converter(), KoViewConverter::documentToView(), KIS_ASSERT, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KoShapeContainer::shapes(), shapesToBeTransformed(), KoShape::transform(), TransformShapeLayerDeferred, and KoViewConverter::viewToDocument().

◆ tryCreateInternallyMergedLayerFromMutipleLayers()

KisLayerSP KisShapeLayer::tryCreateInternallyMergedLayerFromMutipleLayers ( QList< KisLayerSP > layers)
overridevirtual

Try create a layer of this type from multiple layers (of the same type).

The implementation will check if all the layers passed as layer have the same type, verify if they could be merged in a non-rasterizing fashion, merge them and return the layer of the proper type.

Currently only used for merging a set of shape layers into a single shape layer.

Reimplemented from KisLayer.

Definition at line 334 of file kis_shape_layer.cc.

335{
336 // NOTE: layers.first() may possibly point to `this`!
337
338 QList<KisShapeLayer*> shapeLayers;
339 Q_FOREACH(KisLayerSP layer, layers) {
340 KisShapeLayer *shapeLayer = dynamic_cast<KisShapeLayer*>(layer.data());
341 if (!shapeLayer) return nullptr;
342
343 shapeLayers << shapeLayer;
344 }
345
346 QList<KoShape*> allShapes;
348 Q_FOREACH(KisShapeLayer *layer, shapeLayers) {
349 QList<KoShape*> shapes = layer->shapes();
350 std::sort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
351
352 Q_FOREACH(KoShape *shape, shapes) {
353 allShapes << shape;
354 allIndexedShapes << shape;
355 }
356 }
357
358 allIndexedShapes = KoShapeReorderCommand::homogenizeZIndexesLazy(allIndexedShapes);
359
360 KoShapeReorderCommand cmd(allIndexedShapes);
361 cmd.redo();
362
363 KisLayerSP newLayer = new KisShapeLayer(*this, allShapes);
364
365 newLayer->setCompositeOpId(this->compositeOpId());
366 if (!this->channelFlags().isEmpty()) {
367 newLayer->setChannelFlags(this->channelFlags());
368 }
369
370 newLayer->setCompositeOpId(this->compositeOpId());
371 newLayer->setPinnedToTimeline(this->isPinnedToTimeline());
372 newLayer->setColorLabelIndex(this->colorLabelIndex());
373
374 return newLayer;
375}
This command allows you to change the zIndex of a number of shapes.
static QList< KoShapeReorderCommand::IndexedShape > homogenizeZIndexesLazy(QList< IndexedShape > shapes)
void setPinnedToTimeline(bool pinned)
const QString & compositeOpId() const
bool isPinnedToTimeline() const
void setColorLabelIndex(int index)
int colorLabelIndex() const
void setCompositeOpId(const QString &compositeOpId)
QBitArray channelFlags
Definition kis_layer.cc:167
virtual void setChannelFlags(const QBitArray &channelFlags)
Definition kis_layer.cc:342

References KisLayer::channelFlags, KisBaseNode::colorLabelIndex(), KoShape::compareShapeZIndex(), KisBaseNode::compositeOpId(), KisSharedPtr< T >::data(), KoShapeReorderCommand::homogenizeZIndexesLazy(), KisBaseNode::isPinnedToTimeline(), KisShapeLayer(), KoShapeReorderCommand::redo(), KisLayer::setChannelFlags(), KisBaseNode::setColorLabelIndex(), KisBaseNode::setCompositeOpId(), KisBaseNode::setPinnedToTimeline(), and KoShapeContainer::shapes().

◆ visible()

bool KisShapeLayer::visible ( bool recursive = false) const
overridevirtual
Returns
true if this node is visible (i.e, active (except for selection masks where visible and active properties are different)) in the graph
Parameters
boolrecursive if true, check whether all parents of this node are visible as well.

Reimplemented from KisBaseNode.

Definition at line 524 of file kis_shape_layer.cc.

525{
526 return KisExternalLayer::visible(recursive);
527}
virtual bool visible(bool recursive=false) const

References KisBaseNode::visible().

◆ x()

qint32 KisShapeLayer::x ( ) const
overridevirtual
Returns
the x-offset of this layer in the image plane.

Reimplemented from KisLayer.

Definition at line 423 of file kis_shape_layer.cc.

424{
425 return m_d->x;
426}

References m_d, and KisShapeLayer::Private::x.

◆ y()

qint32 KisShapeLayer::y ( ) const
overridevirtual
Returns
the y-offset of this layer in the image plane.

Reimplemented from KisLayer.

Definition at line 428 of file kis_shape_layer.cc.

429{
430 return m_d->y;
431}

References m_d, and KisShapeLayer::Private::y.

Friends And Related Symbol Documentation

◆ ShapeLayerContainerModel

friend class ShapeLayerContainerModel
friend

Definition at line 185 of file kis_shape_layer.h.

◆ TransformShapeLayerDeferred

friend class TransformShapeLayerDeferred
friend

Definition at line 191 of file kis_shape_layer.h.

Member Data Documentation

◆ m_d

Private* const KisShapeLayer::m_d
private

Definition at line 223 of file kis_shape_layer.h.


The documentation for this class was generated from the following files: