Krita

CloneLayer.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 "CloneLayer.h"
7#include <kis_clone_layer.h>
8#include <kis_image.h>
9#include <kis_layer.h>
10
11CloneLayer::CloneLayer(KisImageSP image, QString name, KisLayerSP source, QObject *parent) :
12 Node(image, new KisCloneLayer(source, image, name, OPACITY_OPAQUE_U8), parent)
13{
14
15}
16
17CloneLayer::CloneLayer(KisCloneLayerSP layer, QObject *parent):
18 Node(layer->image(), layer, parent)
19{
20
21}
22
23CloneLayer::~CloneLayer()
24{
25
26}
27
29{
30 const KisCloneLayer* layer = qobject_cast<const KisCloneLayer*>(this->node().data());
32
33 return Node::createNode(0, layer->copyFrom());
34}
35
37{
38 if (!node->node()) return;
39
40 KisCloneLayerSP layer = qobject_cast<KisCloneLayer*>(this->node().data());
42
43 KisLayerSP source = qobject_cast<KisLayer*>(node->node().data());
44
45 layer->setCopyFrom(source);
46}
47
49{
50 return "clonelayer";
51}
virtual QString type() const override
type Krita has several types of nodes, split in layers and masks.
void setSourceNode(Node *node)
setSourceNode
Node * sourceNode() const
sourceNode
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition Node.h:22
QString name(StandardAction id)
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:54:02 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.