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

#include <kis_group_layer.h>

+ Inheritance diagram for KisGroupLayer:

Public Member Functions

bool accept (KisNodeVisitor &v) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
bool allowAsChild (KisNodeSP) const override
 
QRect calculateChildrenLooseUserVisibleBounds () const
 
QRect calculateChildrenTightUserVisibleBounds () const
 
KisNodeSP clone () const override
 
const KoColorSpacecolorSpace () const override
 
KisLayerSP createMergedLayerTemplate (KisLayerSP prevLayer) override
 
KoColor defaultProjectionColor () const
 
QRect exactBounds () const override
 
QRect extent () const override
 
void fillMergedLayerTemplate (KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer) override
 
QIcon icon () const override
 
 KisGroupLayer (const KisGroupLayer &rhs)
 
 KisGroupLayer (KisImageWSP image, const QString &name, quint8 opacity, const KoColorSpace *colorSpace=0)
 
KisPaintDeviceSP lazyDestinationForSubtreeComposition () const
 
KisPaintDeviceSP original () const override
 
std::tuple< KisPaintDeviceSP, bool > originalImpl () const
 
KisPaintDeviceSP paintDevice () const override
 Group layers don't have a paint device, so return 0.
 
bool passThroughMode () const
 
 Private ()
 
bool projectionIsValid () const
 
void resetCache (const KoColorSpace *colorSpace)
 
KisBaseNode::PropertyList sectionModelProperties () const override
 
void setDefaultProjectionColor (KoColor color)
 
void setImage (KisImageWSP image) override
 
void setPassThroughMode (bool value)
 
void setSectionModelProperties (const KisBaseNode::PropertyList &properties) override
 
void setX (qint32 x) override
 
void setY (qint32 y) override
 
qint32 x () const override
 
qint32 y () const override
 
 ~KisGroupLayer () 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.
 
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
 
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 ()
 
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< 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
 
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
 
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

KisPaintDeviceSP paintDevice
 
bool passThroughMode
 
qint32 x
 
qint32 y
 
- 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 amortizedProjectionRectForCleanupInChangePass () const override
 
KisLayeronlyMeaningfulChild () const
 
std::tuple< KisPaintDeviceSP, bool > originalImpl () const
 
KisPaintDeviceSP tryObligeChild () const
 
