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

#include <kis_clone_layer.h>

+ Inheritance diagram for KisCloneLayer:

Public Member Functions

bool accept (KisNodeVisitor &) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
bool allowAsChild (KisNodeSP) const override
 
KisNodeSP clone () const override
 
const KoColorSpacecolorSpace () const override
 
KisLayerSP copyFrom () const
 
KisNodeUuidInfo copyFromInfo () const
 
CopyLayerType copyType () const
 
QRect exactBounds () const override
 Returns the exact bounds of where the actual data resides in this layer.
 
QRect extent () const override
 Returns an approximation of where the bounds on actual data are in this layer.
 
QIcon icon () const override
 
 KisCloneLayer (const KisCloneLayer &rhs)
 
 KisCloneLayer (KisLayerSP from, KisImageWSP image, const QString &name, quint8 opacity)
 
bool needProjection () const override
 
QRect needRectOnSourceForMasks (const QRect &rc) const
 
KisPaintDeviceSP original () const override
 
KisPaintDeviceSP paintDevice () const override
 
 Private (KisDefaultBoundsBaseSP defaultBounds)
 
KisLayerSP reincarnateAsPaintLayer () const
 
KisBaseNode::PropertyList sectionModelProperties () const override
 
void setCopyFrom (KisLayerSP layer)
 
void setCopyFromInfo (KisNodeUuidInfo info)
 
void setCopyType (CopyLayerType type)
 
void setDirtyOriginal (const QRect &rect, bool dontInvalidateFrames)
 
void setImage (KisImageWSP image) override
 
void setX (qint32) override
 
void setY (qint32) override
 
void syncLodCache () override
 
qint32 x () const override
 
qint32 y () const override
 
 ~KisCloneLayer () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- 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 KoColorSpacecolorSpace () const override
 returns the image's colorSpace or null, if there is no image
 
const KoCompositeOpcompositeOp () const override
 returns the layer's composite op for the colorspace of the layer's parent.
 
virtual KisLayerSP createMergedLayerTemplate (KisLayerSP prevLayer)
 
QImage createThumbnail (qint32 w, qint32 h, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio) override
 
QImage createThumbnailForFrame (qint32 w, qint32 h, int time, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio) override
 
void disableAlphaChannel (bool disable)
 
QList< KisEffectMaskSPeffectMasks () const
 
QList< KisEffectMaskSPeffectMasks (KisNodeSP lastNode) const
 
QRect exactBounds () const override
 
QRect extent () const override
 
virtual void fillMergedLayerTemplate (KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer=false)
 
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::StoremetaData ()
 
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< KisCloneLayerWSPregisteredClones () const
 
KisBaseNode::PropertyList sectionModelProperties () const override
 
virtual KisSelectionSP selection () const
 
virtual KisSelectionMaskSP selectionMask () const
 
virtual void setChannelFlags (const QBitArray &channelFlags)
 
void setImage (KisImageWSP image) override
 
void setLayerStyle (KisPSDLayerStyleSP layerStyle)
 
void setSectionModelProperties (const KisBaseNode::PropertyList &properties) override
 
void setTemporary (bool t)
 
void setX (qint32 x) override
 
void setY (qint32 y) override
 
bool temporary () const
 
int thumbnailSeqNo () const override
 
QRect tightUserVisibleBounds () const
 
void unregisterClone (KisCloneLayerWSP clone)
 
void updateClones (const QRect &rect, bool dontInvalidateFrames)
 
qint32 x () const override
 
qint32 y () const override
 
 ~KisLayer () override
 
- Public Member Functions inherited from KisNode
bool accept (KisNodeVisitor &v) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
KisNodeSP at (quint32 index) const
 
KisBusyProgressIndicatorbusyProgressIndicator () const
 
quint32 childCount () const
 
QList< KisNodeSPchildNodes (const QStringList &nodeTypes, const KoProperties &properties) const
 
const KisNodefindSymmetricClone (const KisNode *srcRoot, const KisNode *dstRoot, const KisNode *srcTarget)
 
KisNodeSP firstChild () const
 
virtual KisPaintDeviceList getLodCapableDevices () const
 
KisNodeGraphListenergraphListener () 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
 
KisNodeProgressProxynodeProgressProxy () 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)
 
void setImage (KisImageWSP newImage) override
 
 ~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
 
void enableAnimation ()
 
