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

#include <KisDecorationsWrapperLayer.h>

+ Inheritance diagram for KisDecorationsWrapperLayer:

Classes

struct  Private
 

Public Member Functions

bool accept (KisNodeVisitor &) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
bool allowAsChild (KisNodeSP) const override
 
KisNodeSP clone () const override
 
KUndo2Commandcrop (const QRect &rect) override
 
KisDocumentdocument () const
 
bool isFakeNode () const override
 
 KisDecorationsWrapperLayer (const KisDecorationsWrapperLayer &rhs)
 
 KisDecorationsWrapperLayer (KisDocument *document)
 
KisPaintDeviceSP original () const override
 
KisPaintDeviceSP paintDevice () const override
 
void setDocument (KisDocument *document)
 
void setImage (KisImageWSP image) override
 
bool supportsPerspectiveTransform () const override
 
KUndo2Commandtransform (const QTransform &transform) override
 
 ~KisDecorationsWrapperLayer ()
 
- Public Member Functions inherited from KisExternalLayer
virtual KUndo2CommandconvertTo (const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags())
 
QIcon icon () const override
 
 KisExternalLayer (KisImageWSP image, const QString &name, quint8 opacity)
 
virtual void resetCache (const KoColorSpace *colorSpace=0)
 
virtual KUndo2CommandsetProfile (const KoColorProfile *profile)
 
virtual QRect theoreticalBoundingRect () 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 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 ()
 
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 Private
 Private (KisCanvas2 *c)
 
- 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
 
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 ()
 

Private Attributes

const QScopedPointer< Privatem_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)
 
- 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 Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- 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 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< 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 ()
 

Detailed Description

KisDecorationsWrapperLayer is a fake node for connecting Grids, Guides and Assistants the KisNodeVisitor system. This allows things like crops and transformations to be applied to these decoration style items.

Definition at line 21 of file KisDecorationsWrapperLayer.h.

Constructor & Destructor Documentation

◆ KisDecorationsWrapperLayer() [1/2]

KisDecorationsWrapperLayer::KisDecorationsWrapperLayer ( KisDocument * document)

Definition at line 23 of file KisDecorationsWrapperLayer.cpp.

24 : KisExternalLayer(document->image(), "decorations-wrapper-layer", OPACITY_OPAQUE_U8),
25 m_d(new Private)
26{
27 m_d->document = document;
28 m_d->fakeOriginalDevice = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
29 m_d->fakeOriginalDevice->setDefaultBounds(new KisDefaultBounds(document->image()));
30}
const quint8 OPACITY_OPAQUE_U8
const QScopedPointer< Private > m_d
KisExternalLayer(KisImageWSP image, const QString &name, quint8 opacity)
static KoColorSpaceRegistry * instance()

References document(), KoColorSpaceRegistry::instance(), and m_d.

◆ KisDecorationsWrapperLayer() [2/2]

KisDecorationsWrapperLayer::KisDecorationsWrapperLayer ( const KisDecorationsWrapperLayer & rhs)

Definition at line 33 of file KisDecorationsWrapperLayer.cpp.

34 : KisExternalLayer(rhs.image(), "decorations-wrapper-layer", OPACITY_OPAQUE_U8),
35 m_d(new Private)
36{
37 m_d->document = rhs.m_d->document;
38 m_d->fakeOriginalDevice = new KisPaintDevice(*rhs.m_d->fakeOriginalDevice);
39}
KisImageWSP image

References m_d.

◆ ~KisDecorationsWrapperLayer()

KisDecorationsWrapperLayer::~KisDecorationsWrapperLayer ( )

Definition at line 41 of file KisDecorationsWrapperLayer.cpp.

42{
43}

Member Function Documentation

◆ accept() [1/2]

bool KisDecorationsWrapperLayer::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 63 of file KisDecorationsWrapperLayer.cpp.

64{
65 return visitor.visit(this);
66}

References KisNodeVisitor::visit().

◆ accept() [2/2]

void KisDecorationsWrapperLayer::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 68 of file KisDecorationsWrapperLayer.cpp.

69{
70 visitor.visit(this, undoAdapter);
71}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ allowAsChild()

bool KisDecorationsWrapperLayer::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 58 of file KisDecorationsWrapperLayer.cpp.

59{
60 return false;
61}

◆ clone()

KisNodeSP KisDecorationsWrapperLayer::clone ( ) const
overridevirtual

Implements KisNode.

Definition at line 73 of file KisDecorationsWrapperLayer.cpp.

73 {
74 return new KisDecorationsWrapperLayer(*this);
75}
KisDecorationsWrapperLayer(KisDocument *document)

References KisDecorationsWrapperLayer().

◆ crop()

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

Reimplemented from KisExternalLayer.

Definition at line 103 of file KisDecorationsWrapperLayer.cpp.

