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

#include <kis_transparency_mask.h>

+ Inheritance diagram for KisTransparencyMask:

Public Member Functions

bool accept (KisNodeVisitor &v) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
QRect changeRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
KisNodeSP clone () const override
 
QRect decorateRect (KisPaintDeviceSP &src, KisPaintDeviceSP &dst, const QRect &rc, PositionToFilthy maskPos, KisRenderPassFlags flags) const override
 
QRect exactBounds () const override
 
QRect extent () const override
 
QIcon icon () const override
 
 KisTransparencyMask (const KisTransparencyMask &rhs)
 
 KisTransparencyMask (KisImageWSP image, const QString &name)
 
QRect needRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
bool paintsOutsideSelection () const override
 
 ~KisTransparencyMask () override
 
- Public Member Functions inherited from KisEffectMask
void apply (KisPaintDeviceSP projection, const QRect &applyRect, const QRect &needRect, PositionToFilthy maskPos, KisRenderPassFlags flags) const
 
 KisEffectMask (const KisEffectMask &rhs)
 
 KisEffectMask (KisImageWSP image, const QString &name)
 
 ~KisEffectMask () override
 
- Public Member Functions inherited from KisMask
bool allowAsChild (KisNodeSP node) const override
 
const KoColorSpacecolorSpace () const override
 
const KoCompositeOpcompositeOp () const override
 
QImage createThumbnail (qint32 w, qint32 h, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio) override
 
void initSelection (KisLayerSP parentLayer)
 initSelection initializes an empty selection
 
void initSelection (KisPaintDeviceSP copyFromDevice, KisLayerSP parentLayer)
 initSelection initializes the selection for the mask from the given paint device.
 
void initSelection (KisSelectionSP copyFrom, KisLayerSP parentLayer)
 initSelection initializes the selection for the mask from the given selection's projection.
 
void initSelectionImpl (KisSelectionSP copyFrom, KisLayerSP parentLayer, KisPaintDeviceSP copyFromDevice, KisImageWSP image)
 
 KisMask (const KisMask &rhs)
 
 KisMask (KisImageWSP image, const QString &name)
 
virtual QRect nonDependentExtent () const
 
KisPaintDeviceSP original () const override
 
KisPaintDeviceSP paintDevice () const override
 
 Private (KisMask *_q)
 
KisPaintDeviceSP projection () const override
 
KisAbstractProjectionPlaneSP projectionPlane () const override
 
void select (const QRect &rc, quint8 selectedness=MAX_SELECTED)
 
KisSelectionSP selection () const
 
void setImage (KisImageWSP image) override
 
void setSelection (KisSelectionSP selection)
 
void setX (qint32 x) override
 
void setY (qint32 y) override
 
bool supportsLodPainting () const override
 
void testingInitSelection (const QRect &rect, KisLayerSP parentLayer)
 
int thumbnailSeqNo () const override
 
qint32 x () const override
 
qint32 y () const override
 
 ~KisMask () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisNode
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
 
virtual QImage createThumbnailForFrame (qint32 w, qint32 h, int time, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio)
 
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)
 
virtual PropertyList sectionModelProperties () const
 
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 setSectionModelProperties (const PropertyList &properties)
 
virtual void setUserLocked (bool l)
 
void setUuid (const QUuid &id)
 
virtual void setVisible (bool visible, bool loading=false)
 
bool supportsLodMoves () 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 Member Functions inherited from KisIndirectPaintingSupport
bool hasTemporaryTarget () const
 
 KisIndirectPaintingSupport ()
 
void mergeToLayer (KisNodeSP layer, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID)
 
virtual void mergeToLayerThreaded (KisNodeSP layer, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID, QVector< KisRunnableStrokeJobData * > *jobs)
 
virtual void setCurrentColor (const KoColor &color)
 
void setTemporaryChannelFlags (const QBitArray &channelFlags)
 
void setTemporaryCompositeOp (const QString &id)
 
void setTemporaryOpacity (qreal o)
 
void setTemporarySelection (KisSelectionSP selection)
 
void setTemporaryTarget (KisPaintDeviceSP t)
 
void setupTemporaryPainter (KisPainter *painter) const
 
virtual bool supportsNonIndirectPainting () const
 
KisPaintDeviceSP temporaryTarget () const
 
FinalMergeSuspenderSP trySuspendFinalMerge ()
 
