Krita

SelectionMask.cpp
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
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
12SelectionMask::SelectionMask(KisImageSP image, QString name, QObject *parent) :
13 Node(image, new KisSelectionMask(image), parent)
14{
15 this->node()->setName(name);
16}
17
18SelectionMask::SelectionMask(KisImageSP image, KisSelectionMaskSP mask, QObject *parent):
19 Node(image, mask, parent)
20{
21
22}
23
24SelectionMask::~SelectionMask()
25{
26
27}
28
29Selection *SelectionMask::selection() const
30{
31 const KisSelectionMask *mask = qobject_cast<const KisSelectionMask*>(this->node());
32 return new Selection(mask->selection());
33}
34
35void 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}
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition Node.h:24
void setName(QString name)
rename the Node to the given name
Definition Node.cpp:434
virtual QString type() const override
type Krita has several types of nodes, split in layers and masks.
Selection represents a selection on Krita.
Definition Selection.h:31
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:06:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.