Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/tool/strokes/kis_color_picker_stroke_strategy.h
Show All 14 Lines | |||||
15 | * along with this program; if not, write to the Free Software | 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. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #ifndef __KIS_COLOR_PICKER_STROKE_STRATEGY_H | 19 | #ifndef __KIS_COLOR_PICKER_STROKE_STRATEGY_H | ||
20 | #define __KIS_COLOR_PICKER_STROKE_STRATEGY_H | 20 | #define __KIS_COLOR_PICKER_STROKE_STRATEGY_H | ||
21 | 21 | | |||
22 | #include <QObject> | 22 | #include <QObject> | ||
23 | #include <QScopedPointer> | | |||
24 | #include "kis_simple_stroke_strategy.h" | 23 | #include "kis_simple_stroke_strategy.h" | ||
25 | #include "kis_lod_transform.h" | 24 | #include "kis_lod_transform.h" | ||
26 | 25 | #include "KoColor.h" | |||
27 | class KoColor; | | |||
28 | | ||||
29 | 26 | | |||
30 | class KisColorPickerStrokeStrategy : public QObject, public KisSimpleStrokeStrategy | 27 | class KisColorPickerStrokeStrategy : public QObject, public KisSimpleStrokeStrategy | ||
31 | { | 28 | { | ||
32 | Q_OBJECT | 29 | Q_OBJECT | ||
33 | public: | 30 | public: | ||
34 | class Data : public KisStrokeJobData { | 31 | class Data : public KisStrokeJobData { | ||
35 | public: | 32 | public: | ||
36 | Data(KisPaintDeviceSP _dev, const QPoint _pt) | 33 | Data(KisPaintDeviceSP _dev, const QPoint _pt, KoColor _currentColor) | ||
37 | : dev(_dev), pt(_pt) | 34 | : dev(_dev), pt(_pt), currentColor(_currentColor) | ||
38 | {} | 35 | {} | ||
39 | 36 | | |||
40 | KisStrokeJobData* createLodClone(int levelOfDetail) override { | 37 | KisStrokeJobData* createLodClone(int levelOfDetail) override { | ||
41 | KisLodTransform t(levelOfDetail); | 38 | KisLodTransform t(levelOfDetail); | ||
42 | const QPoint realPoint = t.map(pt); | 39 | const QPoint realPoint = t.map(pt); | ||
43 | 40 | | |||
44 | return new Data(dev, realPoint); | 41 | return new Data(dev, realPoint, currentColor); | ||
45 | } | 42 | } | ||
46 | 43 | | |||
47 | KisPaintDeviceSP dev; | 44 | KisPaintDeviceSP dev; | ||
48 | QPoint pt; | 45 | QPoint pt; | ||
46 | KoColor currentColor; // Used for color picker blending. | ||||
49 | }; | 47 | }; | ||
50 | public: | 48 | public: | ||
51 | KisColorPickerStrokeStrategy(int lod = 0); | 49 | KisColorPickerStrokeStrategy(int lod = 0); | ||
52 | ~KisColorPickerStrokeStrategy() override; | 50 | ~KisColorPickerStrokeStrategy() override; | ||
53 | 51 | | |||
54 | void doStrokeCallback(KisStrokeJobData *data) override; | 52 | void doStrokeCallback(KisStrokeJobData *data) override; | ||
55 | KisStrokeStrategy* createLodClone(int levelOfDetail) override; | 53 | KisStrokeStrategy* createLodClone(int levelOfDetail) override; | ||
56 | 54 | | |||
Show All 9 Lines |