virtual ~KisIndirectPaintingSupport ()
 

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
 
- Public Types inherited from KisIndirectPaintingSupport
using FinalMergeSuspenderSP = QSharedPointer<FinalMergeSuspender>
 
- Signals inherited from KisNode
void sigNodeChangedInternal ()
 
- Signals inherited from KisBaseNode
void keyframeChannelAdded (KisKeyframeChannel *channel)
 
void opacityChanged (quint8 value)
 
- Public Attributes inherited from KisMask
QScopedPointer< QPoint > deferredSelectionOffset
 
KisCachedPaintDevice paintDeviceCache
 
KisAbstractProjectionPlaneSP projectionPlane
 
KisMaskq
 
KisSafeSelectionNodeProjectionStoreSP safeProjection
 
KisSelectionSP selection
 
- 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}
 
- Public Attributes inherited from KisIndirectPaintingSupport
QBitArray channelFlags
 
QString compositeOp
 
qreal compositeOpacity
 
bool finalMergeInProgress = true
 
QReadWriteLock lock
 
KisSelectionSP selection
 
KisPaintDeviceSP temporaryTarget
 
- Protected Types inherited from KisIndirectPaintingSupport
using WriteLockerSP = QSharedPointer<WriteLocker>
 
- Protected Member Functions inherited from KisMask
void apply (KisPaintDeviceSP projection, const QRect &applyRect, const QRect &needRect, PositionToFilthy maskPos, KisRenderPassFlags flags) const
 
void baseNodeChangedCallback () override
 
virtual void flattenSelectionProjection (KisSelectionSP selection, const QRect &dirtyRect) const
 
virtual void mergeInMaskInternal (KisPaintDeviceSP projection, KisSelectionSP effectiveSelection, const QRect &applyRect, const QRect &preparedNeedRect, PositionToFilthy maskPos, KisRenderPassFlags flags) const
 
KisKeyframeChannelrequestKeyframeChannel (const QString &id) override
 
bool supportsKeyframeChannel (const QString &id) override
 
- 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 void childNodeChanged (KisNodeSP changedChildNode)
 
virtual KisFrameChangeUpdateRecipe handleKeyframeChannelFrameAboutToBeRemovedImpl (const KisKeyframeChannel *channel, int time)
 
void notifyParentVisibilityChanged (bool value) override
 
KisBaseNodeSP parentCallback () const override
 
- Protected Member Functions inherited from KisBaseNode
void setSupportsLodMoves (bool value)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 
- Protected Member Functions inherited from KisIndirectPaintingSupport
void lockTemporaryTargetForWrite () const
 
void mergeToLayerImpl (KisPaintDeviceSP dst, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID, bool cleanResources, WriteLockerSP sharedWriteLock, QVector< KisRunnableStrokeJobData * > *jobs)
 
void releaseResources ()
 
QString temporaryCompositeOp () const
 
virtual void writeMergeData (KisPainter *painter, KisPaintDeviceSP src, const QRect &rc)
 

Detailed Description

A transparency mask is a single channel mask that applies a particular transparency to the layer the mask belongs to. It differs from an adjustment layer in that it only works on its parent layer, while adjustment layers work on all layers below it in its layer group.

XXX: Use KisConfig::useProjections() to enable/disable the caching of the projection.

Definition at line 24 of file kis_transparency_mask.h.

Constructor & Destructor Documentation

◆ KisTransparencyMask() [1/2]

KisTransparencyMask::KisTransparencyMask ( KisImageWSP image,
const QString & name )

Definition at line 22 of file kis_transparency_mask.cc.

24{
25}
KisEffectMask(KisImageWSP image, const QString &name)
KisImageWSP image
QString name() const

◆ KisTransparencyMask() [2/2]

KisTransparencyMask::KisTransparencyMask ( const KisTransparencyMask & rhs)

Definition at line 27 of file kis_transparency_mask.cc.

28 : KisEffectMask(rhs)
29{
30}

◆ ~KisTransparencyMask()

KisTransparencyMask::~KisTransparencyMask ( )
override

Definition at line 32 of file kis_transparency_mask.cc.

33{
34}

Member Function Documentation

◆ accept() [1/2]

bool KisTransparencyMask::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 91 of file kis_transparency_mask.cc.

92{
93 return v.visit(this);
94}
qreal v

References v.

