61 Q_UNUSED(actionCollection);
62 Q_UNUSED(actionManager);
101 if (!avoidActiveNode && activeNode->
allowAsChild(node)) {
106 parent = activeNode->
parent();
129 if (!t && activeNode->
parent()) {
147 const QString &nodeName,
148 bool suppressSelection,
149 bool avoidActiveNode,
158 KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent.data());
159 Q_ASSERT(parentLayer);
161 bool shouldDeselectGlobalSelection =
false;
163 if (!suppressSelection) {
174 KisImageLayerAddCommand::Flags flags =
181 if (shouldDeselectGlobalSelection) {
193 int number = masks.count() + 1;
194 return desiredName + QString(
" ") + QString::number(number);
203 createMaskCommon(mask, activeNode, copyFrom,
kundo2_i18n(
"Add Selection Mask"),
"KisSelectionMask", i18n(
"Selection"),
false, convertActiveNode,
false);
205 if (convertActiveNode) {
216 createMaskCommon(mask, activeNode, copyFrom,
kundo2_i18n(
"Add Transparency Mask"),
"KisTransparencyMask", i18n(
"Transparency Mask"),
false, convertActiveNode);
217 if (convertActiveNode) {
229 createMaskCommon(mask, activeNode, copyFrom,
kundo2_i18n(
"Add Filter Mask"),
"KisFilterMask", i18n(
"Filter Mask"),
false, convertActiveNode);
231 if (convertActiveNode) {
244 mask->name(), i18n(
"New Filter Mask"),
245 m_view, qApp->activeWindow());
251 mask->setFilter(filter->cloneWithResourcesSnapshot());
252 mask->setName(mask->name());
257 if (dialog.exec() == QDialog::Accepted) {
260 QString name = dialog.layerName();
261 mask->setFilter(filter->cloneWithResourcesSnapshot());
300 KisLayerSP activeLayer = qobject_cast<KisLayer*>(activeNode.
data());
301 Q_ASSERT(activeLayer);
305 if (!filter)
return nullptr;
310 mask->initSelection(activeLayer);
312 mask->setFilter(filter->cloneWithResourcesSnapshot());
314 KisImageLayerAddCommand::Flags flags =
339 if (
activeMask()->inherits(
"KisFilterMask")) {
355 Q_ASSERT(configBefore);
356 QString xmlBefore = configBefore->toXML();
358 if (dlg.exec() == QDialog::Accepted) {
361 Q_ASSERT(configAfter);
362 QString xmlAfter = configAfter->toXML();
366 if(xmlBefore != xmlAfter) {
369 configBefore->cloneWithResourcesSnapshot(),
370 configAfter->cloneWithResourcesSnapshot());
380 Q_ASSERT(configAfter);
381 QString xmlAfter = configAfter->toXML();
383 if(xmlBefore != xmlAfter) {
384 mask->
setFilter(configBefore->cloneWithResourcesSnapshot());
QList< QString > QStringList
const quint8 OPACITY_OPAQUE_U8
char nodeType(const KoPathPoint *point)
A KisActionManager class keeps track of KisActions. These actions are always associated with the GUI....
void initializeCompositeOp()
KUndo2Command * setColorSpace(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags(), KoUpdater *progressUpdater=nullptr)
The command for deselection the global selection of KisImage.
QString layerName() const
KisFilterConfigurationSP filterConfiguration() const
void setModified(bool _mod)
void setFilter(KisFilterConfigurationSP filterConfig, bool checkCompareConfig=true) override
static KisFilterRegistry * instance()
static KisResourcesInterfaceSP instance()
const KoColorSpace * colorSpace() const
QString nextLayerName(const QString &baseName="") const
A container for a set of QAction objects.
KisNodeCommandsAdapter * m_commandsAdapter
KisMaskManager(KisViewManager *view)
KisNodeSP createTransformMask(KisNodeSP activeNode)
void createMaskCommon(KisMaskSP mask, KisNodeSP activeNode, KisPaintDeviceSP copyFrom, const KUndo2MagicString ¯oName, const QString &nodeType, const QString &nodeName, bool suppressSelection, bool avoidActiveNode, bool updateImage=true)
void setup(KisKActionCollection *actionCollection, KisActionManager *actionManager)
void activateMask(KisMaskSP mask)
KisNodeSP createSelectionMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool convertActiveNode)
KisPaintDeviceSP activeDevice()
KisNodeSP createColorizeMask(KisNodeSP activeNode)
void setView(QPointer< KisView >view)
KisNodeSP createFastColorOverlayMask(KisNodeSP activeNode)
KisNodeSP createTransparencyMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool convertActiveNode)
QPointer< KisView > m_imageView
KisNodeSP createFilterMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool quiet, bool convertActiveNode)
QString createMaskNameCommon(KisNodeSP targetNode, const QString &nodeType, const QString &desiredName)
void adjustMaskPosition(KisNodeSP node, KisNodeSP activeNode, bool avoidActiveNode, KisNodeSP &parent, KisNodeSP &above)
void addNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis, KisImageLayerAddCommand::Flags flags=KisImageLayerAddCommand::DoRedoUpdates|KisImageLayerAddCommand::DoUndoUpdates)
void addExtraCommand(KUndo2Command *command)
void removeNode(KisNodeSP node)
void beginMacro(const KUndo2MagicString ¯oName)
virtual KisFilterConfigurationSP filter() const
bool canModifyLayer(KisNodeSP node, bool showWarning=true)
virtual void addCommand(KUndo2Command *cmd)=0
KisDocument * document() const
KisUndoAdapter * undoAdapter()
The undo adapter is used to add commands to the undo stack.
KisSelectionSP selection()
KisNodeManager * nodeManager() const
The node manager handles everything about nodes.
QWidget * mainWindowAsQWidget() const
KisImageWSP image() const
Return the image this view is displaying.
const T value(const QString &id) const
QList< T > values() const
KUndo2MagicString kundo2_i18n(const char *text)
void setName(const QString &name)
virtual const KoColorSpace * colorSpace() const =0
virtual KisFilterConfigurationSP defaultConfiguration(KisResourcesInterfaceSP resourcesInterface) const
KisPaintDeviceSP original() const override=0
void initSelection(KisSelectionSP copyFrom, KisLayerSP parentLayer)
initSelection initializes the selection for the mask from the given selection's projection.
KisPaintDeviceSP paintDevice() const override
KisNodeSP prevSibling() const
QList< KisNodeSP > childNodes(const QStringList &nodeTypes, const KoProperties &properties) const
quint32 childCount() const
KisNodeSP lastChild() const
KisNodeSP nextSibling() const
virtual bool allowAsChild(KisNodeSP) const =0
void setActive(bool active)