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

#include <kis_transform_mask.h>

+ Inheritance diagram for KisTransformMask:

Signals

void sigInternalForceStaticImageUpdate ()
 
- Signals inherited from KisNode
void sigNodeChangedInternal ()
 
- Signals inherited from KisBaseNode
void keyframeChannelAdded (KisKeyframeChannel *channel)
 
void opacityChanged (quint8 value)
 

Public Member Functions

bool accept (KisNodeVisitor &v) override
 
void accept (KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override
 
KisPaintDeviceSP buildPreviewDevice ()
 
KisPaintDeviceSP buildSourcePreviewDevice ()
 
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
 
void forceUpdateTimedNode () override
 forceUpdateTimedNode forces the node to regenerate its project. The update might be asynchronous, so you should call image->waitForDone() after that.
 
KisPaintDeviceList getLodCapableDevices () const override
 
bool hasPendingTimedUpdates () const override
 
QIcon icon () const override
 
 KisTransformMask (const KisTransformMask &rhs)
 
 KisTransformMask (KisImageWSP image, const QString &name)
 
QRect needRect (const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
 
void overrideStaticCacheDevice (KisPaintDeviceSP device)
 
KisPaintDeviceSP paintDevice () const override
 
 Private (const Private &rhs)
 
 Private (KisImageSP image)
 
void recalculateStaticImage ()
 
void setImage (KisImageWSP image) override
 
void setTestingInterface (KisTransformMaskTestingInterface *interface)
 
void setTransformParams (KisTransformMaskParamsInterfaceSP params)
 
void setTransformParamsWithUndo (KisTransformMaskParamsInterfaceSP params, KUndo2Command *parentCommand)
 
void setX (qint32 x) override
 
void setY (qint32 y) override
 
QRect sourceDataBounds () const
 
bool staticImageCacheIsValid () const
 
void syncLodCache () override
 
KisTransformMaskTestingInterfacetestingInterface () const
 
void threadSafeForceStaticImageUpdate ()
 
void threadSafeForceStaticImageUpdate (const QRect &extraUpdateRect)
 
KisTransformMaskParamsInterfaceSP transformParams () const
 
qint32 x () const override
 
qint32 y () const override
 
 ~KisTransformMask () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- 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
 
 Private (KisMask *_q)
 
KisPaintDeviceSP projection () const override
 
KisAbstractProjectionPlaneSP projectionPlane () const override
 
void select (const QRect &rc, quint8 selectedness=MAX_SELECTED)
 
KisSelectionSP selection () const
 
void setSelection (KisSelectionSP selection)
 
bool supportsLodPainting () const override
 
void testingInitSelection (const QRect &rect, KisLayerSP parentLayer)
 
int thumbnailSeqNo () const override
 
 ~KisMask () override
 
- 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
 
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)
 
 ~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 KisDelayedUpdateNodeInterface
virtual ~KisDelayedUpdateNodeInterface ()
 

Public Attributes

AccumulatedRectStorage forcedStaticUpdateExtraUpdateRect
 
qreal offBoundsReadArea
 
KisLodCapableLayerOffset offset
 
KisAnimatedTransformParamsHolderInterfaceSP paramsHolder
 
bool recalculatingStaticImage
 
StaticCacheStorage staticCache
 
QScopedPointer< KisTransformMaskTestingInterfacetestingInterface
 
KisThreadSafeSignalCompressor updateSignalCompressor
 
KisPerspectiveTransformWorker worker
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- Public Attributes inherited from KisMask
QScopedPointer< QPoint > deferredSelectionOffset
 
KisCachedPaintDevice paintDeviceCache
 
KisAbstractProjectionPlaneSP projectionPlane
 
KisMaskq
 
KisSafeSelectionNodeProjectionStoreSP safeProjection
 
KisSelectionSP selection
 
- 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 Member Functions

KisKeyframeChannelrequestKeyframeChannel (const QString &id) override
 
bool supportsKeyframeChannel (const QString &id) override
 
- 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
 
- 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)
 

Private Slots

void slotDelayedStaticUpdate ()
 
void slotInternalForceStaticImageUpdate ()
 

Private Member Functions

void forceStartAsyncRegenerationJob ()
 
void startAsyncRegenerationJob ()
 

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
 
- Public Types inherited from KisIndirectPaintingSupport
using FinalMergeSuspenderSP = QSharedPointer<FinalMergeSuspender>
 
- Protected Types inherited from KisIndirectPaintingSupport
using WriteLockerSP = QSharedPointer<WriteLocker>
 

Detailed Description

Transform a layer according to a matrix transform

Definition at line 156 of file kis_transform_mask.cpp.

Constructor & Destructor Documentation

◆ KisTransformMask() [1/2]

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

Create an empty transform mask.

Definition at line 195 of file kis_transform_mask.cpp.

197 m_d(new Private(image))
198{
199 connect(&m_d->updateSignalCompressor, SIGNAL(timeout()), SLOT(slotDelayedStaticUpdate()));
201 m_d->offBoundsReadArea = KisImageConfig(true).transformMaskOffBoundsReadArea();
202 setSupportsLodMoves(false);
203}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisEffectMask(KisImageWSP image, const QString &name)
qreal transformMaskOffBoundsReadArea() const
void setSupportsLodMoves(bool value)
KisImageWSP image
QString name() const
void sigInternalForceStaticImageUpdate()
void slotInternalForceStaticImageUpdate()
const QScopedPointer< Private > m_d

