Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLayerUtils::MergeSelectionMasks Struct Reference
+ Inheritance diagram for KisLayerUtils::MergeSelectionMasks:

Public Member Functions

 MergeSelectionMasks (MergeDownInfoBaseSP info, KisNodeSP putAfter)
 
void populateChildCommands () override
 
- Public Member Functions inherited from KisCommandUtils::AggregateCommand
 AggregateCommand (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 AggregateCommand (KUndo2Command *parent=0)
 
void redo () override
 
void undo () override
 
- Public Member Functions inherited from KUndo2Command
QString actionText () const
 
virtual bool canAnnihilateWith (const KUndo2Command *other) const
 
const KUndo2Commandchild (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraDataextraData () const
 
bool hasParent () const
 
virtual int id () const
 
virtual bool isMerged () const
 
 KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 KUndo2Command (KUndo2Command *parent=0)
 
virtual QVector< KUndo2Command * > mergeCommandsVector () const
 
virtual bool mergeWith (const KUndo2Command *other)
 
virtual void redoMergedCommands ()
 
void setEndTime ()
 
virtual void setEndTime (const QTime &time)
 
void setExtraData (KUndo2CommandExtraData *data)
 
void setText (const KUndo2MagicString &text)
 
void setTime ()
 
virtual void setTime (const QTime &time)
 
virtual void setTimedID (int timedID)
 
KUndo2MagicString text () const
 
virtual QTime time () const
 
virtual int timedId () const
 
virtual bool timedMergeWith (KUndo2Command *other)
 
virtual void undoMergedCommands ()
 
virtual ~KUndo2Command ()
 

Private Attributes

MergeDownInfoBaseSP m_info
 
KisNodeSP m_putAfter
 

Additional Inherited Members

- Protected Member Functions inherited from KisCommandUtils::AggregateCommand
void addCommand (KUndo2Command *cmd)
 

Detailed Description

Definition at line 2040 of file kis_layer_utils.cpp.

Constructor & Destructor Documentation

◆ MergeSelectionMasks()

KisLayerUtils::MergeSelectionMasks::MergeSelectionMasks ( MergeDownInfoBaseSP info,
KisNodeSP putAfter )
inline

Definition at line 2041 of file kis_layer_utils.cpp.

2042 : m_info(info),
2043 m_putAfter(putAfter){}

Member Function Documentation

◆ populateChildCommands()

void KisLayerUtils::MergeSelectionMasks::populateChildCommands ( )
inlineoverridevirtual

Implements KisCommandUtils::AggregateCommand.

Definition at line 2045 of file kis_layer_utils.cpp.

2045 {
2047 CleanUpNodes::findPerfectParent(m_info->allSrcNodes(), m_putAfter, parent);
2048
2049 KisLayerSP parentLayer;
2050 do {
2051 parentLayer = qobject_cast<KisLayer*>(parent.data());
2052
2053 parent = parent->parent();
2054 } while(!parentLayer && parent);
2055
2056 KisSelectionSP selection = new KisSelection();
2057
2058 foreach (KisNodeSP node, m_info->allSrcNodes()) {
2059 KisMaskSP mask = dynamic_cast<KisMask*>(node.data());
2060 if (!mask) continue;
2061
2062 selection->pixelSelection()->applySelection(
2064 }
2065
2066 KisSelectionMaskSP mergedMask = new KisSelectionMask(m_info->image, i18n("Selection Mask"));
2067 mergedMask->initSelection(parentLayer);
2068 mergedMask->setSelection(selection);
2069
2070 m_info->dstNode = mergedMask;
2071 }
@ SELECTION_ADD
ChildIterator< value_type, is_const > parent(const ChildIterator< value_type, is_const > &it)
Definition KisForest.h:327
static void findPerfectParent(KisNodeList nodesToDelete, KisNodeSP &putAfter, KisNodeSP &parent)
void initSelection(KisSelectionSP copyFrom, KisLayerSP parentLayer)
initSelection initializes the selection for the mask from the given selection's projection.
Definition kis_mask.cc:157
KisSelectionSP selection
Definition kis_mask.cc:44
void applySelection(KisPixelSelectionSP selection, SelectionAction action)
void setSelection(KisSelectionSP selection)
Set the selection of this adjustment layer to a copy of selection.
KisPixelSelectionSP pixelSelection

References KisPixelSelection::applySelection(), KisSharedPtr< T >::data(), KisLayerUtils::CleanUpNodes::findPerfectParent(), KisMask::initSelection(), m_info, m_putAfter, KisSelection::pixelSelection, KisMask::selection, SELECTION_ADD, and KisSelectionMask::setSelection().

Member Data Documentation

◆ m_info

MergeDownInfoBaseSP KisLayerUtils::MergeSelectionMasks::m_info
private

Definition at line 2074 of file kis_layer_utils.cpp.

◆ m_putAfter

KisNodeSP KisLayerUtils::MergeSelectionMasks::m_putAfter
private

Definition at line 2075 of file kis_layer_utils.cpp.


The documentation for this struct was generated from the following file: