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 2071 of file kis_layer_utils.cpp.

Constructor & Destructor Documentation

◆ MergeSelectionMasks()

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

Definition at line 2072 of file kis_layer_utils.cpp.

2073 : m_info(info),
2074 m_putAfter(putAfter){}

Member Function Documentation

◆ populateChildCommands()

void KisLayerUtils::MergeSelectionMasks::populateChildCommands ( )
inlineoverridevirtual

Implements KisCommandUtils::AggregateCommand.

Definition at line 2076 of file kis_layer_utils.cpp.

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

◆ m_putAfter

KisNodeSP KisLayerUtils::MergeSelectionMasks::m_putAfter
private

Definition at line 2106 of file kis_layer_utils.cpp.


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