KisKeyframeChannelgetKeyframeChannel (const QString &id) const
 
KisKeyframeChannelgetKeyframeChannel (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 KoPropertiesnodeProperties () const
 
quint8 opacity () const
 
quint8 percentOpacity () 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)
 
virtual void setUserLocked (bool l)
 
void setUuid (const QUuid &id)
 
virtual void setVisible (bool visible, bool loading=false)
 
virtual bool supportsKeyframeChannel (const QString &id)
 
bool supportsLodMoves () const
 
virtual bool supportsLodPainting () const
 
virtual void updateSettings ()
 
bool userLocked () const
 
QUuid uuid () const
 
virtual bool visible (bool recursive=false) const
 
 ~KisBaseNode () override
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Public Attributes

KisLayerSP copyFrom
 
KisNodeUuidInfo copyFromInfo
 
KisPaintDeviceSP fallback
 
KisLodCapableLayerOffset offset
 
CopyLayerType type {COPY_PROJECTION}
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- Public Attributes inherited from KisLayer
QBitArray channelFlags
 
KisCloneLayersList clonesList
 
KisPSDLayerStyleSP layerStyle
 
KisLayerStyleProjectionPlaneSP layerStyleProjectionPlane
 
KisLayerMasksCache masksCache
 
KisMetaData::StoremetaDataStore {nullptr}
 
KisLayerProjectionPlaneSP projectionPlane
 
KisSafeNodeProjectionStoreSP safeProjection
 
- Public Attributes inherited from KisNode
KisBusyProgressIndicatorbusyProgressIndicator
 
std::optional< KisFrameChangeUpdateRecipeframeRemovalUpdateRecipe
 
KisNodeGraphListenergraphListener
 
KisNodeProgressProxynodeProgressProxy
 
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}
 

Protected Member Functions

QRect accessRect (const QRect &rect, PositionToFilthy pos) const override
 
void copyOriginalToProjection (const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect &rect) const override
 
void notifyParentVisibilityChanged (bool value) override
 
QRect outgoingChangeRect (const QRect &rect) const override
 
- 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 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
 
QList< KisEffectMaskSPsearchEffectMasks (KisNodeSP lastNode) const
 
QRect updateProjection (const QRect &rect, KisNodeSP filthyNode, KisRenderPassFlags flags)
 
- Protected Member Functions inherited from KisNode
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 KisKeyframeChannelrequestKeyframeChannel (const QString &id)
 
void setSupportsLodMoves (bool value)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Private Attributes

Private *const m_d {nullptr}
 

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< PropertyPropertyList
 
- Signals inherited from KisNode
void sigNodeChangedInternal ()
 
- Signals inherited from KisBaseNode
void keyframeChannelAdded (KisKeyframeChannel *channel)
 
void opacityChanged (quint8 value)
 

Detailed Description

A copy layer adds the contents of another layer in another place in the layer stack. It is possible to add more effect masks to the copy. You can either copy the original data or the projection data produced by the original layer + original effect masks. There is no physical copy of the data; if the original changes, the copy changes too. The copy layer can be positioned differently from the original layer.

Definition at line 31 of file kis_clone_layer.cpp.

Constructor & Destructor Documentation

◆ KisCloneLayer() [1/2]

KisCloneLayer::KisCloneLayer ( KisLayerSP from,
KisImageWSP image,
const QString & name,
quint8 opacity )

Definition at line 46 of file kis_clone_layer.cpp.

49{
50 KisImageSP imageSP = image.toStrongRef();
51 if (!imageSP) {
52 return;
53 }
54 m_d->fallback = new KisPaintDevice(this,
55 imageSP->colorSpace(),
56 new KisDefaultBounds(imageSP));
57 m_d->copyFrom = from;
58 m_d->type = COPY_PROJECTION;
59
60 // When loading the layer we copy from might not exist yet
61 if (m_d->copyFrom) {
62 m_d->copyFrom->registerClone(this);
63 }
64}
const KoColorSpace * colorSpace() const
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
@ COPY_PROJECTION
KisImageWSP image
QString name() const
quint8 opacity() const
Private *const m_d
friend class KisLayer
Definition kis_node.h:383

References KisImage::colorSpace(), COPY_PROJECTION, KisBaseNode::image, m_d, and KisWeakSharedPtr< T >::toStrongRef().

◆ KisCloneLayer() [2/2]