- Protected Member Functions inherited from KisLayer
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< KisEffectMaskSPsearchEffectMasks (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 KisKeyframeChannelrequestKeyframeChannel (const QString &id)
 
void setSupportsLodMoves (bool value)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Private Member Functions

bool checkCloneLayer (KisCloneLayerSP clone) const
 
bool checkNodeRecursively (KisNodeSP node) const
 

Private Attributes

Private *const m_d
 

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 KisLayer that bundles child layers into a single layer. The top layer is firstChild(), with index 0; the bottommost lastChild() with index childCount() - 1. KisLayer::nextSibling() moves towards higher indices, from the top to the bottom layer; prevSibling() the reverse. (Implementation detail: internally, the indices are reversed, for speed.)

Definition at line 32 of file kis_group_layer.cc.

Constructor & Destructor Documentation

◆ KisGroupLayer() [1/2]

KisGroupLayer::KisGroupLayer ( KisImageWSP image,
const QString & name,
quint8 opacity,
const KoColorSpace * colorSpace = 0 )

Definition at line 51 of file kis_group_layer.cc.

51 :
53 m_d(new Private())
54{
56}
KisImageWSP image
QString name() const
quint8 opacity() const
Private *const m_d
const KoColorSpace * colorSpace() const override
void resetCache(const KoColorSpace *colorSpace)
friend class KisLayer
Definition kis_node.h:383

References colorSpace(), and resetCache().

◆ KisGroupLayer() [2/2]

KisGroupLayer::KisGroupLayer ( const KisGroupLayer & rhs)

Definition at line 58 of file kis_group_layer.cc.

58 :
59 KisLayer(rhs),
60 m_d(new Private())
61{
62 m_d->paintDevice = new KisPaintDevice(*rhs.m_d->paintDevice.data());
63 m_d->x = rhs.m_d->x;
64 m_d->y = rhs.m_d->y;
65 m_d->paintDevice->setDefaultPixel(const_cast<KisGroupLayer*>(&rhs)->m_d->paintDevice->defaultPixel());
66 m_d->paintDevice->setProjectionDevice(true);
67 m_d->passThroughMode = rhs.passThroughMode();
68}

References m_d, and passThroughMode.

◆ ~KisGroupLayer()

KisGroupLayer::~KisGroupLayer ( )
override

Definition at line 70 of file kis_group_layer.cc.

71{
72 delete m_d;
73}

References m_d.

Member Function Documentation

◆ accept() [1/2]

bool KisGroupLayer::accept ( KisNodeVisitor & v)
overridevirtual

Accept the specified visitor.

Returns
true if the operation succeeded, false if it failed.

Reimplemented from KisBaseNode.

Definition at line 358 of file kis_group_layer.cc.

359{
360 return v.visit(this);
361}
qreal v

References v.

◆ accept() [2/2]

void KisGroupLayer::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 363 of file kis_group_layer.cc.

364{
365 return visitor.visit(this, undoAdapter);
366}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ allowAsChild()

bool KisGroupLayer::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 114 of file kis_group_layer.cc.

115{
116 if (!checkNodeRecursively(node)) return false;
117
118 if (!parent()) {
119 // We are the root layer, so we need to check
120 // whether the node that's going to be added is
121 // a selection mask; that is only allowed if
122 // there isn't a global selection. See
123 // BUG:294905
124
125 if (node->inherits("KisSelectionMask")) {
126 return !qobject_cast<KisSelectionMask*>(node.data())->active() || !selectionMask();
127 }
128
129 KisImageSP image = this->image();
130
131 if (!image || !image->allowMasksOnRootNode()) {
132 if (node->inherits("KisMask")) {
133 return false;
134 }
135 }
136 }
137
138 return checkNodeRecursively(node);
139
140}
bool allowMasksOnRootNode() const
bool checkNodeRecursively(KisNodeSP node) const
virtual KisSelectionMaskSP selectionMask() const
Definition kis_layer.cc:498
KisNodeWSP parent
Definition kis_node.cpp:86

References KisImage::allowMasksOnRootNode(), checkNodeRecursively(), KisSharedPtr< T >::data(), KisBaseNode::image, KisNode::parent, and KisLayer::selectionMask().

◆ amortizedProjectionRectForCleanupInChangePass()

QRect KisGroupLayer::amortizedProjectionRectForCleanupInChangePass ( ) const
overrideprotectedvirtual

Internal projection device that should be updated in the changeRect pass even when the change rect is cropped by masks or something like that

Reimplemented from KisLayer.

Definition at line 294 of file kis_group_layer.cc.

295{
296 return hasEffectMasks() ? projection()->exactBoundsAmortized() : m_d->paintDevice->exactBoundsAmortized();
297}
QRect exactBoundsAmortized() const
KisPaintDeviceSP projection() const override
Definition kis_layer.cc:820
bool hasEffectMasks() const
Definition kis_layer.cc:562

References KisPaintDevice::exactBoundsAmortized(), KisLayer::hasEffectMasks(), m_d, and KisLayer::projection().

◆ calculateChildrenLooseUserVisibleBounds()

QRect KisGroupLayer::calculateChildrenLooseUserVisibleBounds ( ) const

Definition at line 445 of file kis_group_layer.cc.

446{
447 return collectRects(this, ExtentPolicy());
448}
QRect collectRects(const KisNode *node, MetricPolicy policy)

References collectRects().

◆ calculateChildrenTightUserVisibleBounds()

QRect KisGroupLayer::calculateChildrenTightUserVisibleBounds ( ) const

Definition at line 440 of file kis_group_layer.cc.

441{
442 return collectRects(this, ExactBoundsPolicy());
443}

References collectRects().

◆ checkCloneLayer()

bool KisGroupLayer::checkCloneLayer ( KisCloneLayerSP clone) const
private

Definition at line 75 of file kis_group_layer.cc.

76{
77 KisNodeSP source = clone->copyFrom();
78 if (source) {
79 if(!allowAsChild(source)) return false;
80
81 if (source->inherits("KisGroupLayer")) {
82 KisNodeSP newParent = const_cast<KisGroupLayer*>(this);
83 while (newParent) {
84 if (newParent == source) {
85 return false;
86 }
87 newParent = newParent->parent();
88 }
89 }
90 }
91
92 return true;
93}
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
KisNodeSP clone() const override
bool allowAsChild(KisNodeSP) const override

References allowAsChild(), clone(), KisNode::parent, and source().

◆ checkNodeRecursively()

bool KisGroupLayer::checkNodeRecursively ( KisNodeSP node) const
private

Definition at line 95 of file kis_group_layer.cc.

96{
97 KisCloneLayerSP cloneLayer = dynamic_cast<KisCloneLayer*>(node.data());
98 if(cloneLayer) {
99 return checkCloneLayer(cloneLayer);
100 }
101 else if (node->inherits("KisGroupLayer")) {
102 KisNodeSP child = node->firstChild();
103 while (child) {
104 if (!checkNodeRecursively(child)) {
105 return false;
106 }
107 child = child->nextSibling();
108 }
109 }
110
111 return true;
112}
bool checkCloneLayer(KisCloneLayerSP clone) const
KisNodeSP firstChild() const
Definition kis_node.cpp:361
KisNodeSP nextSibling() const
Definition kis_node.cpp:408

References checkCloneLayer(), checkNodeRecursively(), KisSharedPtr< T >::data(), KisNode::firstChild(), and KisNode::nextSibling().

◆ clone()

KisNodeSP KisGroupLayer::clone ( ) const
inlineoverridevirtual

Implements KisNode.

Definition at line 30 of file kis_group_layer.h.

30 {
31 return KisNodeSP(new KisGroupLayer(*this));
32 }
KisSharedPtr< KisNode > KisNodeSP
Definition kis_types.h:86
KisGroupLayer(KisImageWSP image, const QString &name, quint8 opacity, const KoColorSpace *colorSpace=0)

◆ colorSpace()

const KoColorSpace * KisGroupLayer::colorSpace ( ) const
overridevirtual

XXX: make the colorspace of a layergroup user-settable: we want to be able to have, for instance, a group of grayscale layers resulting in a grayscale projection that is then merged with an rgb image stack.

Implements KisBaseNode.

Definition at line 142 of file kis_group_layer.cc.

143{
144 return m_d->paintDevice->colorSpace();
145}

References m_d.

◆ createMergedLayerTemplate()

KisLayerSP KisGroupLayer::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 158 of file kis_group_layer.cc.

159{
160 KisGroupLayer *prevGroup = dynamic_cast<KisGroupLayer*>(prevLayer.data());
161
162 if (prevGroup && canMergeAndKeepBlendOptions(prevLayer)) {
163 KisSharedPtr<KisGroupLayer> merged(new KisGroupLayer(*prevGroup));
164
165 KisNodeSP child, cloned;
166
167 for (child = firstChild(); child; child = child->nextSibling()) {
168 cloned = child->clone();
169 image()->addNode(cloned, merged);
170 }
171
172 if (!merged->passThroughMode()) {
173 image()->refreshGraphAsync(merged);
174 }
175
176 return merged;
177 } else
178 return KisLayer::createMergedLayerTemplate(prevLayer);
179}
void refreshGraphAsync(KisNodeSP root, const QVector< QRect > &rects, const QRect &cropRect, KisProjectionUpdateFlags flags=KisProjectionUpdateFlag::None) override
virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer)
Definition kis_layer.cc:401
bool canMergeAndKeepBlendOptions(KisLayerSP otherLayer)
Definition kis_layer.cc:390
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
virtual KisNodeSP clone() const =0

