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

#include <kis_filter_mask.h>

+ Inheritance diagram for KisFilterMask:

Classes

struct  Private
 

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
 
 KisFilterMask (const KisFilterMask &rhs)
 
 KisFilterMask (KisImageWSP image, const QString &name=QString())
 
QRect needRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
void setFilter (KisFilterConfigurationSP filterConfig, bool checkCompareConfig=true) override
 
 ~KisFilterMask () 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
 
QRect changeRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
const KoColorSpacecolorSpace () const override
 
const KoCompositeOpcompositeOp () const override
 
QImage createThumbnail (qint32 w, qint32 h, Qt::AspectRatioMode aspectRatioMode=Qt::IgnoreAspectRatio) override
 
QRect exactBounds () const override
 
QRect extent () const 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)
 
QRect needRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
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
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
 
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 ()
 
- Public Member Functions inherited from KisNodeFilterInterface
virtual KisFilterConfigurationSP filter () const
 
 KisNodeFilterInterface (const KisNodeFilterInterface &rhs)
 
 KisNodeFilterInterface (KisFilterConfigurationSP filterConfig)
 
virtual void notifyColorSpaceChanged ()
 
virtual ~KisNodeFilterInterface ()
 

Private Member Functions

bool filterNeedsTransparentPixels () const
 

Private Attributes

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
 
- 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
 
virtual bool paintsOutsideSelection () 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

An filter mask is a single channel mask that applies a particular filter 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.

Definition at line 23 of file kis_filter_mask.h.

Constructor & Destructor Documentation

◆ KisFilterMask() [1/2]

KisFilterMask::KisFilterMask ( KisImageWSP image,
const QString & name = QString() )

Create an empty filter mask.

Definition at line 34 of file kis_filter_mask.cpp.

37 , m_d(new Private())
38{
40}
const QString COMPOSITE_COPY
KisEffectMask(KisImageWSP image, const QString &name)
QScopedPointer< Private > m_d
KisNodeFilterInterface(KisFilterConfigurationSP filterConfig)
KisImageWSP image
QString name() const
void setCompositeOpId(const QString &compositeOpId)

References COMPOSITE_COPY, and KisBaseNode::setCompositeOpId().

◆ KisFilterMask() [2/2]

KisFilterMask::KisFilterMask ( const KisFilterMask & rhs)

Definition at line 42 of file kis_filter_mask.cpp.

43 : KisEffectMask(rhs)
45 , m_d(new Private())
46{
47}

◆ ~KisFilterMask()

KisFilterMask::~KisFilterMask ( )
overridedefault

Member Function Documentation

◆ accept() [1/2]

bool KisFilterMask::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 131 of file kis_filter_mask.cpp.

132{
133 return v.visit(this);
134}
qreal v

References v.

◆ accept() [2/2]

void KisFilterMask::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 136 of file kis_filter_mask.cpp.

137{
138 return visitor.visit(this, undoAdapter);
139}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ changeRect()

QRect KisFilterMask::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.

FIXME: This check of the emptiness should be done on the higher/lower level

We can't paint outside a selection, that is why we call KisMask::changeRect to crop actual change area in the end

FIXME: Think over this solution Union of rects means that changeRect returns NOT the rect changed by this very layer, but an accumulated rect changed by all underlying layers. Just take into account and change documentation accordingly

Reimplemented from KisNode.

Definition at line 175 of file kis_filter_mask.cpp.

176{
181 if (rect.isEmpty()) return rect;
182
183 QRect filteredRect = rect;
184
185 KisFilterConfigurationSP filterConfig = filter();
186 if (filterConfig) {
187 KisNodeSP parent = this->parent();
188 const int lod = parent && parent->projection() ?
190
191 KisFilterSP filter = KisFilterRegistry::instance()->value(filterConfig->name());
192 filteredRect = filter->changedRect(rect, filterConfig.data(), lod);
193 }
194
199 filteredRect = KisMask::changeRect(filteredRect, pos);
200
208 return rect | filteredRect;
209}
virtual int currentLevelOfDetail() const =0
static KisFilterRegistry * instance()
virtual KisFilterConfigurationSP filter() const
KisDefaultBoundsBaseSP defaultBounds() const
const T value(const QString &id) const
virtual KisPaintDeviceSP projection() const =0
QRect changeRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
Definition kis_mask.cc:386
KisNodeWSP parent
Definition kis_node.cpp:86

