Changeset View
Changeset View
Standalone View
Standalone View
libs/libkis/BrushTip.cpp
- 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 | #include "BrushTip.h" | ||||
19 | #include "kis_brush.h" | ||||
20 | | ||||
21 | struct BrushTip::Private { | ||||
22 | KisBrush *brushtip {0}; | ||||
23 | }; | ||||
24 | | ||||
25 | BrushTip::BrushTip(KoResource *resource, QObject *parent) | ||||
26 | : Resource(resource, parent) | ||||
27 | , d(new Private()) | ||||
28 | { | ||||
29 | d->brushtip = dynamic_cast<KisBrush*>(resource); | ||||
30 | } | ||||
31 | | ||||
32 | BrushTip::~BrushTip() | ||||
33 | { | ||||
34 | delete d; | ||||
35 | } | ||||
36 | | ||||
37 | QImage BrushTip::brushTipImage() const | ||||
38 | { | ||||
39 | return d->brushtip->image(); | ||||
40 | } | ||||
41 | | ||||
42 | double BrushTip::spacing() const | ||||
43 | { | ||||
44 | return d->brushtip->spacing(); | ||||
45 | } | ||||
46 | | ||||
47 | void BrushTip::setSpacing(double spacing) | ||||
48 | { | ||||
49 | d->brushtip->setSpacing(spacing); | ||||
50 | } | ||||
51 | | ||||
52 | bool BrushTip::autoSpacingActive() const | ||||
53 | { | ||||
54 | return d->brushtip->autoSpacingActive(); | ||||
55 | } | ||||
56 | | ||||
57 | qreal BrushTip::autoSpacigCoeff() const | ||||
58 | { | ||||
59 | return d->brushtip->autoSpacingCoeff(); | ||||
60 | } | ||||
61 | | ||||
62 | void BrushTip::setAutoSpacing(bool active, qreal coefficient) | ||||
63 | { | ||||
64 | d->brushtip->setAutoSpacing(active, coefficient); | ||||
65 | } | ||||
66 | | ||||
67 | qint32 BrushTip::width() const | ||||
68 | { | ||||
69 | return d->brushtip->width(); | ||||
70 | } | ||||
71 | | ||||
72 | qint32 BrushTip::height() const | ||||
73 | { | ||||
74 | return d->brushtip->height(); | ||||
75 | } | ||||
76 | | ||||
77 | bool BrushTip::threadingAllowed() const | ||||
78 | { | ||||
79 | return d->brushtip->threadingAllowed(); | ||||
80 | } | ||||
81 | | ||||
82 | bool BrushTip::hasColor() const | ||||
83 | { | ||||
84 | return d->brushtip->hasColor(); | ||||
85 | } | ||||
86 | | ||||
87 | qreal BrushTip::scale() const | ||||
88 | { | ||||
89 | return d->brushtip->scale(); | ||||
90 | } | ||||
91 | | ||||
92 | void BrushTip::setScale(qreal scale) | ||||
93 | { | ||||
94 | d->brushtip->setScale(scale); | ||||
95 | } | ||||
96 | | ||||
97 | qreal BrushTip::angle() const | ||||
98 | { | ||||
99 | return d->brushtip->angle(); | ||||
100 | } | ||||
101 | | ||||
102 | void BrushTip::setAngle(qreal angle) | ||||
103 | { | ||||
104 | d->brushtip->setAngle(angle); | ||||
105 | } | ||||
106 | | ||||
107 | KisBrush *BrushTip::tip() | ||||
108 | { | ||||
109 | return d->brushtip; | ||||
110 | } | ||||
111 | |