Changeset View
Changeset View
Standalone View
Standalone View
libs/libkis/BrushPreset.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (c) 2018 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Lesser General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #ifndef LIBKIS_BRUSHPRESET_H | ||||
20 | #define LIBKIS_BRUSHPRESET_H | ||||
21 | | ||||
22 | #include <QObject> | ||||
23 | #include "kritalibkis_export.h" | ||||
24 | #include "libkis.h" | ||||
25 | #include "Resource.h" | ||||
26 | #include "kis_paintop_preset.h" | ||||
27 | | ||||
28 | /** | ||||
29 | * @brief The BrushPreset class | ||||
30 | * This class describes brush presets. | ||||
31 | * Usage: | ||||
32 | * @code | ||||
33 | import sys | ||||
34 | from krita import * | ||||
35 | | ||||
36 | for item in Application.allBrushPresets(): | ||||
37 | print (item.name()+item.brushEngineName()) | ||||
38 | | ||||
39 | #Getting the data of a single preset: | ||||
40 | preset = Application.allBrushPresets()[0] | ||||
41 | for key in preset.settings().properties().keys(): | ||||
42 | print("---->"+key+" - "+str(preset.settings().property(key))) | ||||
43 | * @endcode | ||||
44 | */ | ||||
45 | | ||||
46 | class KRITALIBKIS_EXPORT BrushPreset : public Resource | ||||
47 | { | ||||
48 | public: | ||||
49 | explicit BrushPreset(KoResource *resource, QObject *parent = 0); | ||||
50 | ~BrushPreset() override; | ||||
51 | | ||||
52 | /** | ||||
53 | * @brief brushEngineName | ||||
54 | * @return the name of the brush engine | ||||
55 | */ | ||||
56 | QString brushEngineName() const; | ||||
57 | | ||||
58 | /** | ||||
59 | * @brief settings | ||||
60 | * get the settings for this brush preset | ||||
61 | * @return the settings in the form of a InfoObject | ||||
62 | */ | ||||
63 | InfoObject *settings() const; | ||||
64 | | ||||
65 | /** | ||||
66 | * @brief setSettings | ||||
67 | * set the brush settings from an InfoObject. | ||||
68 | * @param settings the InfoObject containing the settings. | ||||
69 | * @return whether it was succesful. | ||||
70 | */ | ||||
71 | bool setSettings(InfoObject *settings); | ||||
72 | | ||||
73 | /** | ||||
74 | * @brief load | ||||
75 | * @return reload the preset. | ||||
76 | */ | ||||
77 | bool load(); | ||||
78 | | ||||
79 | /** | ||||
80 | * @brief isDirty | ||||
81 | * @return whether the preset has been modified or not. | ||||
82 | */ | ||||
83 | bool isDirty(); | ||||
84 | private: | ||||
85 | struct Private; | ||||
86 | Private *const d; | ||||
87 | | ||||
88 | KisPaintOpPreset *preset(); | ||||
89 | | ||||
90 | }; | ||||
91 | | ||||
92 | #endif // LIBKIS_BRUSHPRESET_H |