KisCloneLayer::KisCloneLayer ( const KisCloneLayer & rhs)

Definition at line 66 of file kis_clone_layer.cpp.

67 : KisLayer(rhs)
68 , m_d(new Private(new KisDefaultBounds(rhs.image())))
69{
70 m_d->fallback = new KisPaintDevice(this,
71 rhs.m_d->fallback->colorSpace(),
72 new KisDefaultBounds(rhs.image()));
73 m_d->copyFrom = rhs.copyFrom();
74 m_d->type = rhs.copyType();
75 m_d->offset = rhs.m_d->offset;
76
77 if (m_d->copyFrom) {
78 m_d->copyFrom->registerClone(this);
79 }
80}
KisLayerSP copyFrom
CopyLayerType copyType() const

References copyFrom, copyType(), KisBaseNode::image, and m_d.

◆ ~KisCloneLayer()

KisCloneLayer::~KisCloneLayer ( )
override

Definition at line 82 of file kis_clone_layer.cpp.

83{
84 if (m_d->copyFrom) {
85 m_d->copyFrom->unregisterClone(this);
86 }
87 delete m_d;
88}

References m_d.

Member Function Documentation

◆ accept() [1/2]

bool KisCloneLayer::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 KisBaseNode.

Definition at line 273 of file kis_clone_layer.cpp.

274{
275 return v.visit(this);
276}
qreal v

References v.

◆ accept() [2/2]

void KisCloneLayer::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 KisBaseNode.

Definition at line 278 of file kis_clone_layer.cpp.

279{
280 return visitor.visit(this, undoAdapter);
281}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ accessRect()

QRect KisCloneLayer::accessRect ( const QRect & rect,
PositionToFilthy pos ) const
overrideprotectedvirtual
Returns
internal accessRect() of the node. Do not mix with
See also
projectionPlane()

Shows the area of image, that may be accessed during accessing the node.

Example. You have a layer that needs to prepare some rect on a projection, say expectedRect. To perform this, the projection of all the layers below of the size needRect(expectedRect) should be calculated by the merger beforehand and the layer will access some other area of image inside the rect accessRect(expectedRect) during updateProjection call.

This knowledge about real access rect of a node is used by the scheduler to avoid collisions between two multithreaded updaters and so avoid flickering of the image.

Currently, this method has nondefault value for shifted clone layers only.

KisUpdateOriginalVisitor will try to recalculate some area on the clone's source, so this extra rectangle should also be taken into account

Reimplemented from KisNode.

Definition at line 248 of file kis_clone_layer.cpp.

249{
250 QRect resultRect = rect;
251
252 if(pos & (N_FILTHY_PROJECTION | N_FILTHY)) {
253 if (m_d->offset->x() || m_d->offset->y()) {
254 resultRect |= rect.translated(-m_d->offset->x(), -m_d->offset->y());
255 }
256
262 resultRect |= needRectOnSourceForMasks(rect);
263 }
264
265 return resultRect;
266}
QRect needRectOnSourceForMasks(const QRect &rc) const
@ N_FILTHY
Definition kis_node.h:61
@ N_FILTHY_PROJECTION
Definition kis_node.h:60

References m_d, KisNode::N_FILTHY, KisNode::N_FILTHY_PROJECTION, and needRectOnSourceForMasks().

◆ allowAsChild()

bool KisCloneLayer::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 109 of file kis_clone_layer.cpp.

110{
111 return node->inherits("KisMask");
112}

◆ clone()

KisNodeSP KisCloneLayer::clone ( ) const
inlineoverridevirtual

Implements KisNode.

Definition at line 44 of file kis_clone_layer.h.

44 {
45 return KisNodeSP(new KisCloneLayer(*this));
46 }
KisSharedPtr< KisNode > KisNodeSP
Definition kis_types.h:86
KisCloneLayer(KisLayerSP from, KisImageWSP image, const QString &name, quint8 opacity)

◆ colorSpace()

const KoColorSpace * KisCloneLayer::colorSpace ( ) const
overridevirtual

Implements KisBaseNode.

Definition at line 141 of file kis_clone_layer.cpp.

142{
143 return m_d->copyFrom ? m_d->copyFrom->colorSpace() : m_d->fallback->colorSpace();
144}

References m_d.

◆ copyFrom()

KisLayerSP KisCloneLayer::copyFrom ( ) const

