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_FILLLAYER_H 0007 #define LIBKIS_FILLLAYER_H 0008 0009 #include <QObject> 0010 #include "Node.h" 0011 #include <InfoObject.h> 0012 #include <Selection.h> 0013 0014 #include <kis_types.h> 0015 0016 #include "kritalibkis_export.h" 0017 #include "libkis.h" 0018 /** 0019 * @brief The FillLayer class 0020 * A fill layer is much like a filter layer in that it takes a name 0021 * and filter. It however specializes in filters that fill the whole canvas, 0022 * such as a pattern or full color fill. 0023 */ 0024 class KRITALIBKIS_EXPORT FillLayer : public Node 0025 { 0026 Q_OBJECT 0027 Q_DISABLE_COPY(FillLayer) 0028 0029 public: 0030 /** 0031 * @brief FillLayer Create a new fill layer with the given generator plugin 0032 * @param image the image this fill layer will belong to 0033 * @param name "pattern" or "color" 0034 * @param filterConfig a configuration object appropriate to the given generator plugin 0035 * 0036 * For a "pattern" fill layer, the InfoObject can contain a single "pattern" parameter with 0037 * the name of a pattern as known to the resource system: "pattern" = "Cross01.pat". 0038 * 0039 * For a "color" fill layer, the InfoObject can contain a single "color" parameter with 0040 * a QColor, a string that QColor can parse (see https://doc.qt.io/qt-5/qcolor.html#setNamedColor) 0041 * or an XML description of the color, which can be derived from a @see ManagedColor. 0042 * 0043 * @param selection a selection object, can be empty 0044 * @param parent 0045 */ 0046 explicit FillLayer(KisImageSP image, QString name, KisFilterConfigurationSP filterConfig, Selection &selection, QObject *parent = 0); 0047 explicit FillLayer(KisGeneratorLayerSP layer, QObject *parent = 0); 0048 ~FillLayer() override; 0049 public Q_SLOTS: 0050 0051 /** 0052 * @brief type Krita has several types of nodes, split in layers and masks. Group 0053 * layers can contain other layers, any layer can contain masks. 0054 * 0055 * @return The type of the node. Valid types are: 0056 * <ul> 0057 * <li>paintlayer 0058 * <li>grouplayer 0059 * <li>filelayer 0060 * <li>filterlayer 0061 * <li>filllayer 0062 * <li>clonelayer 0063 * <li>vectorlayer 0064 * <li>transparencymask 0065 * <li>filtermask 0066 * <li>transformmask 0067 * <li>selectionmask 0068 * <li>colorizemask 0069 * </ul> 0070 * 0071 * If the Node object isn't wrapping a valid Krita layer or mask object, and 0072 * empty string is returned. 0073 */ 0074 virtual QString type() const override; 0075 0076 /** 0077 * @brief setGenerator set the given generator for this fill layer 0078 * @param generatorName "pattern" or "color" 0079 * @param filterConfig a configuration object appropriate to the given generator plugin 0080 * @return true if the generator was correctly created and set on the layer 0081 */ 0082 bool setGenerator(const QString &generatorName, InfoObject *filterConfig); 0083 QString generatorName(); 0084 0085 InfoObject *filterConfig(); 0086 }; 0087 0088 #endif // LIBKIS_FILLLAYER_H