References KisMask::changeRect(), KisDefaultBoundsBase::currentLevelOfDetail(), KisSharedPtr< T >::data(), KisPaintDevice::defaultBounds(), KisNodeFilterInterface::filter(), KisFilterRegistry::instance(), KisNode::parent, KisBaseNode::projection(), and KoGenericRegistry< T >::value().

◆ clone()

KisNodeSP KisFilterMask::clone ( ) const
inlineoverridevirtual

Implements KisNode.

Definition at line 39 of file kis_filter_mask.h.

39 {
40 return KisNodeSP(new KisFilterMask(*this));
41 }
KisFilterMask(KisImageWSP image, const QString &name=QString())
KisSharedPtr< KisNode > KisNodeSP
Definition kis_types.h:86

◆ decorateRect()

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

Reimplemented from KisMask.

Definition at line 91 of file kis_filter_mask.cpp.

96{
97 Q_UNUSED(maskPos);
98 Q_UNUSED(flags);
99
100 KisFilterConfigurationSP filterConfig = filter();
101
104 src != dst &&
105 "KisFilterMask::decorateRect: "
106 "src must be != dst, because we can't create transactions "
107 "during merge, as it breaks reentrancy",
108 rc);
109
110 if (!filterConfig) {
111 return QRect();
112 }
113
115 KisFilterRegistry::instance()->value(filterConfig->name());
116
117 if (!filter) {
118 warnKrita << "Could not retrieve filter \"" << filterConfig->name() << "\"";
119 return QRect();
120 }
121
123 this->busyProgressIndicator()->update();
124
125 filter->process(src, dst, 0, rc, filterConfig.data(), 0);
126
127 QRect r = filter->changedRect(rc, filterConfig.data(), dst->defaultBounds()->currentLevelOfDetail());
128 return r;
129}
void process(const KisPaintDeviceSP src, KisPaintDeviceSP dst, KisSelectionSP selection, const QRect &applyRect, const KisFilterConfigurationSP config, KoUpdater *progressUpdater=0) const
Definition kis_filter.cc:41
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129
#define KIS_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:97
#define warnKrita
Definition kis_debug.h:87
KisBusyProgressIndicator * busyProgressIndicator
Definition kis_node.cpp:90
KisNodeProgressProxy * nodeProgressProxy
Definition kis_node.cpp:89

References KisNode::busyProgressIndicator, KisDefaultBoundsBase::currentLevelOfDetail(), KisSharedPtr< T >::data(), KisPaintDevice::defaultBounds(), KisNodeFilterInterface::filter(), KisFilterRegistry::instance(), KIS_ASSERT_RECOVER_NOOP, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KisNode::nodeProgressProxy, KisFilter::process(), KisBusyProgressIndicator::update(), KoGenericRegistry< T >::value(), and warnKrita.

◆ exactBounds()

QRect KisFilterMask::exactBounds ( ) const
overridevirtual

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

Reimplemented from KisBaseNode.

Definition at line 158 of file kis_filter_mask.cpp.

159{
160 KisNodeSP parentNode = parent();
161
162 if (!parentNode) {
163 return {};
164 }
165
167
169 rect &= parentNode->exactBounds();
170 }
171
172 return rect;
173}
bool filterNeedsTransparentPixels() const
virtual QRect exactBounds() const

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

◆ extent()

QRect KisFilterMask::extent ( ) const
overridevirtual

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

Reimplemented from KisBaseNode.

Definition at line 141 of file kis_filter_mask.cpp.

142{
143 KisNodeSP parentNode = parent();
144
145 if (!parentNode) {
146 return {};
147 }
148
149 QRect rect = KisEffectMask::extent();
150
152 rect &= parentNode->extent();
153 }
154
155 return rect;
156}
virtual QRect extent() const

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

