Krita

SelectionMask.cpp
1 /*
2  * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #include "SelectionMask.h"
7 #include <kis_selection_mask.h>
8 #include <kis_image.h>
9 #include "Selection.h"
10 #include <kis_selection.h>
11 
12 SelectionMask::SelectionMask(KisImageSP image, QString name, QObject *parent) :
13  Node(image, new KisSelectionMask(image), parent)
14 {
15  this->node()->setName(name);
16 }
17 
18 SelectionMask::SelectionMask(KisImageSP image, KisSelectionMaskSP mask, QObject *parent):
19  Node(image, mask, parent)
20 {
21 
22 }
23 
24 SelectionMask::~SelectionMask()
25 {
26 
27 }
28 
29 Selection *SelectionMask::selection() const
30 {
31  const KisSelectionMask *mask = qobject_cast<const KisSelectionMask*>(this->node());
32  return new Selection(mask->selection());
33 }
34 
35 void SelectionMask::setSelection(Selection *selection)
36 {
37  KisSelectionMask *mask = dynamic_cast<KisSelectionMask*>(this->node().data());
38  mask->setSelection(selection->selection());
39 }
40 
42 {
43  return "selectionmask";
44 }
Selection represents a selection on Krita.
Definition: Selection.h:30
void setName(QString name)
rename the Node to the given name
Definition: Node.cpp:427
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition: Node.h:21
virtual QString type() const override
type Krita has several types of nodes, split in layers and masks.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:19:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.