◆ copyFromInfo()

KisNodeUuidInfo KisCloneLayer::copyFromInfo ( ) const

◆ copyOriginalToProjection()

void KisCloneLayer::copyOriginalToProjection ( const KisPaintDeviceSP original,
KisPaintDeviceSP projection,
const QRect & rect ) const
overrideprotectedvirtual

Layers can override this method to get some special behavior when copying data from original to projection, e.g. blend in indirect painting device. If you need to modify data outside rect, please also override outgoingChangeRect() method.

Reimplemented from KisLayer.

Definition at line 146 of file kis_clone_layer.cpp.

149{
150 QRect copyRect = rect;
151 copyRect.translate(-m_d->offset->x(), -m_d->offset->y());
152
154}
static void copyAreaOptimized(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect)
KisPaintDeviceSP original() const override
KisPaintDeviceSP projection() const override
Definition kis_layer.cc:820

References KisPainter::copyAreaOptimized(), m_d, original(), and KisLayer::projection().

◆ copyType()

CopyLayerType KisCloneLayer::copyType ( ) const

Definition at line 306 of file kis_clone_layer.cpp.

307{
308 return m_d->type;
309}

References m_d.

◆ exactBounds()

QRect KisCloneLayer::exactBounds ( ) const
overridevirtual

Returns the exact bounds of where the actual data resides in this layer.

Reimplemented from KisBaseNode.

Definition at line 240 of file kis_clone_layer.cpp.

241{
242 QRect rect = original()->exactBounds();
243
244 // HINT: no offset now. See a comment in setDirtyOriginal()
245 return rect | projection()->exactBounds();
246}
QRect exactBounds() const

References KisPaintDevice::exactBounds(), original(), and KisLayer::projection().

◆ extent()

QRect KisCloneLayer::extent ( ) const
overridevirtual

Returns an approximation of where the bounds on actual data are in this layer.

Reimplemented from KisBaseNode.

Definition at line 232 of file kis_clone_layer.cpp.

233{
234 QRect rect = original()->extent();
235
236 // HINT: no offset now. See a comment in setDirtyOriginal()
237 return rect | projection()->extent();
238}
QRect extent() const

References KisPaintDevice::extent(), original(), and KisLayer::projection().

◆ icon()

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

Reimplemented from KisBaseNode.

Definition at line 322 of file kis_clone_layer.cpp.

323{
324 return KisIconUtils::loadIcon("cloneLayer");
325}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ needProjection()

bool KisCloneLayer::needProjection ( ) const
overridevirtual

Reimplemented from KisLayer.

Definition at line 136 of file kis_clone_layer.cpp.

137{
138 return m_d->offset->x() || m_d->offset->y();
139}

References m_d.

◆ needRectOnSourceForMasks()

QRect KisCloneLayer::needRectOnSourceForMasks ( const QRect & rc) const

Definition at line 193 of file kis_clone_layer.cpp.

194{
195 QStack<QRect> applyRects_unused;
196 bool rectVariesFlag;
197
199 if (effectMasks.isEmpty()) return QRect();
200
201 QRect needRect = this->masksNeedRect(effectMasks,
202 rc,
203 applyRects_unused,
204 rectVariesFlag);
205
206 if (needRect.isEmpty() ||
207 (!rectVariesFlag && needRect == rc)) {
208
209 return QRect();
210 }
211
212 return needRect;
213}
QList< KisEffectMaskSP > effectMasks() const
Definition kis_layer.cc:521
QRect masksNeedRect(const QList< KisEffectMaskSP > &masks, const QRect &changeRect, QStack< QRect > &applyRects, bool &rectVariesFlag) const
Definition kis_layer.cc:610
virtual QRect needRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const
Definition kis_node.cpp:218

References KisLayer::effectMasks(), KisLayer::masksNeedRect(), and KisNode::needRect().

◆ notifyParentVisibilityChanged()

void KisCloneLayer::notifyParentVisibilityChanged ( bool value)
overrideprotectedvirtual

Trigger a full update when the layer is finally getting transitively-visible

Reimplemented from KisBaseNode.

Definition at line 177 of file kis_clone_layer.cpp.

