Changeset View
Changeset View
Standalone View
Standalone View
libs/libkis/BrushTip.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_BRUSHTIP_H | ||||
20 | #define LIBKIS_BRUSHTIP_H | ||||
21 | | ||||
22 | #include <QObject> | ||||
23 | #include "kritalibkis_export.h" | ||||
24 | #include "libkis.h" | ||||
25 | #include "Resource.h" | ||||
26 | #include "kis_brush.h" | ||||
27 | | ||||
28 | /** | ||||
29 | * @brief The BrushTip class | ||||
30 | * This represents a brush tip resource in Krita, typically a predefined brush. | ||||
31 | * usage: | ||||
32 | * @code | ||||
33 | import sys | ||||
34 | from krita import * | ||||
35 | | ||||
36 | for item in Application.allBrushTips(): | ||||
37 | print (item.name()+" "+str(item.spacing())) | ||||
38 | * @endcode | ||||
39 | */ | ||||
40 | class KRITALIBKIS_EXPORT BrushTip : public Resource | ||||
41 | { | ||||
42 | public: | ||||
43 | explicit BrushTip(KoResource *resource, QObject *parent = 0); | ||||
44 | ~BrushTip() override; | ||||
45 | | ||||
46 | /** | ||||
47 | * @brief brushTipImage | ||||
48 | * @return the image of the brush tip as QImage. | ||||
49 | */ | ||||
50 | QImage brushTipImage() const; | ||||
51 | | ||||
52 | /** | ||||
53 | * @brief spacing | ||||
54 | * @return spacing between brushes | ||||
55 | */ | ||||
56 | double spacing() const; | ||||
57 | /** | ||||
58 | * @brief setSpacing | ||||
59 | * @param spacing between brushes | ||||
60 | */ | ||||
61 | void setSpacing(double spacing); | ||||
62 | /** | ||||
63 | * @brief autoSpacingActive | ||||
64 | * @return whether auto spacing is active. | ||||
65 | */ | ||||
66 | bool autoSpacingActive() const; | ||||
67 | /** | ||||
68 | * @brief autoSpacigCoeff | ||||
69 | * @return the spacing for autospacing. | ||||
70 | */ | ||||
71 | qreal autoSpacigCoeff() const; | ||||
72 | /** | ||||
73 | * @brief setAutoSpacing | ||||
74 | * @param active | ||||
75 | * @param coefficient the spacing autospacing should use. | ||||
76 | */ | ||||
77 | void setAutoSpacing(bool active, qreal coefficient); | ||||
78 | | ||||
79 | /** | ||||
80 | * @brief width | ||||
81 | * @return width of the tip. | ||||
82 | */ | ||||
83 | qint32 width() const; | ||||
84 | /** | ||||
85 | * @brief height | ||||
86 | * @return height of the tip. | ||||
87 | */ | ||||
88 | qint32 height() const; | ||||
89 | /** | ||||
90 | * @brief threadingAllowed | ||||
91 | * @return whether this brush tip can make use of multithreading. | ||||
92 | */ | ||||
93 | bool threadingAllowed() const; | ||||
94 | | ||||
95 | /** | ||||
96 | * @brief hasColor | ||||
97 | * @return whether the brush tip has color. | ||||
98 | */ | ||||
99 | bool hasColor() const; | ||||
100 | | ||||
101 | /** | ||||
102 | * @brief scale | ||||
103 | * @return scale of the tip. | ||||
104 | */ | ||||
105 | qreal scale() const; | ||||
106 | /** | ||||
107 | * @brief setScale | ||||
108 | * @param scale the new scale. | ||||
109 | */ | ||||
110 | void setScale(qreal scale); | ||||
111 | /** | ||||
112 | * @brief angle | ||||
113 | * @return angle of the tip. | ||||
114 | */ | ||||
115 | qreal angle() const; | ||||
116 | /** | ||||
117 | * @brief setAngle | ||||
118 | * @param angle the new angle of the tip. | ||||
119 | */ | ||||
120 | void setAngle(qreal angle); | ||||
121 | | ||||
122 | private: | ||||
123 | struct Private; | ||||
124 | Private *const d; | ||||
125 | | ||||
126 | KisBrush *tip(); | ||||
127 | | ||||
128 | }; | ||||
129 | | ||||
130 | #endif // LIBKIS_BRUSHTIP_H |