References connect(), m_d, KisBaseNode::setSupportsLodMoves(), sigInternalForceStaticImageUpdate(), slotDelayedStaticUpdate(), slotInternalForceStaticImageUpdate(), and KisImageConfig::transformMaskOffBoundsReadArea().

◆ ~KisTransformMask()

KisTransformMask::~KisTransformMask ( )
override

Definition at line 205 of file kis_transform_mask.cpp.

206{
207}

◆ KisTransformMask() [2/2]

KisTransformMask::KisTransformMask ( const KisTransformMask & rhs)

The channels has already been cloned inside the params object, just relink them to the node

Definition at line 209 of file kis_transform_mask.cpp.

210 : KisEffectMask(rhs),
211 m_d(new Private(*rhs.m_d))
212{
213 connect(&m_d->updateSignalCompressor, SIGNAL(timeout()), SLOT(slotDelayedStaticUpdate()));
214
215
229
230 Q_FOREACH (const QString &id, ids) {
231 KisKeyframeChannel *channel = m_d->paramsHolder->getKeyframeChannel(id);
232 if (channel) {
233 addKeyframeChannel(channel);
234 }
235 }
236}
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
static const KoID RotationY
static const KoID ScaleY
static const KoID RotationZ
static const KoID ScaleX
static const KoID RotationX
static const KoID PositionX
static const KoID PositionY
static const KoID ShearX
static const KoID ShearY
QString id() const
Definition KoID.cpp:63
void addKeyframeChannel(KisKeyframeChannel *channel) override
Definition kis_node.cpp:351

References KisNode::addKeyframeChannel(), connect(), KoID::id(), m_d, KisKeyframeChannel::PositionX, KisKeyframeChannel::PositionY, KisKeyframeChannel::RotationX, KisKeyframeChannel::RotationY, KisKeyframeChannel::RotationZ, KisKeyframeChannel::ScaleX, KisKeyframeChannel::ScaleY, KisKeyframeChannel::ShearX, KisKeyframeChannel::ShearY, and slotDelayedStaticUpdate().

Member Function Documentation

◆ accept() [1/2]

bool KisTransformMask::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 540 of file kis_transform_mask.cpp.

541{
542 return v.visit(this);
543}
qreal v

References v.

◆ accept() [2/2]

void KisTransformMask::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 545 of file kis_transform_mask.cpp.

546{
547 return visitor.visit(this, undoAdapter);
548}
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0

References KisProcessingVisitor::visit().

◆ buildPreviewDevice()

KisPaintDeviceSP KisTransformMask::buildPreviewDevice ( )

Note: this function must be called from within the scheduler's context. We are accessing parent's updateProjection(), which is not entirely safe. The calling job must ensure it is the only job running.

Definition at line 317 of file kis_transform_mask.cpp.

318{
326 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
327 KIS_ASSERT_RECOVER(parentLayer) { return new KisPaintDevice(colorSpace()); }
328
329 KisPaintDeviceSP device =
330 new KisPaintDevice(parentLayer->original()->colorSpace());
331 device->setDefaultBounds(parentLayer->original()->defaultBounds());
332
333 QRect requestedRect = parentLayer->original()->exactBounds();
334 parentLayer->buildProjectionUpToNode(device, this, requestedRect);
335
336 return device;
337}
void setDefaultBounds(KisDefaultBoundsBaseSP bounds)
QRect exactBounds() const
const KoColorSpace * colorSpace() const
KisDefaultBoundsBaseSP defaultBounds() const
#define KIS_ASSERT_RECOVER(cond)
Definition kis_assert.h:55
void buildProjectionUpToNode(KisPaintDeviceSP projection, KisNodeSP lastNode, const QRect &rect)
Definition kis_layer.cc:782
KisPaintDeviceSP original() const override=0
const KoColorSpace * colorSpace() const override
Definition kis_mask.cc:135
KisNodeWSP parent
Definition kis_node.cpp:86

References KisLayer::buildProjectionUpToNode(), KisPaintDevice::colorSpace(), KisMask::colorSpace(), KisPaintDevice::defaultBounds(), KisPaintDevice::exactBounds(), KIS_ASSERT_RECOVER, KisLayer::original(), KisNode::parent, and KisPaintDevice::setDefaultBounds().

◆ buildSourcePreviewDevice()

KisPaintDeviceSP KisTransformMask::buildSourcePreviewDevice ( )

Note: this function must be called from within the scheduler's context. We are accessing parent's updateProjection(), which is not entirely safe. The calling job must ensure it is the only job running.

Definition at line 339 of file kis_transform_mask.cpp.

340{
348 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
349 KIS_ASSERT_RECOVER(parentLayer) { return new KisPaintDevice(colorSpace()); }
350
351 KisPaintDeviceSP device =
352 new KisPaintDevice(parentLayer->original()->colorSpace());
353 device->setDefaultBounds(parentLayer->original()->defaultBounds());
354
355 QRect requestedRect = parentLayer->original()->exactBounds();
356
358 if (prevSibling) {
359 parentLayer->buildProjectionUpToNode(device, prevSibling, requestedRect);
360 } else {
361 requestedRect = parentLayer->outgoingChangeRect(requestedRect);
362 parentLayer->copyOriginalToProjection(parentLayer->original(), device, requestedRect);
363 }
364
365 return device;
366}
virtual QRect outgoingChangeRect(const QRect &rect) const
Definition kis_layer.cc:908
virtual void copyOriginalToProjection(const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect &rect) const
Definition kis_layer.cc:801
KisNodeSP prevSibling() const
Definition kis_node.cpp:402