References KisNodeFacade::addNode(), KisLayer::canMergeAndKeepBlendOptions(), KisNode::clone(), KisLayer::createMergedLayerTemplate(), KisSharedPtr< T >::data(), KisNode::firstChild(), KisBaseNode::image, KisGroupLayer(), KisNode::nextSibling(), and KisImage::refreshGraphAsync().

◆ defaultProjectionColor()

KoColor KisGroupLayer::defaultProjectionColor ( ) const
See also
setDefaultProjectionColor()

Definition at line 314 of file kis_group_layer.cc.

315{
316 KoColor color(m_d->paintDevice->defaultPixel(), m_d->paintDevice->colorSpace());
317 return color;
318}

References m_d.

◆ exactBounds()

QRect KisGroupLayer::exactBounds ( ) const
overridevirtual

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

Reimplemented from KisBaseNode.

Definition at line 433 of file kis_group_layer.cc.

434{
435 return m_d->passThroughMode ?
438}
QRect calculateChildrenTightUserVisibleBounds() const
QRect exactBounds() const override

References calculateChildrenTightUserVisibleBounds(), KisLayer::exactBounds(), and m_d.

◆ extent()

QRect KisGroupLayer::extent ( ) const
overridevirtual

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

Reimplemented from KisBaseNode.