104{
105 return transform(QTransform::fromTranslate(-rect.x(), -rect.y()));
106}
KUndo2Command * transform(const QTransform &transform) override

References transform().

◆ document()

KisDocument * KisDecorationsWrapperLayer::document ( ) const

Definition at line 53 of file KisDecorationsWrapperLayer.cpp.

54{
55 return m_d->document;
56}

References m_d.

◆ isFakeNode()

bool KisDecorationsWrapperLayer::isFakeNode ( ) const
overridevirtual

Fake node is not present in the layer stack and is not used for normal projection rendering algorithms.

Reimplemented from KisBaseNode.

Definition at line 87 of file KisDecorationsWrapperLayer.cpp.

88{
89 return true;
90}

◆ original()

KisPaintDeviceSP KisDecorationsWrapperLayer::original ( ) const
overridevirtual

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

Implements KisLayer.

Definition at line 77 of file KisDecorationsWrapperLayer.cpp.

78{
79 return m_d->fakeOriginalDevice;
80}

References m_d.

◆ paintDevice()

KisPaintDeviceSP KisDecorationsWrapperLayer::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 82 of file KisDecorationsWrapperLayer.cpp.

83{
84 return 0;
85}

◆ setDocument()

void KisDecorationsWrapperLayer::setDocument ( KisDocument * document)

Definition at line 45 of file KisDecorationsWrapperLayer.cpp.

46{
47 m_d->document = document;
48 KIS_SAFE_ASSERT_RECOVER(image() == document->image()) {
49 setImage(document->image());
50 }
51}
void setImage(KisImageWSP image) override
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126

References document(), KisBaseNode::image, KIS_SAFE_ASSERT_RECOVER, m_d, and setImage().

◆ setImage()

void KisDecorationsWrapperLayer::setImage ( KisImageWSP image)
overridevirtual

Reimplemented from KisBaseNode.

Definition at line 97 of file KisDecorationsWrapperLayer.cpp.

98{
99 m_d->fakeOriginalDevice->setDefaultBounds(new KisDefaultBounds(image));
101}
virtual void setImage(KisImageWSP image)

References KisBaseNode::image, m_d, KisPaintDevice::setDefaultBounds(), and KisBaseNode::setImage().

◆ supportsPerspectiveTransform()

bool KisDecorationsWrapperLayer::supportsPerspectiveTransform ( ) const
overridevirtual

Reimplemented from KisExternalLayer.

Definition at line 92 of file KisDecorationsWrapperLayer.cpp.

93{
94 return false;
95}

◆ transform()

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

Reimplemented from KisExternalLayer.

Definition at line 108 of file KisDecorationsWrapperLayer.cpp.

109{
111
112 struct UndoCommand : public KUndo2Command
113 {
114 UndoCommand(KisDocument *document, const QTransform &transform)
115 : m_document(document),
116 m_transform(transform)
117 {}
118
119 void undo() override {
120 doTransform(m_transform.inverted());
121 }
122
123 void redo() override {
124 doTransform(m_transform);
125 }
126
127 private:
128 void doTransform(const QTransform &transform) {
129 const QTransform imageToDocument =
130 QTransform::fromScale(1 / m_document->image()->xRes(),
131 1 / m_document->image()->yRes());
132
133 KisGridConfig gridConfig = m_document->gridConfig();
134 if (gridConfig.showGrid()) {
135 gridConfig.transform(transform);
136 m_document->setGridConfig(gridConfig);
137 }
138
139 KisGuidesConfig guidesConfig = m_document->guidesConfig();
140 if (guidesConfig.hasGuides()) {
141 guidesConfig.transform(imageToDocument.inverted() * transform * imageToDocument);
142 m_document->setGuidesConfig(guidesConfig);
143 }
144
145 QList<KisPaintingAssistantSP> assistants = m_document->assistants();
146 Q_FOREACH(KisPaintingAssistantSP assistant, assistants) {
147 assistant->transform(imageToDocument.inverted() * transform * imageToDocument);
148 }
149 m_document->setAssistants(assistants);
150 }
151
152 private:
153 KisDocument *m_document;
154 QTransform m_transform;
155 };
156
157 return new UndoCommand(m_d->document, transform);
158}
void transform(const QTransform &transform)
bool showGrid() const
void transform(const QTransform &transform)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129
QAction * redo(const QObject *recvr, const char *slot, QObject *parent)
QAction * undo(const QObject *recvr, const char *slot, QObject *parent)

References KisGuidesConfig::hasGuides(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_d, KisGridConfig::showGrid(), KisGridConfig::transform(), KisGuidesConfig::transform(), and transform().

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisDecorationsWrapperLayer::m_d
private

Definition at line 57 of file KisDecorationsWrapperLayer.h.


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