References KisLayer::buildProjectionUpToNode(), KisPaintDevice::colorSpace(), KisMask::colorSpace(), KisLayer::copyOriginalToProjection(), KisPaintDevice::defaultBounds(), KisPaintDevice::exactBounds(), KIS_ASSERT_RECOVER, KisLayer::original(), KisLayer::outgoingChangeRect(), KisNode::parent, KisNode::prevSibling(), and KisPaintDevice::setDefaultBounds().

◆ changeRect()

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

Reimplemented from KisMask.

Definition at line 564 of file kis_transform_mask.cpp.

565{
566 Q_UNUSED(pos);
567
572 if (rect.isEmpty()) return rect;
573
574 KisTransformMaskParamsInterfaceSP params = m_d->paramsHolder->bakeIntoParams();
575
576 QRect changeRect = rect;
577
578 if (params->isAffine()) {
579 QRect bounds;
580 QRect interestRect;
581 KisNodeSP parentNode = parent();
582
583 if (parentNode) {
584 bounds = parentNode->original()->defaultBounds()->bounds();
585 interestRect = calculateInterestRect(parentNode);
586 } else {
587 bounds = QRect(0,0,777,777);
588 interestRect = QRect(0,0,888,888);
589 warnKrita << "WARNING: transform mask has no parent (change rect)."
590 << "Cannot run safe transformations."
591 << "Will limit bounds to" << ppVar(bounds);
592 }
593
594 const QRect limitingRect = KisAlgebra2D::blowRect(bounds, m_d->offBoundsReadArea);
595
596 KisSafeTransform transform(params->finalAffineTransform(), limitingRect, interestRect);
597 changeRect = transform.mapRectForward(rect);
598 } else {
599 changeRect = params->nonAffineChangeRect(rect);
600 }
601
602 return changeRect;
603}
virtual QRect bounds() const =0
#define bounds(x, a, b)
#define warnKrita
Definition kis_debug.h:87
#define ppVar(var)
Definition kis_debug.h:155
Rect blowRect(const Rect &rect, qreal coeff)
virtual KisPaintDeviceSP original() const =0
QRect changeRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const override

References KisAlgebra2D::blowRect(), KisDefaultBoundsBase::bounds(), bounds, changeRect(), KisPaintDevice::defaultBounds(), m_d, KisSafeTransform::mapRectForward(), KisBaseNode::original(), KisNode::parent, ppVar, and warnKrita.

◆ clone()

KisNodeSP KisTransformMask::clone ( ) const
inlineoverridevirtual

Implements KisNode.

Definition at line 36 of file kis_transform_mask.h.

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

◆ decorateRect()

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

We shouldn't reset or use the static image when rendering the animation frames.

TODO: implement proper high-quality rendering for animation frames

clone layers may fetch data outside image bounds, that should never cause async refresh, since it will cause an infinite loop

Reimplemented from KisMask.

Definition at line 433 of file kis_transform_mask.cpp.