Definition at line 426 of file kis_group_layer.cc.

427{
428 return m_d->passThroughMode ?
430 KisLayer::extent();
431}
QRect extent() const override
QRect calculateChildrenLooseUserVisibleBounds() const

References calculateChildrenLooseUserVisibleBounds(), KisLayer::extent(), and m_d.

◆ fillMergedLayerTemplate()

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

Reimplemented from KisLayer.

Definition at line 181 of file kis_group_layer.cc.

182{
183 if (!dynamic_cast<KisGroupLayer*>(dstLayer.data())) {
184 KisLayer::fillMergedLayerTemplate(dstLayer, prevLayer, skipPaintingThisLayer);
185 }
186}
virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer=false)
Definition kis_layer.cc:416

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

◆ icon()

QIcon KisGroupLayer::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 147 of file kis_group_layer.cc.

148{
149 return KisIconUtils::loadIcon("groupLayer");
150}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ lazyDestinationForSubtreeComposition()

KisPaintDeviceSP KisGroupLayer::lazyDestinationForSubtreeComposition ( ) const

Returns own original device when tryOblidgeChild() mechanism is not triggered. When tryOblidgeChild() mechanism is in action, returns null (therefor there is no need to do subtree composition).

Definition at line 285 of file kis_group_layer.cc.

286{
287 KisPaintDeviceSP originalDev;
288 bool ownsOriginal = false;
289 std::tie(originalDev, ownsOriginal) = originalImpl();
290
291 return ownsOriginal ? originalDev : nullptr;
292}
std::tuple< KisPaintDeviceSP, bool > originalImpl() const

References originalImpl().

◆ onlyMeaningfulChild()

KisLayer * KisGroupLayer::onlyMeaningfulChild ( ) const
protected

Definition at line 214 of file kis_group_layer.cc.

215{
216 KisNode *child = firstChild().data();
217 KisLayer *onlyLayer = 0;
218
219 while (child) {
220 KisLayer *layer = qobject_cast<KisLayer*>(child);
221 if (layer && !layer->isFakeNode()) {
222 if (onlyLayer) return 0;
223 onlyLayer = layer;
224 }
225 child = child->nextSibling().data();
226 }
227
228 return onlyLayer;
229}
virtual bool isFakeNode() const

References KisSharedPtr< T >::data(), KisNode::firstChild(), KisBaseNode::isFakeNode(), and KisNode::nextSibling().

◆ original()

KisPaintDeviceSP KisGroupLayer::original ( ) const
overridevirtual
Returns
the projection of the layers in the group before the masks are applied.

Implements KisLayer.

Definition at line 280 of file kis_group_layer.cc.

281{
282 return std::get<0>(originalImpl());
283}

References originalImpl().

◆ originalImpl() [1/2]

std::tuple< KisPaintDeviceSP, bool > KisGroupLayer::originalImpl ( ) const

We are too lazy! Let's our children work for us. Try to use children's paintDevice if it's the only one in stack and meets some conditions

Definition at line 259 of file kis_group_layer.cc.