178{
179 KisImageSP imageSP = image().toStrongRef();
180 if (!imageSP) {
181 return;
182 }
187 if (value && visible(true)) {
188 KisLayer::setDirty(imageSP->bounds());
189 }
191}
float value(const T *src, size_t ch)
QRect bounds() const override
virtual void notifyParentVisibilityChanged(bool value)
virtual bool visible(bool recursive=false) const
virtual void setDirty()
Definition kis_node.cpp:577

References KisImage::bounds(), KisBaseNode::image, KisBaseNode::notifyParentVisibilityChanged(), KisNode::setDirty(), KisWeakSharedPtr< T >::toStrongRef(), value(), and KisBaseNode::visible().

◆ original()

KisPaintDeviceSP KisCloneLayer::original ( ) const
overridevirtual

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

Implements KisLayer.

Definition at line 119 of file kis_clone_layer.cpp.

120{
121 if (!m_d->copyFrom || !m_d->copyFrom->projection()) return m_d->fallback;
122 KisPaintDeviceSP retval;
123 switch (m_d->type) {
124 case COPY_PROJECTION:
125 retval = m_d->copyFrom->projection();
126 break;
127
128 case COPY_ORIGINAL:
129 default:
130 retval = m_d->copyFrom->original();
131 }
132
133 return retval;
134}
@ COPY_ORIGINAL

References COPY_ORIGINAL, COPY_PROJECTION, and m_d.

◆ outgoingChangeRect()

QRect KisCloneLayer::outgoingChangeRect ( const QRect & rect) const
overrideprotectedvirtual
See also
incomingChangeRect()

Reimplemented from KisLayer.

Definition at line 268 of file kis_clone_layer.cpp.

269{
270 return rect.translated(m_d->offset->x(), m_d->offset->y());
271}

References m_d.

◆ paintDevice()

KisPaintDeviceSP KisCloneLayer::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 114 of file kis_clone_layer.cpp.

115{
116 return 0;
117}

◆ Private()

KisCloneLayer::Private ( KisDefaultBoundsBaseSP defaultBounds)
inline

Definition at line 33 of file kis_clone_layer.cpp.

34 : offset(defaultBounds)
35 {
36 }
KisLodCapableLayerOffset offset

◆ reincarnateAsPaintLayer()

KisLayerSP KisCloneLayer::reincarnateAsPaintLayer ( ) const

When the source layer of the clone is removed from the stack we should substitute the clone with a usual paint layer, because the source might become unreachable quite soon. This method builds a paint layer representation of this clone.

Definition at line 90 of file kis_clone_layer.cpp.

91{
92 KisPaintDeviceSP newOriginal = new KisPaintDevice(*original());
93 KisPaintLayerSP newLayer = new KisPaintLayer(image(), name(), opacity(), newOriginal);
94 newLayer->setX(newLayer->x() + x());
95 newLayer->setY(newLayer->y() + y());
98
99 return newLayer;
100}
const QString & compositeOpId() const
void mergeNodeProperties(const KoProperties &properties)
const KoProperties & nodeProperties() const
void setCompositeOpId(const QString &compositeOpId)
qint32 y() const override
qint32 x() const override
qint32 y() const override
Definition kis_layer.cc:978
qint32 x() const override
Definition kis_layer.cc:973
void setX(qint32 x) override
Definition kis_layer.cc:983
void setY(qint32 y) override
Definition kis_layer.cc:989

References KisBaseNode::compositeOpId(), KisBaseNode::image, KisBaseNode::mergeNodeProperties(), KisBaseNode::name(), KisBaseNode::nodeProperties(), KisBaseNode::opacity(), original(), KisBaseNode::setCompositeOpId(), KisLayer::setX(), KisLayer::setY(), x(), KisLayer::x(), y(), and KisLayer::y().

◆ sectionModelProperties()

KisBaseNode::PropertyList KisCloneLayer::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 KisBaseNode.

Definition at line 327 of file kis_clone_layer.cpp.

328{
330 if (m_d->copyFrom)
331 l << KisBaseNode::Property(KoID("copy_from", i18n("Copy From")), m_d->copyFrom->name());
332
333 return l;
334}
Definition KoID.h:30
KisBaseNode::PropertyList sectionModelProperties() const override
Definition kis_layer.cc:272

References m_d, and KisLayer::sectionModelProperties().

◆ setCopyFrom()

void KisCloneLayer::setCopyFrom ( KisLayerSP layer)

Definition at line 283 of file kis_clone_layer.cpp.