438{
439 Q_ASSERT_X(src != dst, "KisTransformMask::decorateRect",
440 "src must be != dst, because we can't create transactions "
441 "during merge, as it breaks reentrancy");
442
443 KisTransformMaskParamsInterfaceSP params = m_d->paramsHolder->bakeIntoParams();
444
445 if (params->isHidden()) return rc;
447 maskPos == N_ABOVE_FILTHY ||
448 maskPos == N_BELOW_FILTHY);
449
456 if (m_d->paramsHolder->defaultBounds()->externalFrameActive()) {
457
458 // no preview for non-affine transforms currently...
459 if (params->isAffine()) {
460 m_d->worker.setForceSubPixelTranslation(m_d->paramsHolder->isAnimated());
461 m_d->worker.setForwardTransform(params->finalAffineTransform());
462 m_d->worker.runPartialDst(src, dst, rc);
463
464#ifdef DEBUG_RENDERING
465 qDebug() << "Partial for external frame" << name() << ppVar(src->exactBounds()) << ppVar(src->extent()) << ppVar(dst->exactBounds()) << ppVar(dst->extent()) << ppVar(rc);
466 KIS_DUMP_DEVICE_2(src, DUMP_RECT, "partial_ext_src", "dd");
467 KIS_DUMP_DEVICE_2(dst, DUMP_RECT, "partial_ext_dst", "dd");
468#endif /* DEBUG_RENDERING */
469 }
470
471 return rc;
472 }
473
474 if (!m_d->staticCache.isCacheOverridden() &&
475 !m_d->recalculatingStaticImage &&
476 (maskPos == N_FILTHY || maskPos == N_ABOVE_FILTHY ||
477 !m_d->staticCache.isCacheValid(params)) &&
478
483
484 if (m_d->testingInterface) {
485 m_d->testingInterface->notifyDecorateRectTriggeredStaticImageUpdate();
486 }
487
488 m_d->staticCache.invalidateDeviceCache();
489 m_d->updateSignalCompressor.start();
490 }
491
492 if (m_d->recalculatingStaticImage) {
493 KIS_SAFE_ASSERT_RECOVER_NOOP(!m_d->staticCache.isCacheValid(params));
494
495 KisPaintDeviceSP staticCacheDevice = m_d->staticCache.device();
496
497 staticCacheDevice->clear();
498 params->transformDevice(const_cast<KisTransformMask*>(this), src,
499 staticCacheDevice, m_d->paramsHolder->isAnimated());
500 QRect updatedRect = staticCacheDevice->extent();
501 KisPainter::copyAreaOptimized(updatedRect.topLeft(), staticCacheDevice, dst, updatedRect);
502
503 m_d->staticCache.setDeviceCacheValid(params);
504
505#ifdef DEBUG_RENDERING
506 qDebug() << "Recalculate" << name() << ppVar(src->exactBounds()) << ppVar(dst->exactBounds()) << ppVar(rc);
507 KIS_DUMP_DEVICE_2(src, DUMP_RECT, "recalc_src", "dd");
508 KIS_DUMP_DEVICE_2(dst, DUMP_RECT, "recalc_dst", "dd");
509#endif /* DEBUG_RENDERING */
510
511 // Note: overridden cache is **always** valid
512 } else if (params->isAffine() && !m_d->staticCache.isCacheValid(params)) {
513 m_d->worker.setForceSubPixelTranslation(m_d->paramsHolder->isAnimated());
514 m_d->worker.setForwardTransform(params->finalAffineTransform());
515 m_d->worker.runPartialDst(src, dst, rc);
516
517#ifdef DEBUG_RENDERING
518 qDebug() << "Partial" << name() << ppVar(src->exactBounds()) << ppVar(src->extent()) << ppVar(dst->exactBounds()) << ppVar(dst->extent()) << ppVar(rc);
519 KIS_DUMP_DEVICE_2(src, DUMP_RECT, "partial_src", "dd");
520 KIS_DUMP_DEVICE_2(dst, DUMP_RECT, "partial_dst", "dd");
521#endif /* DEBUG_RENDERING */
522
523 } else if (m_d->staticCache.isCacheValid(params)) {
524 KisPainter::copyAreaOptimized(rc.topLeft(), m_d->staticCache.device(), dst, rc);
525
526#ifdef DEBUG_RENDERING
527 qDebug() << "Fetch" << name() << ppVar(src->exactBounds()) << ppVar(dst->exactBounds()) << ppVar(rc);
528 KIS_DUMP_DEVICE_2(src, DUMP_RECT, "fetch_src", "dd");
529 KIS_DUMP_DEVICE_2(dst, DUMP_RECT, "fetch_dst", "dd");
530#endif /* DEBUG_RENDERING */
531
532 }
533
535 this->busyProgressIndicator()->update();
536
537 return rc;
538}
virtual void clear()
QRect extent() const
static void copyAreaOptimized(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect)
#define KIS_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:97
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
#define KIS_DUMP_DEVICE_2(device, rc, suffix, prefix)
KisBusyProgressIndicator * busyProgressIndicator
Definition kis_node.cpp:90
@ N_ABOVE_FILTHY
Definition kis_node.h:59
@ N_FILTHY
Definition kis_node.h:61
@ N_BELOW_FILTHY
Definition kis_node.h:62
KisAnimatedTransformParamsHolderInterfaceSP paramsHolder

References KisNode::busyProgressIndicator, KisPaintDevice::clear(), KisPainter::copyAreaOptimized(), KisPaintDevice::exactBounds(), KisPaintDevice::extent(), KIS_ASSERT_RECOVER_NOOP, KIS_DUMP_DEVICE_2, KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisNode::N_ABOVE_FILTHY, KisNode::N_BELOW_FILTHY, KisNode::N_FILTHY, KisBaseNode::name(), NoTransformMaskUpdates, ppVar, and KisBusyProgressIndicator::update().

◆ exactBounds()

QRect KisTransformMask::exactBounds ( ) const
overridevirtual

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

Reimplemented from KisMask.

Definition at line 669 of file kis_transform_mask.cpp.

670{
671 QRect existentProjection;
672 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
673 if (parentLayer) {
674 existentProjection = parentLayer->projection()->exactBounds();
675
676 /* Take into account multiple keyframes... */
677 if (parentLayer->original() && parentLayer->original()->defaultBounds() && parentLayer->original()->keyframeChannel()) {
678 Q_FOREACH( const int& time, parentLayer->original()->keyframeChannel()->allKeyframeTimes() ) {
679 KisRasterKeyframeSP keyframe = parentLayer->original()->keyframeChannel()->keyframeAt<KisRasterKeyframe>(time);
680 existentProjection |= keyframe->contentBounds();
681 }
682 }
683 }
684
685 if (isAnimated()) {
686 existentProjection |= changeRect(image()->bounds());
687 }
688
689 return changeRect(sourceDataBounds()) | existentProjection;
690}
QSet< int > allKeyframeTimes() const
Get a set of all integer times that map to a keyframe.
KisKeyframeSP keyframeAt(int time) const
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
KisRasterKeyframeChannel * keyframeChannel() const
The KisRasterKeyframe class is a concrete subclass of KisKeyframe that wraps a physical raster image ...
bool isAnimated() const
KisPaintDeviceSP projection() const override
Definition kis_layer.cc:820
QRect sourceDataBounds() const

References KisKeyframeChannel::allKeyframeTimes(), bounds, changeRect(), KisPaintDevice::defaultBounds(), KisPaintDevice::exactBounds(), KisBaseNode::image, KisBaseNode::isAnimated(), KisKeyframeChannel::keyframeAt(), KisPaintDevice::keyframeChannel(), KisLayer::original(), KisNode::parent, KisLayer::projection(), and sourceDataBounds().