◆ filterNeedsTransparentPixels()

bool KisFilterMask::filterNeedsTransparentPixels ( ) const
private

Definition at line 56 of file kis_filter_mask.cpp.

57{
58 const KoColorSpace *cs = this->colorSpace();
59 if (!cs) return false;
60
61 QMutexLocker l(&m_d->transparentPixelsCacheLock);
62
63 if (m_d->needsTransparentPixelsCache) {
64 if (*m_d->needsTransparentPixelsCache->colorSpace != *cs) {
65 m_d->needsTransparentPixelsCache = std::nullopt;
66 } else {
67 return m_d->needsTransparentPixelsCache->value;
68 }
69 }
70
71 l.unlock();
72
73 KisFilterConfigurationSP filterConfig = filter();
74 if (!filterConfig) return false;
75
76 KisFilterSP filter = KisFilterRegistry::instance()->value(filterConfig->name());
77 const bool needsTransparentPixelsValue = filter->needsTransparentPixels(filterConfig, cs);
78
79 l.relock();
80
81 m_d->needsTransparentPixelsCache = {needsTransparentPixelsValue, cs};
82 return needsTransparentPixelsValue;
83}
const KoColorSpace * colorSpace() const override
Definition kis_mask.cc:135

References KisMask::colorSpace(), KisNodeFilterInterface::filter(), KisFilterRegistry::instance(), m_d, and KoGenericRegistry< T >::value().

◆ icon()

QIcon KisFilterMask::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 51 of file kis_filter_mask.cpp.

52{
53 return KisIconUtils::loadIcon("filterMask");
54}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ needRect()

QRect KisFilterMask::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

FIXME: This check of the emptiness should be done on the higher/lower level

If we need some additional pixels even outside of a selection for accurate layer filtering, we'll get them! And no KisMask::needRect will prevent us from doing this! ;) That's why simply we do not call KisMask::needRect here :)

Reimplemented from KisNode.

Definition at line 211 of file kis_filter_mask.cpp.

212{
213 Q_UNUSED(pos);
214
220 if(rect.isEmpty()) return rect;
221
222 KisFilterConfigurationSP filterConfig = filter();
223 if (!filterConfig) return rect;
224
225 KisNodeSP parent = this->parent();
226 const int lod = parent && parent->projection() ?
228
229 KisFilterSP filter = KisFilterRegistry::instance()->value(filterConfig->name());
230
237 return filter->neededRect(rect, filterConfig.data(), lod);
238}

References KisDefaultBoundsBase::currentLevelOfDetail(), KisSharedPtr< T >::data(), KisPaintDevice::defaultBounds(), KisNodeFilterInterface::filter(), KisFilterRegistry::instance(), KisNode::parent, KisBaseNode::projection(), and KoGenericRegistry< T >::value().

◆ setFilter()

void KisFilterMask::setFilter ( KisFilterConfigurationSP filterConfig,
bool checkCompareConfig = true )
overridevirtual

Sets the filter configuration for this node. The filter might differ from the filter that is currently set up on this node.

WARNING: the filterConfig becomes owned by the node right after you've set it. Don't try to access the configuration after you've associated it with the node.

Parameters
filterConfigthe new configuration object
checkCompareConfigif true, the update code will check whether the config is the same as the old config, and if so, do nothing. If false, the filter node will be updated always.

Reimplemented from KisNodeFilterInterface.

Definition at line 85 of file kis_filter_mask.cpp.

86{
87 KisNodeFilterInterface::setFilter(filterConfig, checkCompareConfig);
88 m_d->needsTransparentPixelsCache = std::nullopt;
89}
virtual void setFilter(KisFilterConfigurationSP filterConfig, bool checkCompareConfig=true)

References m_d, and KisNodeFilterInterface::setFilter().

Member Data Documentation

◆ m_d

QScopedPointer<Private> KisFilterMask::m_d
private

Definition at line 65 of file kis_filter_mask.h.


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