2
* Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU 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.
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.
14
* You should have received a copy of the GNU 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.
29
#include "brush_shape.h"
31
#include <kis_paint_device.h>
32
#include <kis_paint_information.h>
33
#include <kis_random_accessor.h>
39
Brush(const BrushShape &initialShape, const KoColor &inkColor);
42
void paint(KisPaintDeviceSP dev, const KisPaintInformation &info);
43
void paintLine(KisPaintDeviceSP dev, KisPaintDeviceSP layer, const KisPaintInformation &pi1, const KisPaintInformation &pi2);
44
void setInkDepletion(const QList<float>& curveData);
45
void setInkColor(const KoColor &color);
47
void repositionBristles(double angle, double slope);
48
void rotateBristles(double angle);
50
double getAngleDelta(const KisPaintInformation& info);
52
void setRadius(int radius);
53
void setSigma(double sigma);
54
void setBrushShape(BrushShape brushShape);
55
double computeMousePressure(double distance);
56
void enableMousePressure(bool enable);
58
void setShear(double shearFactor) {
59
m_shearFactor = shearFactor;
61
void setRandom(double randomFactor) {
62
m_randomFactor = randomFactor;
64
void setScale(double scaleFactor) {
65
m_scaleFactor = scaleFactor;
68
void enableWeights(bool useWeights) {
69
m_useWeights = useWeights;
71
void enableSaturation(bool useSaturation) {
72
m_useSaturation = useSaturation;
74
void enableOpacity(bool useOpacity) {
75
m_useOpacity = useOpacity;
79
void setPressureWeight(double pressureWeight) {
80
m_pressureWeight = pressureWeight;
82
void setBristleLengthWeight(double bristleLengthWeight) {
83
m_bristleLengthWeight = bristleLengthWeight;
85
void setBristleInkAmountWeight(double bristleInkAmountWeight) {
86
m_bristleInkAmountWeight = bristleInkAmountWeight;
88
void setInkDepletionWeight(double inkDepletionWeight) {
89
m_inkDepletionWeight = inkDepletionWeight;
92
/// paints single bristle
93
void putBristle(Bristle *bristle, float wx, float wy, const KoColor &color);
94
void mixCMY(double x, double y, int cyan, int magenta, int yellow, double weight);
95
void addBristleInk(Bristle *bristle, float wx, float wy, const KoColor &color);
96
void oldAddBristleInk(Bristle *bristle, float wx, float wy, const KoColor &color);
97
void initDefaultValues();
100
QVector<Bristle> m_bristles;
101
QList<float> m_inkDepletion; // array
102
QTransform m_transform;
105
BrushShape m_initialShape;
109
KisPaintDeviceSP m_dev;
110
KisRandomAccessor * m_dabAccessor;
113
// painter()->device()
114
KisPaintDeviceSP m_layer;
115
KisRandomAccessor * m_layerAccessor;
116
quint32 m_layerPixelSize;
127
double m_oldPressure;
129
bool m_mousePressureEnabled;
131
double m_scaleFactor;
132
double m_randomFactor;
133
double m_shearFactor;
135
double m_pressureWeight;
136
double m_bristleLengthWeight;
137
double m_bristleInkAmountWeight;
138
double m_inkDepletionWeight;
141
bool m_useSaturation;