◆ extent()

QRect KisTransformMask::extent ( ) const
overridevirtual

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

Reimplemented from KisMask.

Definition at line 654 of file kis_transform_mask.cpp.

655{
656 QRect rc = KisMask::extent();
657
658 QRect partialChangeRect;
659 QRect existentProjection;
660 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
661 if (parentLayer) {
662 partialChangeRect = parentLayer->partialChangeRect(const_cast<KisTransformMask*>(this), rc);
663 existentProjection = parentLayer->projection()->extent();
664 }
665
666 return changeRect(partialChangeRect) | existentProjection;
667}
QRect partialChangeRect(KisNodeSP lastNode, const QRect &rect)
Definition kis_layer.cc:769
QRect extent() const override
Definition kis_mask.cc:391

References changeRect(), KisPaintDevice::extent(), KisMask::extent(), KisNode::parent, KisLayer::partialChangeRect(), and KisLayer::projection().

◆ forceStartAsyncRegenerationJob()

void KisTransformMask::forceStartAsyncRegenerationJob ( )
private

Definition at line 279 of file kis_transform_mask.cpp.

280{
281 m_d->staticCache.invalidateDeviceCache();
282 m_d->updateSignalCompressor.stop();
284}

References m_d, and startAsyncRegenerationJob().

◆ forceUpdateTimedNode()

void KisTransformMask::forceUpdateTimedNode ( )
overridevirtual

forceUpdateTimedNode forces the node to regenerate its project. The update might be asynchronous, so you should call image->waitForDone() after that.

When flattening the layer with animated transform mask we should actually rerender the static image

Implements KisDelayedUpdateNodeInterface.

Definition at line 745 of file kis_transform_mask.cpp.

746{
747 if (m_d->testingInterface) {
748 m_d->testingInterface->notifyForceUpdateTimedNode();
749 }
750
756 !m_d->staticCache.isCacheValid(m_d->paramsHolder->bakeIntoParams())) {
757
759 }
760}
bool hasPendingTimedUpdates() const override

References forceStartAsyncRegenerationJob(), hasPendingTimedUpdates(), and m_d.

◆ getLodCapableDevices()

KisPaintDeviceList KisTransformMask::getLodCapableDevices ( ) const
overridevirtual

Reimplemented from KisNode.

Definition at line 795 of file kis_transform_mask.cpp.

796{
797 KisPaintDeviceList devices;
799 if (m_d->staticCache.device()) {
800 devices << m_d->staticCache.device();
801 }
802 return devices;
803}
virtual KisPaintDeviceList getLodCapableDevices() const
Definition kis_node.cpp:682

References KisNode::getLodCapableDevices(), and m_d.

◆ hasPendingTimedUpdates()

bool KisTransformMask::hasPendingTimedUpdates ( ) const
overridevirtual
Returns
true if forceUpdateTimedNode() is going to produce any real updates, that is the node has any updates still pending

Implements KisDelayedUpdateNodeInterface.

Definition at line 762 of file kis_transform_mask.cpp.

763{
764 return m_d->updateSignalCompressor.isActive();
765}

References m_d.

◆ icon()

QIcon KisTransformMask::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 243 of file kis_transform_mask.cpp.

244{
245 return KisIconUtils::loadIcon("transformMask");
246}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ needRect()

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

When sampling affine transformations we use KisRandomSubAccessor, which uses bilinear interpolation for calculating pixels. Therefore, we need to extend the sides of the need rect by one pixel.

Reimplemented from KisMask.

Definition at line 605 of file kis_transform_mask.cpp.

606{
607 Q_UNUSED(pos);
608
613 if (rect.isEmpty()) return rect;
614
615 KisTransformMaskParamsInterfaceSP params = m_d->paramsHolder->bakeIntoParams();
616
617 QRect bounds;
618 QRect interestRect;
619 KisNodeSP parentNode = parent();
620
621 if (parentNode) {
622 bounds = parentNode->original()->defaultBounds()->bounds();
623 interestRect = calculateInterestRect(parentNode);
624 } else {
625 bounds = QRect(0,0,777,777);
626 interestRect = QRect(0,0,888,888);
627 warnKrita << "WARNING: transform mask has no parent (need rect)."
628 << "Cannot run safe transformations."
629 << "Will limit bounds to" << ppVar(bounds);
630 }
631
632 QRect needRect = rect;
633
634 if (params->isAffine()) {
635 const QRect limitingRect = KisAlgebra2D::blowRect(bounds, m_d->offBoundsReadArea);
636
637 KisSafeTransform transform(params->finalAffineTransform(), limitingRect, interestRect);
638 needRect = transform.mapRectBackward(rect);
639
646
647 } else {
648 needRect = params->nonAffineNeedRect(rect, interestRect);
649 }
650
651 return needRect;
652}
T kisGrowRect(const T &rect, U offset)
Definition kis_global.h:186
QRect needRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const override

References KisAlgebra2D::blowRect(), KisDefaultBoundsBase::bounds(), bounds, KisPaintDevice::defaultBounds(), kisGrowRect(), m_d, KisSafeTransform::mapRectBackward(), needRect(), KisBaseNode::original(), KisNode::parent, ppVar, and warnKrita.

◆ overrideStaticCacheDevice()

void KisTransformMask::overrideStaticCacheDevice ( KisPaintDeviceSP device)

Transform Tool may override mask's device for the sake of in-stack preview

Definition at line 368 of file kis_transform_mask.cpp.