260{
266 KisPaintDeviceSP realOriginal = tryObligeChild();
267 bool ownsOriginal = false;
268
269 if (!realOriginal) {
270 if (!childCount() && !m_d->paintDevice->extent().isEmpty()) {
271 m_d->paintDevice->clear();
272 }
273 realOriginal = m_d->paintDevice;
274 ownsOriginal = true;
275 }
276
277 return std::make_tuple(realOriginal, ownsOriginal);
278}
KisPaintDeviceSP tryObligeChild() const
quint32 childCount() const
Definition kis_node.cpp:414

References KisNode::childCount(), m_d, and tryObligeChild().

◆ originalImpl() [2/2]

std::tuple< KisPaintDeviceSP, bool > KisGroupLayer::originalImpl ( ) const
protected

◆ paintDevice()

KisPaintDeviceSP KisGroupLayer::paintDevice ( ) const
overridevirtual

Group layers don't have a paint device, so return 0.

Implements KisBaseNode.

◆ passThroughMode()

bool KisGroupLayer::passThroughMode ( ) const

◆ Private()

KisGroupLayer::Private ( )
inline

Definition at line 35 of file kis_group_layer.cc.

36 : paintDevice(0)
37 , x(0)
38 , y(0)
39 , passThroughMode(false)
40 {
41 }
KisPaintDeviceSP paintDevice

◆ projectionIsValid()

bool KisGroupLayer::projectionIsValid ( ) const

Definition at line 304 of file kis_group_layer.cc.

305{
306 return !tryObligeChild();
307}

References tryObligeChild().

◆ resetCache()

void KisGroupLayer::resetCache ( const KoColorSpace * colorSpace)

Clear the projection

Definition at line 188 of file kis_group_layer.cc.

189{
190 if (!colorSpace)
192
193 Q_ASSERT(colorSpace);
194
195 if (!m_d->paintDevice) {
196
198 dev->setX(this->x());
199 dev->setY(this->y());
200 m_d->paintDevice = dev;
201 m_d->paintDevice->setProjectionDevice(true);
202 }
203 else if(*m_d->paintDevice->colorSpace() != *colorSpace) {
204
205 m_d->paintDevice->clear();
206 m_d->paintDevice->convertTo(colorSpace);
207
208 } else {
209
210 m_d->paintDevice->clear();
211 }
212}
const KoColorSpace * colorSpace() const
void setX(qint32 x)
void setY(qint32 y)

References KisImage::colorSpace(), colorSpace(), KisBaseNode::image, m_d, KisPaintDevice::setX(), KisPaintDevice::setY(), x, and y.

◆ sectionModelProperties()

KisBaseNode::PropertyList KisGroupLayer::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 338 of file kis_group_layer.cc.

339{
341
343
344 return l;
345}
static KisBaseNode::Property getProperty(const KoID &id, bool state)
KisBaseNode::PropertyList sectionModelProperties() const override
Definition kis_layer.cc:272

References KisLayerPropertiesIcons::getProperty(), KisLayerPropertiesIcons::passThrough, passThroughMode, and KisLayer::sectionModelProperties().

◆ setDefaultProjectionColor()

void KisGroupLayer::setDefaultProjectionColor ( KoColor color)

A special method that changes the default color of the projection merged onto this group layer. Please note, that you cannot use original()->setDefaultPixel(), because original() device can be switched by tryOblidgeChild() mechanism randomly.

Definition at line 309 of file kis_group_layer.cc.

310{
311 m_d->paintDevice->setDefaultPixel(color);
312}

References m_d.

◆ setImage()

void KisGroupLayer::setImage ( KisImageWSP image)
overridevirtual

Reimplemented from KisBaseNode.

Definition at line 152 of file kis_group_layer.cc.

153{
154 m_d->paintDevice->setDefaultBounds(new KisDefaultBounds(image));
156}
void setImage(KisImageWSP image) override
Definition kis_layer.cc:378

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

◆ setPassThroughMode()

void KisGroupLayer::setPassThroughMode ( bool value)

Definition at line 325 of file kis_group_layer.cc.

326{
327 if (m_d->passThroughMode == value) return;
328
329 m_d->passThroughMode = value;
330 if (m_d->passThroughMode) {
332 }
336}
float value(const T *src, size_t ch)
void notifyChildMaskChanged()
Definition kis_layer.cc:493
void baseNodeInvalidateAllFramesCallback() override
Definition kis_node.cpp:337
void baseNodeChangedCallback() override
Definition kis_node.cpp:329

