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

Constructor & Destructor Documentation

◆ MergeSelectionMasks()

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

Definition at line 2089 of file kis_layer_utils.cpp.

2090 : m_info(info),
2091 m_putAfter(putAfter){}

Member Function Documentation

◆ populateChildCommands()

void KisLayerUtils::MergeSelectionMasks::populateChildCommands ( )
inlineoverridevirtual

Implements KisCommandUtils::AggregateCommand.

Definition at line 2093 of file kis_layer_utils.cpp.

2093 {
2095 CleanUpNodes::findPerfectParent(m_info->allSrcNodes(), m_putAfter, parent);
2096
2097 KisLayerSP parentLayer;
2098 do {
2099 parentLayer = qobject_cast<KisLayer*>(parent.data());
2100
2101 parent = parent->parent();
2102 } while(!parentLayer && parent);
2103
2104 KisSelectionSP selection = new KisSelection();
2105
2106 foreach (KisNodeSP node, m_info->allSrcNodes()) {
2107 KisMaskSP mask = dynamic_cast<KisMask*>(node.data());
2108 if (!mask) continue;
2109
2110 selection->pixelSelection()->applySelection(
2111 mask->selection()->pixelSelection(), SELECTION_ADD);
2112 }
2113
2114 KisSelectionMaskSP mergedMask = new KisSelectionMask(m_info->image, i18n("Selection Mask"));
2115 mergedMask->initSelection(parentLayer);
2116 mergedMask->setSelection(selection);
2117
2118 m_info->dstNode = mergedMask;
2119 }
@ 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 2122 of file kis_layer_utils.cpp.

◆ m_putAfter

KisNodeSP KisLayerUtils::MergeSelectionMasks::m_putAfter
private

Definition at line 2123 of file kis_layer_utils.cpp.


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