369{
370 // TODO: make sure the device is allocated
371 m_d->staticCache.overrideStaticCacheDevice(device);
372}

References m_d.

◆ paintDevice()

KisPaintDeviceSP KisTransformMask::paintDevice ( ) const
overridevirtual
Returns
the selection: if you paint on mask, you paint on the selections

Reimplemented from KisMask.

Definition at line 238 of file kis_transform_mask.cpp.

239{
240 return 0;
241}

◆ Private() [1/2]

KisTransformMask::Private ( const Private & rhs)
inline

Definition at line 168 of file kis_transform_mask.cpp.

169 : worker(rhs.worker),
170 paramsHolder(rhs.paramsHolder->clone()),
171 recalculatingStaticImage(rhs.recalculatingStaticImage),
172 offset(rhs.offset),
174 offBoundsReadArea(rhs.offBoundsReadArea)
175 {
176 }
#define UPDATE_DELAY
KisPerspectiveTransformWorker worker
KisLodCapableLayerOffset offset
KisThreadSafeSignalCompressor updateSignalCompressor

◆ Private() [2/2]

KisTransformMask::Private ( KisImageSP image)
inline

◆ recalculateStaticImage()

void KisTransformMask::recalculateStaticImage ( )

Note: this function must be called from within the scheduler's context. We are accessing parent's updateProjection(), which is not entirely safe.

updateProjection() is assuming that the requestedRect takes into account all the change rects of all the masks. Usually, this work is done by the walkers.

NOTE: we should use layer's exact bounds, not its original paint device's exact bounds; it is necessary because the layer may have onion skins, which are a part of layer's bounds.

Here we use updateProjection() to regenerate the projection of the layer and after that a special update call (no-filthy) will be issued to pass the changed further through the stack.

Definition at line 379 of file kis_transform_mask.cpp.

380{
381 if (m_d->testingInterface) {
382 m_d->testingInterface->notifyRecalculateStaticImage();
383 }
384
391 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
393
394 // It might happen that the mask became invisible in the meantime
395 // and the projection has become disabled. That mush be "impossible"
396 // situation, hence assert.
397 KIS_SAFE_ASSERT_RECOVER_RETURN(parentLayer->projection() != parentLayer->paintDevice());
398
399 m_d->staticCache.lazyAllocateStaticCache(parentLayer->original()->colorSpace(),
400 parentLayer->original()->defaultBounds());
401
402 m_d->recalculatingStaticImage = true;
412 QRect requestedRect =
413 parentLayer->changeRect(parentLayer->exactBounds());
414
415 const QRect bounds = parentLayer->original()->defaultBounds()->bounds();
416 const QRect limitingRect = KisAlgebra2D::blowRect(bounds, m_d->offBoundsReadArea);
417
418 requestedRect &= limitingRect;
419
420 // force reset parent layer's projection, because we might have changed
421 // our mask parameters and going to write to some other area
422 parentLayer->projection()->clear();
423
429 parentLayer->updateProjection(requestedRect, this, KisRenderPassFlag::NoTransformMaskUpdates);
430 m_d->recalculatingStaticImage = false;
431}
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
virtual KisPaintDeviceSP paintDevice() const =0
QRect exactBounds() const override
QRect updateProjection(const QRect &rect, KisNodeSP filthyNode, KisRenderPassFlags flags)
Definition kis_layer.cc:747
QRect changeRect(const QRect &rect, PositionToFilthy pos=N_FILTHY) const override
Definition kis_layer.cc:859

