File indexing completed on 2024-05-19 04:26:54

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 #ifndef LIBKIS_CLONELAYER_H
0007 #define LIBKIS_CLONELAYER_H
0008 
0009 #include <QObject>
0010 #include "Node.h"
0011 
0012 #include <kis_types.h>
0013 
0014 #include "kritalibkis_export.h"
0015 #include "libkis.h"
0016 
0017 /**
0018  * @brief The CloneLayer class
0019  * A clone layer is a layer that takes a reference inside the image
0020  * and shows the exact same pixeldata.
0021  *
0022  * If the original is updated, the clone layer will update too.
0023  */
0024 
0025 class KRITALIBKIS_EXPORT CloneLayer : public Node
0026 {
0027     Q_OBJECT
0028     Q_DISABLE_COPY(CloneLayer)
0029 
0030 public:
0031     explicit CloneLayer(KisImageSP image, QString name, KisLayerSP source, QObject *parent = 0);
0032 
0033     /**
0034      * @brief CloneLayer
0035      * function for wrapping a preexisting node into a clonelayer object.
0036      * @param layer the clone layer
0037      * @param parent the parent QObject
0038      */
0039     explicit CloneLayer(KisCloneLayerSP layer, QObject *parent = 0);
0040     ~CloneLayer() override;
0041 public Q_SLOTS:
0042 
0043     /**
0044      * @brief type Krita has several types of nodes, split in layers and masks. Group
0045      * layers can contain other layers, any layer can contain masks.
0046      *
0047      * @return clonelayer
0048      */
0049     virtual QString type() const override;
0050 
0051     /**
0052      * @brief sourceNode
0053      * @return the node the clone layer is based on.
0054      */
0055     Node* sourceNode() const;
0056 
0057     /**
0058      * @brief setSourceNode
0059      * @param node the node to use as the source of the clone layer.
0060      */
0061     void setSourceNode(Node* node);
0062 };
0063 
0064 #endif // LIBKIS_PAINTLAYER_H
0065