|
Krita Source Code Documentation
|
Describes base behaviour for selection base classes like KisAdjustmentLayer and KisGeneratorLayer. These classes should have a persistent selection that controls the area where filter/generators are applied. The area outside this selection is not affected by the layer. More...
#include <kis_selection_based_layer.h>
Inheritance diagram for KisSelectionBasedLayer:Public Slots | |
| KisLayer * | layer () |
| void | slotImageSizeChanged () |
Protected Member Functions | |
| void | copyOriginalToProjection (const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect &rect) const override |
| QRect | cropChangeRectBySelection (const QRect &rect) const |
| void | initSelection () |
| QRect | needRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override |
| KisKeyframeChannel * | requestKeyframeChannel (const QString &id) override |
| void | setUseSelectionInProjection (bool value) const |
| bool | supportsKeyframeChannel (const QString &id) override |
Protected Member Functions inherited from KisLayer | |
| virtual QRect | amortizedProjectionRectForCleanupInChangePass () const |
| QRect | applyMasks (const KisPaintDeviceSP source, KisPaintDeviceSP destination, const QRect &requestedRect, KisNodeSP filthyNode, KisNodeSP lastNode, KisRenderPassFlags flags) const |
| bool | canMergeAndKeepBlendOptions (KisLayerSP otherLayer) |
| QRect | changeRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override |
| void | childNodeChanged (KisNodeSP changedChildNode) override |
| virtual QRect | incomingChangeRect (const QRect &rect) const |
| QRect | masksChangeRect (const QList< KisEffectMaskSP > &masks, const QRect &requestedRect, bool &rectVariesFlag) const |
| QRect | masksNeedRect (const QList< KisEffectMaskSP > &masks, const QRect &changeRect, QStack< QRect > &applyRects, bool &rectVariesFlag) const |
| QRect | needRectForOriginal (const QRect &rect) const |
| virtual QRect | outgoingChangeRect (const QRect &rect) const |
| QList< KisEffectMaskSP > | searchEffectMasks (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) |
| 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) |
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< Property > | PropertyList |
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) |
Protected Types inherited from KisIndirectPaintingSupport | |
| using | WriteLockerSP = QSharedPointer<WriteLocker> |
Describes base behaviour for selection base classes like KisAdjustmentLayer and KisGeneratorLayer. These classes should have a persistent selection that controls the area where filter/generators are applied. The area outside this selection is not affected by the layer.
Definition at line 31 of file kis_selection_based_layer.cpp.
| KisSelectionBasedLayer::KisSelectionBasedLayer | ( | KisImageWSP | image, |
| const QString & | name, | ||
| KisSelectionSP | selection, | ||
| KisFilterConfigurationSP | filterConfig ) |
creates a new layer with the given selection. Note that the selection will be copied (with COW, though).
| image | the image to set this layer to |
| name | name of the layer |
| selection | is a mask used by the layer to know where to apply the filter/generator. |
Definition at line 44 of file kis_selection_based_layer.cpp.
References KisImage::colorSpace(), KisSharedPtr< T >::data(), KisBaseNode::image, initSelection(), m_d, selection, setInternalSelection(), slotImageSizeChanged(), and KisWeakSharedPtr< T >::toStrongRef().
| KisSelectionBasedLayer::KisSelectionBasedLayer | ( | const KisSelectionBasedLayer & | rhs | ) |
Definition at line 66 of file kis_selection_based_layer.cpp.
References m_d, and setInternalSelection().
|
override |
|
overridevirtual |
tells whether the @node can be a child of this layer
| node | to be connected node |
Implements KisNode.
Definition at line 117 of file kis_selection_based_layer.cpp.
|
overrideprotectedvirtual |
Layers can override this method to get some special behavior when copying data from original to projection, e.g. blend in indirect painting device. If you need to modify data outside rect, please also override outgoingChangeRect() method.
When we paint with a selection, the deselected areas will not be overwritten by copyAreaOptimized(), so we need to clear them beforehand
Reimplemented from KisLayer.
Definition at line 172 of file kis_selection_based_layer.cpp.
References KisPaintDevice::clear(), KisPainter::copyAreaOptimized(), fetchComposedInternalSelection(), m_d, original(), and KisLayer::projection().
|
overridevirtual |
copies the image and reformats it to thumbnail size and returns the new thumbnail image.
| w | width of the thumbnail to create |
| h | height of the thumbnail to create |
Reimplemented from KisLayer.
Definition at line 370 of file kis_selection_based_layer.cpp.
References KisPaintDevice::createThumbnail(), KoColorConversionTransformation::internalConversionFlags(), KoColorConversionTransformation::internalRenderingIntent(), internalSelection(), and original().
|
protected |
|
overridevirtual |
returns the exact bounds of where the actual data resides in this layer, taking selection into account
Reimplemented from KisLayer.
Definition at line 347 of file kis_selection_based_layer.cpp.
References KisImage::bounds(), KisPaintDevice::exactBounds(), KisBaseNode::image, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_d, KisIndirectPaintingSupport::temporaryTarget, and KisWeakSharedPtr< T >::toStrongRef().
|
overridevirtual |
gets an approximation of where the bounds on actual data are in this layer, taking selection into account
Reimplemented from KisLayer.
Definition at line 324 of file kis_selection_based_layer.cpp.
References KisImage::bounds(), KisPaintDevice::extent(), KisBaseNode::image, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_d, KisIndirectPaintingSupport::temporaryTarget, and KisWeakSharedPtr< T >::toStrongRef().
| KisSelectionSP KisSelectionBasedLayer::fetchComposedInternalSelection | ( | const QRect & | rect | ) | const |
When painted in indirect painting mode, the internal selection might not contain actual selection, because a part of it is stored on an indirect painting device. This method returns the merged copy of the real selection. The area in rect only is guaranteed to be prepared. The content of the rest of the selection is undefined.
WARNING: we don't try to clone the selection entirely, because it might be unsafe for shape selections.
TODO: make cloning of vector selections safe! See a comment in KisShapeSelection::clone().
Definition at line 143 of file kis_selection_based_layer.cpp.
References KisPainter::bitBlt(), KisPainter::copyAreaOptimized(), KisIndirectPaintingSupport::hasTemporaryTarget(), m_d, KisSelection::pixelSelection, KisIndirectPaintingSupport::setupTemporaryPainter(), and KisIndirectPaintingSupport::temporaryTarget.
|
protected |
Definition at line 83 of file kis_selection_based_layer.cpp.
References KisBaseNode::image, m_d, and toQShared().
| KisSelectionSP KisSelectionBasedLayer::internalSelection | ( | ) | const |
Returns the selection of the layer
Do not mix it with selection() which returns the currently active selection of the image
Definition at line 226 of file kis_selection_based_layer.cpp.
References m_d.
|
inlineslot |
gets this layer. Overridden function in KisIndirectPaintingSupport
Definition at line 194 of file kis_selection_based_layer.h.
|
overridevirtual |
Reimplemented from KisLayer.
Definition at line 133 of file kis_selection_based_layer.cpp.
References m_d.
|
overrideprotectedvirtual |
Some filters need pixels outside the current processing rect to compute the new value (for instance, convolution filters) See changeRect See accessRect
Reimplemented from KisNode.
Definition at line 198 of file kis_selection_based_layer.cpp.
|
overridevirtual |
Return the layer data before the effect masks have had their go at it.
Implements KisLayer.
Definition at line 123 of file kis_selection_based_layer.cpp.
References m_d.
|
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.
Implements KisBaseNode.
|
inline |
Definition at line 34 of file kis_selection_based_layer.cpp.
|
inline |
Definition at line 35 of file kis_selection_based_layer.cpp.
|
overrideprotectedvirtual |
Attempt to create the requested channel. Used internally by getKeyframeChannel. Subclasses should implement this method to catch any new channel types they support.
| id | channel to create |
Reimplemented from KisBaseNode.
Definition at line 294 of file kis_selection_based_layer.cpp.
References m_d, KisKeyframeChannel::Raster, KisBaseNode::requestKeyframeChannel(), and KisRasterKeyframeChannel::setFilenameSuffix().
|
virtual |
resets cached projection of lower layer to a new device
Reimplemented in KisGeneratorLayer.
Definition at line 204 of file kis_selection_based_layer.cpp.
References KisImage::colorSpace(), KisLayer::colorSpace(), KisBaseNode::image, m_d, and KisWeakSharedPtr< T >::toStrongRef().
|
overridevirtual |
Mark a layer as dirty. We can't use KisLayer's one as our extent() function doesn't fit for this
Reimplemented from KisNode.
Definition at line 314 of file kis_selection_based_layer.cpp.
References KisImage::bounds(), KisBaseNode::image, setDirty(), and KisWeakSharedPtr< T >::toStrongRef().
|
overridevirtual |
Set the image this layer belongs to.
Reimplemented from KisLayer.
Definition at line 104 of file kis_selection_based_layer.cpp.
References KisWeakSharedPtr< T >::data(), KisBaseNode::image, m_d, KisLayer::setImage(), and slotImageSizeChanged().
| void KisSelectionBasedLayer::setInternalSelection | ( | KisSelectionSP | selection | ) |
sets the selection of this layer to a copy of selection
| selection | the selection to set |
Sanity check for the case when the image is present
Definition at line 231 of file kis_selection_based_layer.cpp.
References KisNode::addKeyframeChannel(), KisImage::bounds(), KisSharedPtr< T >::data(), KisBaseNode::enableAnimation(), KisPaintDevice::framesInterface(), KisBaseNode::image, KisPaintDevice::keyframeChannel(), m_d, ppVar, selection, toQShared(), and KisWeakSharedPtr< T >::toStrongRef().
|
protected |
Sets if the selection should be used in copyOriginalToProjection() method.
Default value is 'true'. The descendants should override it to get desired behaviour.
Must be called only once in the child's constructor
Definition at line 138 of file kis_selection_based_layer.cpp.
|
overridevirtual |
sets this layer's y coordinate, taking selection into account
| x | x coordinate |
Reimplemented from KisLayer.
Definition at line 275 of file kis_selection_based_layer.cpp.
|
overridevirtual |
sets this layer's y coordinate, taking selection into account
| y | y coordinate |
Reimplemented from KisLayer.
Definition at line 282 of file kis_selection_based_layer.cpp.
|
slot |
Make sure exactBounds() of the selection got recalculated after the image changed
Definition at line 92 of file kis_selection_based_layer.cpp.
References m_d, and setDirty().
|
overrideprotectedvirtual |
Ideally, this function would be used to query for keyframe support before trying to create channels. The ability to query would help in cases such as animation curves where you might want to ask which channels it supports before allowing the user to add.
| id | queried channel |
Reimplemented from KisBaseNode.
Definition at line 305 of file kis_selection_based_layer.cpp.
References KisKeyframeChannel::Raster, and KisBaseNode::supportsKeyframeChannel().
|
overridevirtual |
Returns true if the node can be painted via KisPaintDevice. Notable exceptions are selection-based layers and masks.
Reimplemented from KisBaseNode.
Definition at line 289 of file kis_selection_based_layer.cpp.
References m_d.
|
overridevirtual |
Reimplemented from KisLayer.
Definition at line 382 of file kis_selection_based_layer.cpp.
References internalSelection(), original(), and KisPaintDevice::sequenceNumber().
|
overridevirtual |
|
overridevirtual |
| KisSignalAutoConnectionsStore KisSelectionBasedLayer::imageConnections |
Definition at line 40 of file kis_selection_based_layer.cpp.
|
private |
Definition at line 200 of file kis_selection_based_layer.h.
| KisPaintDeviceSP KisSelectionBasedLayer::paintDevice |
Definition at line 38 of file kis_selection_based_layer.cpp.
| KisSelectionSP KisSelectionBasedLayer::selection |
Definition at line 37 of file kis_selection_based_layer.cpp.
| bool KisSelectionBasedLayer::useSelectionInProjection |
Definition at line 39 of file kis_selection_based_layer.cpp.