References KisAlgebra2D::blowRect(), KisDefaultBoundsBase::bounds(), bounds, KisLayer::changeRect(), KisPaintDevice::clear(), KisPaintDevice::colorSpace(), KisPaintDevice::defaultBounds(), KisLayer::exactBounds(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, NoTransformMaskUpdates, KisLayer::original(), KisBaseNode::paintDevice(), KisNode::parent, KisLayer::projection(), and KisLayer::updateProjection().

◆ requestKeyframeChannel()

KisKeyframeChannel * KisTransformMask::requestKeyframeChannel ( const QString & id)
overrideprotectedvirtual

Attempt to create the requested channel. Used internally by getKeyframeChannel. Subclasses should implement this method to catch any new channel types they support.

Parameters
idchannel to create
Returns
newly created channel or null

Reimplemented from KisMask.

Definition at line 815 of file kis_transform_mask.cpp.

816{
817 if (id == KisKeyframeChannel::PositionX.id() ||
819 id == KisKeyframeChannel::ScaleX.id() ||
820 id == KisKeyframeChannel::ScaleY.id() ||
821 id == KisKeyframeChannel::ShearX.id() ||
822 id == KisKeyframeChannel::ShearY.id() ||
826
827 KisKeyframeChannel *channel = m_d->paramsHolder->requestKeyframeChannel(id);
829 return channel;
830 }
831
833}
virtual KisKeyframeChannel * requestKeyframeChannel(const QString &id)

References KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisKeyframeChannel::PositionX, KisKeyframeChannel::PositionY, KisBaseNode::requestKeyframeChannel(), KisKeyframeChannel::RotationX, KisKeyframeChannel::RotationY, KisKeyframeChannel::RotationZ, KisKeyframeChannel::ScaleX, KisKeyframeChannel::ScaleY, KisKeyframeChannel::ShearX, and KisKeyframeChannel::ShearY.

◆ setImage()

void KisTransformMask::setImage ( KisImageWSP image)
overridevirtual

Reimplemented from KisMask.

Definition at line 708 of file kis_transform_mask.cpp.

709{
710 m_d->paramsHolder->setDefaultBounds(new KisDefaultBounds(image));
711 m_d->offset.setDefaultBounds(new KisDefaultBounds(image));
713}
virtual void setImage(KisImageWSP image)

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

◆ setTestingInterface()

void KisTransformMask::setTestingInterface ( KisTransformMaskTestingInterface * interface)

Definition at line 805 of file kis_transform_mask.cpp.

806{
807 m_d->testingInterface.reset(interface);
808}

References m_d.

◆ setTransformParams()

void KisTransformMask::setTransformParams ( KisTransformMaskParamsInterfaceSP params)

Definition at line 255 of file kis_transform_mask.cpp.

256{
257 KUndo2Command todo_REMOVE;
258 setTransformParamsWithUndo(params, &todo_REMOVE);
259 todo_REMOVE.redo();
260
261 m_d->staticCache.invalidateDeviceCache();
262 m_d->updateSignalCompressor.start();
263}
virtual void redo()
void setTransformParamsWithUndo(KisTransformMaskParamsInterfaceSP params, KUndo2Command *parentCommand)

References m_d, KUndo2Command::redo(), and setTransformParamsWithUndo().

◆ setTransformParamsWithUndo()

void KisTransformMask::setTransformParamsWithUndo ( KisTransformMaskParamsInterfaceSP params,
KUndo2Command * parentCommand )

Definition at line 248 of file kis_transform_mask.cpp.

249{
251
252 m_d->paramsHolder->setParamsAtCurrentPosition(params.data(), parentCommand);
253}

References KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setX()

void KisTransformMask::setX ( qint32 x)
overridevirtual

overridden from KisBaseNode

Reimplemented from KisMask.

Definition at line 725 of file kis_transform_mask.cpp.

726{
727 KisTransformMaskParamsInterfaceSP params(m_d->paramsHolder->bakeIntoParams());
728
729 params->translateSrcAndDst(QPointF(x - this->x(), 0));
730
731 setTransformParams(params);
732 m_d->offset->setX(x);
733}
qint32 x() const override
void setTransformParams(KisTransformMaskParamsInterfaceSP params)

References m_d, setTransformParams(), and x().

◆ setY()

void KisTransformMask::setY ( qint32 y)
overridevirtual

overridden from KisBaseNode

Reimplemented from KisMask.

Definition at line 735 of file kis_transform_mask.cpp.

736{
737 KisTransformMaskParamsInterfaceSP params(m_d->paramsHolder->bakeIntoParams());
738
739 params->translateSrcAndDst(QPointF(0, y - this->y()));
740
741 setTransformParams(params);
742 m_d->offset->setY(y);
743}
qint32 y() const override

References m_d, setTransformParams(), and y().

◆ sigInternalForceStaticImageUpdate

void KisTransformMask::sigInternalForceStaticImageUpdate ( )
signal

◆ slotDelayedStaticUpdate

void KisTransformMask::slotDelayedStaticUpdate ( )
privateslot

Definition at line 270 of file kis_transform_mask.cpp.

271{
272 if (m_d->testingInterface) {
273 m_d->testingInterface->notifySlotDelayedStaticUpdate();
274 }
275
277}

References m_d, and startAsyncRegenerationJob().

◆ slotInternalForceStaticImageUpdate

void KisTransformMask::slotInternalForceStaticImageUpdate ( )
privateslot

Definition at line 783 of file kis_transform_mask.cpp.

References forceStartAsyncRegenerationJob().

◆ sourceDataBounds()

QRect KisTransformMask::sourceDataBounds ( ) const

NOTE: we should avoid including parent layer's projection's extent into the source of changeRect calculation, because that is exactly what partialChangeRect() calculates.

Definition at line 692 of file kis_transform_mask.cpp.

693{
697
698 QRect partialChangeRect;
699 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
700 if (parentLayer) {
701 const QRect rc = parentLayer->original()->exactBounds();
702 partialChangeRect = parentLayer->partialChangeRect(const_cast<KisTransformMask*>(this), rc);
703 }
704
705 return partialChangeRect;
706}

References KisPaintDevice::exactBounds(), KisLayer::original(), KisNode::parent, and KisLayer::partialChangeRect().

◆ startAsyncRegenerationJob()

void KisTransformMask::startAsyncRegenerationJob ( )
private

The mask might have been deleted from the layers stack in the meanwhile. Just ignore the updates in the case.

Don't try to start a regeneration stroke while image is locked. It may happen on loading, when all necessary conversions are not yet finished.

Definition at line 286 of file kis_transform_mask.cpp.

287{
293 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent().data());
294 if (!parentLayer) return;
295
296 KisImageSP image = parentLayer->image();
297
298 if (!image) {
299 return;
300 }
301
307 if (image->locked()) {
308 m_d->updateSignalCompressor.start();
309 return;
310 }
311
312
313 const QRect extraUpdateRect = m_d->forcedStaticUpdateExtraUpdateRect.takeRect();
314 image->addSpontaneousJob(new KisRecalculateTransformMaskJob(this, extraUpdateRect));
315}
bool locked() const
Definition kis_image.cc:751
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob)

References KisImage::addSpontaneousJob(), KisBaseNode::image, KisImage::locked(), m_d, and KisNode::parent.

◆ staticImageCacheIsValid()

