~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/paintops/sumie/brush.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
3
 
 *
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.
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 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 _BRUSH_H_
20
 
#define _BRUSH_H_
21
 
 
22
 
#include <QVector>
23
 
#include <QList>
24
 
#include <QTransform>
25
 
 
26
 
#include <KoColor.h>
27
 
 
28
 
#include "bristle.h"
29
 
#include "brush_shape.h"
30
 
 
31
 
#include <kis_paint_device.h>
32
 
#include <kis_paint_information.h>
33
 
#include <kis_random_accessor.h>
34
 
 
35
 
class Brush
36
 
{
37
 
 
38
 
public:
39
 
    Brush(const BrushShape &initialShape, const KoColor &inkColor);
40
 
    Brush();
41
 
    ~Brush();
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);
46
 
 
47
 
    void repositionBristles(double angle, double slope);
48
 
    void rotateBristles(double angle);
49
 
 
50
 
    double getAngleDelta(const KisPaintInformation& info);
51
 
 
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);
57
 
 
58
 
    void setShear(double shearFactor) {
59
 
        m_shearFactor = shearFactor;
60
 
    }
61
 
    void setRandom(double randomFactor) {
62
 
        m_randomFactor = randomFactor;
63
 
    }
64
 
    void setScale(double scaleFactor) {
65
 
        m_scaleFactor = scaleFactor;
66
 
    }
67
 
 
68
 
    void enableWeights(bool useWeights) {
69
 
        m_useWeights = useWeights;
70
 
    }
71
 
    void enableSaturation(bool useSaturation) {
72
 
        m_useSaturation = useSaturation;
73
 
    }
74
 
    void enableOpacity(bool useOpacity) {
75
 
        m_useOpacity = useOpacity;
76
 
    }
77
 
 
78
 
 
79
 
    void setPressureWeight(double pressureWeight) {
80
 
        m_pressureWeight = pressureWeight;
81
 
    }
82
 
    void setBristleLengthWeight(double bristleLengthWeight) {
83
 
        m_bristleLengthWeight = bristleLengthWeight;
84
 
    }
85
 
    void setBristleInkAmountWeight(double bristleInkAmountWeight) {
86
 
        m_bristleInkAmountWeight = bristleInkAmountWeight;
87
 
    }
88
 
    void setInkDepletionWeight(double inkDepletionWeight) {
89
 
        m_inkDepletionWeight = inkDepletionWeight;
90
 
    }
91
 
 
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();
98
 
 
99
 
private:
100
 
    QVector<Bristle> m_bristles;
101
 
    QList<float> m_inkDepletion; // array
102
 
    QTransform m_transform;
103
 
 
104
 
 
105
 
    BrushShape m_initialShape;
106
 
    KoColor m_inkColor;
107
 
 
108
 
    // temporary device
109
 
    KisPaintDeviceSP m_dev;
110
 
    KisRandomAccessor * m_dabAccessor;
111
 
    quint32 m_pixelSize;
112
 
 
113
 
    // painter()->device()
114
 
    KisPaintDeviceSP m_layer;
115
 
    KisRandomAccessor * m_layerAccessor;
116
 
    quint32 m_layerPixelSize;
117
 
 
118
 
    int m_counter;
119
 
 
120
 
    int m_radius;
121
 
    double m_sigma;
122
 
 
123
 
    double m_lastAngle;
124
 
    double m_lastSlope;
125
 
 
126
 
    double m_angle;
127
 
    double m_oldPressure;
128
 
 
129
 
    bool m_mousePressureEnabled;
130
 
 
131
 
    double m_scaleFactor;
132
 
    double m_randomFactor;
133
 
    double m_shearFactor;
134
 
 
135
 
    double m_pressureWeight;
136
 
    double m_bristleLengthWeight;
137
 
    double m_bristleInkAmountWeight;
138
 
    double m_inkDepletionWeight;
139
 
 
140
 
    bool m_useWeights;
141
 
    bool m_useSaturation;
142
 
    bool m_useOpacity;
143
 
};
144
 
 
145
 
#endif