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 KUndo2Command * child (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraData * extraData () 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 2066 of file kis_layer_utils.cpp.

Constructor & Destructor Documentation

◆ MergeSelectionMasks()

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

Definition at line 2067 of file kis_layer_utils.cpp.

2068 : m_info(info),
2069 m_putAfter(putAfter){}

Member Function Documentation

◆ populateChildCommands()

void KisLayerUtils::MergeSelectionMasks::populateChildCommands ( )
inlineoverridevirtual

Implements KisCommandUtils::AggregateCommand.

Definition at line 2071 of file kis_layer_utils.cpp.

2071 {
2073 CleanUpNodes::findPerfectParent(m_info->allSrcNodes(), m_putAfter, parent);
2074
2075 KisLayerSP parentLayer;
2076 do {
2077 parentLayer = qobject_cast<KisLayer*>(parent.data());
2078
2079 parent = parent->parent();
2080 } while(!parentLayer && parent);
2081
2082 KisSelectionSP selection = new KisSelection();
2083
2084 foreach (KisNodeSP node, m_info->allSrcNodes()) {
2085 KisMaskSP mask = dynamic_cast<KisMask*>(node.data());
2086 if (!mask) continue;
2087
2088 selection->pixelSelection()->applySelection(
2089 mask->selection()->pixelSelection(), SELECTION_ADD);
2090 }
2091
2092 KisSelectionMaskSP mergedMask = new KisSelectionMask(m_info->image, i18n("Selection Mask"));
2093 mergedMask->initSelection(parentLayer);
2094 mergedMask->setSelection(selection);
2095
2096 m_info->dstNode = mergedMask;
2097 }
@ 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
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, SELECTION_ADD, and KisSelectionMask::setSelection().

Member Data Documentation

◆ m_info

MergeDownInfoBaseSP KisLayerUtils::MergeSelectionMasks::m_info
private

Definition at line 2100 of file kis_layer_utils.cpp.

◆ m_putAfter

KisNodeSP KisLayerUtils::MergeSelectionMasks::m_putAfter
private

Definition at line 2101 of file kis_layer_utils.cpp.


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