References KisNode::baseNodeChangedCallback(), KisNode::baseNodeInvalidateAllFramesCallback(), colorSpace(), m_d, KisLayer::notifyChildMaskChanged(), resetCache(), and value().

◆ setSectionModelProperties()

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

Change the section model properties.

Reimplemented from KisBaseNode.

Definition at line 347 of file kis_group_layer.cc.

348{
349 Q_FOREACH (const KisBaseNode::Property &property, properties) {
350 if (property.name == i18n("Pass Through")) {
351 setPassThroughMode(property.state.toBool());
352 }
353 }
354
356}
KoProperties properties
void setPassThroughMode(bool value)
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override
Definition kis_layer.cc:297

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

◆ setX()

void KisGroupLayer::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 378 of file kis_group_layer.cc.

379{
380 m_d->x = x;
381 if(m_d->paintDevice) {
382 m_d->paintDevice->setX(x);
383 }
384}

References m_d, and x.

◆ setY()

void KisGroupLayer::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 386 of file kis_group_layer.cc.

387{
388 m_d->y = y;
389 if(m_d->paintDevice) {
390 m_d->paintDevice->setY(y);
391 }
392}

References m_d, and y.

◆ tryObligeChild()

KisPaintDeviceSP KisGroupLayer::tryObligeChild ( ) const
protected

Definition at line 231 of file kis_group_layer.cc.

232{
233 KisLayer *child = onlyMeaningfulChild();
234
235 if (child) {
237 if (child->channelFlags().isEmpty() &&
238 projection &&
239 child->visible() &&
240 (child->compositeOpId() == COMPOSITE_OVER ||
242 child->compositeOpId() == COMPOSITE_COPY) &&
243 child->opacity() == OPACITY_OPAQUE_U8 &&
244 *projection->colorSpace() == *colorSpace() &&
245 !child->layerStyle()) {
246
247 quint8 defaultOpacity =
248 m_d->paintDevice->defaultPixel().opacityU8();
249
250 if(defaultOpacity == OPACITY_TRANSPARENT_U8) {
251 return projection;
252 }
253 }
254 }
255
256 return 0;
257}
const quint8 OPACITY_TRANSPARENT_U8
const quint8 OPACITY_OPAQUE_U8
const QString COMPOSITE_OVER
const QString COMPOSITE_COPY
const QString COMPOSITE_ALPHA_DARKEN
const KoColorSpace * colorSpace() const
const QString & compositeOpId() const
virtual bool visible(bool recursive=false) const
KisLayer * onlyMeaningfulChild() const
QBitArray channelFlags
Definition kis_layer.cc:167
KisPSDLayerStyleSP layerStyle
Definition kis_layer.cc:171

References KisLayer::channelFlags, KisPaintDevice::colorSpace(), colorSpace(), COMPOSITE_ALPHA_DARKEN, COMPOSITE_COPY, COMPOSITE_OVER, KisBaseNode::compositeOpId(), KisLayer::layerStyle, m_d, onlyMeaningfulChild(), KisBaseNode::opacity(), OPACITY_OPAQUE_U8, OPACITY_TRANSPARENT_U8, KisLayer::projection(), and KisBaseNode::visible().

◆ x()

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

Reimplemented from KisBaseNode.

◆ y()

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

Reimplemented from KisBaseNode.

Member Data Documentation

◆ m_d

Private* const KisGroupLayer::m_d
private

Definition at line 120 of file kis_group_layer.h.

◆ paintDevice

KisPaintDeviceSP KisGroupLayer::paintDevice

Definition at line 43 of file kis_group_layer.cc.

◆ passThroughMode

bool KisGroupLayer::passThroughMode

Definition at line 46 of file kis_group_layer.cc.

◆ x

qint32 KisGroupLayer::x

Definition at line 44 of file kis_group_layer.cc.

◆ y

qint32 KisGroupLayer::y

Definition at line 45 of file kis_group_layer.cc.


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