File indexing completed on 2024-05-12 15:59:05

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_GROUPLAYER_H
0007 #define LIBKIS_GROUPLAYER_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 GroupLayer class
0019  * A group layer is a layer that can contain other layers.
0020  * In Krita, layers within a group layer are composited
0021  * first before they are added into the composition code for where
0022  * the group is in the stack. This has a significant effect on how
0023  * it is interpreted for blending modes.
0024  *
0025  * PassThrough changes this behaviour.
0026  *
0027  * Group layer cannot be animated, but can contain animated layers or masks.
0028  */
0029 class KRITALIBKIS_EXPORT GroupLayer : public Node
0030 {
0031     Q_OBJECT
0032     Q_DISABLE_COPY(GroupLayer)
0033 
0034 public:
0035     explicit GroupLayer(KisImageSP image, QString name, QObject *parent = 0);
0036     explicit GroupLayer(KisGroupLayerSP layer, QObject *parent = 0);
0037     ~GroupLayer() override;
0038 public Q_SLOTS:
0039 
0040     /**
0041      * @brief type Krita has several types of nodes, split in layers and masks. Group
0042      * layers can contain other layers, any layer can contain masks.
0043      *
0044      * @return grouplayer
0045      */
0046     virtual QString type() const override;
0047 
0048     /**
0049      * @brief setPassThroughMode
0050      * This changes the way how compositing works.
0051      * Instead of compositing all the layers before compositing it with the rest of the image,
0052      * the group layer becomes a sort of formal way to organise everything.
0053      *
0054      * Passthrough mode is the same as it is in photoshop,
0055      * and the inverse of SVG's isolation attribute(with passthrough=false being the same as
0056      * isolation="isolate").
0057      *
0058      * @param passthrough whether or not to set the layer to passthrough.
0059      */
0060     void setPassThroughMode(bool passthrough);
0061 
0062     /**
0063      * @brief passThroughMode
0064      * @return returns whether or not this layer is in passthrough mode. @see setPassThroughMode
0065      */
0066     bool passThroughMode() const;
0067 };
0068 
0069 #endif // LIBKIS_GROUPLAYER_H
0070