bool KisTransformMask::staticImageCacheIsValid ( ) const

Definition at line 374 of file kis_transform_mask.cpp.

375{
376 return m_d->staticCache.isCacheValid(m_d->paramsHolder->bakeIntoParams());
377}

References m_d.

◆ supportsKeyframeChannel()

bool KisTransformMask::supportsKeyframeChannel ( const QString & id)
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.

Parameters
idqueried channel
Returns
bool whether it supports said channel or not.

Reimplemented from KisMask.

Definition at line 835 of file kis_transform_mask.cpp.

836{
837 if (id == KisKeyframeChannel::PositionX.id() ||
839 id == KisKeyframeChannel::ScaleX.id() ||
840 id == KisKeyframeChannel::ScaleY.id() ||
841 id == KisKeyframeChannel::ShearX.id() ||
842 id == KisKeyframeChannel::ShearY.id() ||
846 return true;
847 }
848 else if (id == KisKeyframeChannel::Opacity.id()) {
849 return false;
850 }
851
853}
static const KoID Opacity
virtual bool supportsKeyframeChannel(const QString &id)

References KisKeyframeChannel::Opacity, KisKeyframeChannel::PositionX, KisKeyframeChannel::PositionY, KisKeyframeChannel::RotationX, KisKeyframeChannel::RotationY, KisKeyframeChannel::RotationZ, KisKeyframeChannel::ScaleX, KisKeyframeChannel::ScaleY, KisKeyframeChannel::ShearX, KisKeyframeChannel::ShearY, and KisBaseNode::supportsKeyframeChannel().

◆ syncLodCache()

void KisTransformMask::syncLodCache ( )
overridevirtual

Synchronizes LoD caches of the node with the current state of it. The current level of detail is fetched from the image pointed by default bounds object

Reimplemented from KisNode.

Definition at line 788 of file kis_transform_mask.cpp.

789{
790 m_d->offset.syncLodCache();
791 m_d->paramsHolder->syncLodCache();
793}
virtual void syncLodCache()
Definition kis_node.cpp:677

References m_d, and KisNode::syncLodCache().

◆ testingInterface()

KisTransformMaskTestingInterface * KisTransformMask::testingInterface ( ) const

◆ threadSafeForceStaticImageUpdate() [1/2]

void KisTransformMask::threadSafeForceStaticImageUpdate ( )

Definition at line 767 of file kis_transform_mask.cpp.

768{
770}

References threadSafeForceStaticImageUpdate().

◆ threadSafeForceStaticImageUpdate() [2/2]

void KisTransformMask::threadSafeForceStaticImageUpdate ( const QRect & extraUpdateRect)

Definition at line 772 of file kis_transform_mask.cpp.

773{
774 if (m_d->testingInterface) {
775 m_d->testingInterface->notifyThreadSafeForceStaticImageUpdate();
776 }
777 if (!extraUpdateRect.isEmpty()) {
778 m_d->forcedStaticUpdateExtraUpdateRect.addRect(extraUpdateRect);
779 }
781}

References m_d, and sigInternalForceStaticImageUpdate().

◆ transformParams()

KisTransformMaskParamsInterfaceSP KisTransformMask::transformParams ( ) const

Definition at line 265 of file kis_transform_mask.cpp.

266{
267 return m_d->paramsHolder->bakeIntoParams();
268}

References m_d.

◆ x()

qint32 KisTransformMask::x ( ) const
overridevirtual

overridden from KisBaseNode

Reimplemented from KisMask.

Definition at line 715 of file kis_transform_mask.cpp.

716{
717 return m_d->offset->x();
718}

References m_d.

◆ y()

qint32 KisTransformMask::y ( ) const
overridevirtual

overridden from KisBaseNode

Reimplemented from KisMask.

Definition at line 720 of file kis_transform_mask.cpp.

721{
722 return m_d->offset->y();
723}

References m_d.

Member Data Documentation

◆ forcedStaticUpdateExtraUpdateRect

AccumulatedRectStorage KisTransformMask::forcedStaticUpdateExtraUpdateRect

Definition at line 184 of file kis_transform_mask.cpp.

◆ m_d

const QScopedPointer<Private> KisTransformMask::m_d
private

Definition at line 113 of file kis_transform_mask.h.

◆ offBoundsReadArea

qreal KisTransformMask::offBoundsReadArea

Definition at line 189 of file kis_transform_mask.cpp.

◆ offset

KisLodCapableLayerOffset KisTransformMask::offset

Definition at line 186 of file kis_transform_mask.cpp.

◆ paramsHolder

KisAnimatedTransformParamsHolderInterfaceSP KisTransformMask::paramsHolder

Definition at line 179 of file kis_transform_mask.cpp.

◆ recalculatingStaticImage

bool KisTransformMask::recalculatingStaticImage

Definition at line 182 of file kis_transform_mask.cpp.

◆ staticCache

StaticCacheStorage KisTransformMask::staticCache

Definition at line 181 of file kis_transform_mask.cpp.

◆ testingInterface

KisTransformMaskTestingInterface * KisTransformMask::testingInterface

Definition at line 191 of file kis_transform_mask.cpp.

◆ updateSignalCompressor

KisThreadSafeSignalCompressor KisTransformMask::updateSignalCompressor

Definition at line 188 of file kis_transform_mask.cpp.

◆ worker

KisPerspectiveTransformWorker KisTransformMask::worker

Definition at line 178 of file kis_transform_mask.cpp.


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