284{
285 if (m_d->copyFrom) {
286 m_d->copyFrom->unregisterClone(this);
287 }
288
289 m_d->copyFrom = fromLayer;
290
291 if (m_d->copyFrom) {
292 m_d->copyFrom->registerClone(this);
293 }
294}

References m_d.

◆ setCopyFromInfo()

void KisCloneLayer::setCopyFromInfo ( KisNodeUuidInfo info)

Used when loading: loading is done in two passes, and the copy from layer is set when all layers have been created, not during loading.

Definition at line 316 of file kis_clone_layer.cpp.

317{
318 Q_ASSERT(!m_d->copyFrom);
319 m_d->copyFromInfo = info;
320}

References m_d.

◆ setCopyType()

void KisCloneLayer::setCopyType ( CopyLayerType type)

Definition at line 301 of file kis_clone_layer.cpp.

302{
303 m_d->type = type;
304}
CopyLayerType type

References m_d, and type.

◆ setDirtyOriginal()

void KisCloneLayer::setDirtyOriginal ( const QRect & rect,
bool dontInvalidateFrames )

This function is called by the original to notify us that it is dirty

The original will be updated when the clone becomes visible again.

HINT: this method is present for historical reasons only. Long time ago the updates were calculated in "copyOriginalToProjection" coordinate system. Now everything is done in "original()" space.

Definition at line 156 of file kis_clone_layer.cpp.

157{
162 if (!visible(true)) return;
163
170 if (!dontInvalidateFrames) {
172 } else {
174 }
175}
void setDirtyDontResetAnimationCache()
Definition kis_node.cpp:599

References KisNode::setDirty(), KisNode::setDirtyDontResetAnimationCache(), and KisBaseNode::visible().

◆ setImage()

void KisCloneLayer::setImage ( KisImageWSP image)
overridevirtual

Reimplemented from KisBaseNode.

Definition at line 102 of file kis_clone_layer.cpp.

103{
104 m_d->fallback->setDefaultBounds(new KisDefaultBounds(image));
105 m_d->offset.setDefaultBounds(new KisDefaultBounds(image));
107}
void setImage(KisImageWSP image) override
Definition kis_layer.cc:378

References KisBaseNode::image, m_d, and KisLayer::setImage().

◆ setX()

void KisCloneLayer::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 KisBaseNode.

Definition at line 223 of file kis_clone_layer.cpp.

224{
225 m_d->offset->setX(x);
226}

References m_d, and x().

◆ setY()

void KisCloneLayer::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 KisBaseNode.

Definition at line 227 of file kis_clone_layer.cpp.

228{
229 m_d->offset->setY(y);
230}

References m_d, and y().

◆ syncLodCache()

void KisCloneLayer::syncLodCache ( )
overridevirtual

Synchronizes LoD caches of the node with the current state of it. The current level of detail is fetched from the image pointed by default bounds object

Reimplemented from KisNode.

Definition at line 336 of file kis_clone_layer.cpp.

337{
339 m_d->offset.syncLodCache();
340}
virtual void syncLodCache()
Definition kis_node.cpp:677

References m_d, and KisNode::syncLodCache().

◆ x()

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

Reimplemented from KisBaseNode.

Definition at line 215 of file kis_clone_layer.cpp.

216{
217 return m_d->offset->x();
218}

References m_d.

◆ y()

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

Reimplemented from KisBaseNode.

Definition at line 219 of file kis_clone_layer.cpp.

220{
221 return m_d->offset->y();
222}

References m_d.

Member Data Documentation

◆ copyFrom

KisLayerSP KisCloneLayer::copyFrom

Definition at line 41 of file kis_clone_layer.cpp.

◆ copyFromInfo

KisNodeUuidInfo KisCloneLayer::copyFromInfo

Definition at line 42 of file kis_clone_layer.cpp.

◆ fallback

KisPaintDeviceSP KisCloneLayer::fallback

Definition at line 38 of file kis_clone_layer.cpp.

◆ m_d

Private* const KisCloneLayer::m_d {nullptr}
private

Definition at line 121 of file kis_clone_layer.h.

121{nullptr};

◆ offset

KisLodCapableLayerOffset KisCloneLayer::offset

Definition at line 39 of file kis_clone_layer.cpp.

◆ type

CopyLayerType KisCloneLayer::type {COPY_PROJECTION}

Definition at line 43 of file kis_clone_layer.cpp.


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