◆ accept() [2/2]

void KisTransparencyMask::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 96 of file kis_transparency_mask.cc.

97{
98 return visitor.visit(this, undoAdapter);
99}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ changeRect()

QRect KisTransparencyMask::changeRect ( const QRect & rect,
PositionToFilthy pos = N_FILTHY ) const
overridevirtual
Returns
internal changeRect() of the node. Do not mix with
See also
projectionPlane()

Some filters will cause a change of pixels those are outside a requested rect. E.g. we change a rect of 2x2, then we want to apply a convolution filter with kernel 4x4 (changeRect is (2+2*3)x(2+2*3)=8x8) to that area. The rect that should be updated on the layer will be exactly 8x8. More than that the needRect for that update will be 14x14. See needRect.

Selection on transparency masks have no special meaning: They do crop both: change and need area

Reimplemented from KisMask.

Definition at line 63 of file kis_transparency_mask.cc.

64{
69 return KisMask::changeRect(rect, pos);
70}
QRect changeRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
Definition kis_mask.cc:386

References KisMask::changeRect().

◆ clone()

KisNodeSP KisTransparencyMask::clone ( ) const
inlineoverridevirtual

Implements KisNode.

Definition at line 34 of file kis_transparency_mask.h.

34 {
35 return KisNodeSP(new KisTransparencyMask(*this));
36 }
KisTransparencyMask(KisImageWSP image, const QString &name)
KisSharedPtr< KisNode > KisNodeSP
Definition kis_types.h:86

◆ decorateRect()

QRect KisTransparencyMask::decorateRect ( KisPaintDeviceSP & src,
KisPaintDeviceSP & dst,
const QRect & rc,
PositionToFilthy maskPos,
KisRenderPassFlags flags ) const
overridevirtual

Reimplemented from KisMask.

Definition at line 36 of file kis_transparency_mask.cc.

41{
42 Q_UNUSED(maskPos);
43 Q_UNUSED(flags);
44
45 if (src != dst) {
46 KisPainter::copyAreaOptimized(rc.topLeft(), src, dst, rc);
47 src->fill(rc, KoColor::createTransparent(src->colorSpace()));
48 }
49
50 return rc;
51}
static void copyAreaOptimized(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect)
static KoColor createTransparent(const KoColorSpace *cs)
Definition KoColor.cpp:681

References KisPainter::copyAreaOptimized(), and KoColor::createTransparent().

◆ exactBounds()

QRect KisTransparencyMask::exactBounds ( ) const
overridevirtual

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

Reimplemented from KisMask.

Definition at line 58 of file kis_transparency_mask.cc.

59{
60 return parent() ? parent()->exactBounds() : QRect();
61}
virtual QRect exactBounds() const
KisNodeWSP parent
Definition kis_node.cpp:86

References KisBaseNode::exactBounds(), and KisNode::parent.

◆ extent()

QRect KisTransparencyMask::extent ( ) const
overridevirtual

The extent and bounds of the mask are those of the selection inside

Reimplemented from KisMask.

Definition at line 53 of file kis_transparency_mask.cc.

54{
55 return parent() ? parent()->extent() : QRect();
56}
virtual QRect extent() const

References KisBaseNode::extent(), and KisNode::parent.

◆ icon()

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

Reimplemented from KisEffectMask.

Definition at line 86 of file kis_transparency_mask.cc.

87{
88 return KisIconUtils::loadIcon("transparencyMask");
89}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ needRect()

QRect KisTransparencyMask::needRect ( const QRect & rect,
PositionToFilthy pos = N_FILTHY ) const
overridevirtual
Returns
internal needRect() of the node. Do not mix with
See also
projectionPlane()

Some filters need pixels outside the current processing rect to compute the new value (for instance, convolution filters) See changeRect See accessRect

Selection on transparency masks have no special meaning: They do crop both: change and need area

Reimplemented from KisMask.

Definition at line 72 of file kis_transparency_mask.cc.

73{
78 return KisMask::needRect(rect, pos);
79}
QRect needRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
Definition kis_mask.cc:366

References KisMask::needRect().

◆ paintsOutsideSelection()

bool KisTransparencyMask::paintsOutsideSelection ( ) const
overridevirtual

Reimplemented from KisMask.

Definition at line 81 of file kis_transparency_mask.cc.

82{
83 return true;
84}

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