chalk

kis_tool_freehand.h
1/*
2 * kis_tool_brush.h - part of Chalk
3 *
4 * Copyright (c) 2003-2004 Boudewijn Rempt <boud@valdyas.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef KIS_TOOL_FREEHAND_H_
22#define KIS_TOOL_FREEHAND_H_
23
24#include "kis_types.h"
25#include "kis_tool_paint.h"
26#include "kis_point.h"
27#include "koffice_export.h"
28
29class KisPainter;
30class KisBrush;
31class KisEvent;
32class KisPaintLayer;
33
34
35class KRITACORE_EXPORT KisToolFreehand : public KisToolPaint {
36 TQ_OBJECT
37
38 typedef KisToolPaint super;
39
40public:
41 KisToolFreehand(const TQString transactionText);
42 virtual ~KisToolFreehand();
43
44 virtual void update(KisCanvasSubject *subject);
45
46 virtual void buttonPress(KisButtonPressEvent *e);
47 virtual void move(KisMoveEvent *e);
48 virtual void buttonRelease(KisButtonReleaseEvent *e);
49
50 virtual enumToolType toolType() { return TOOL_FREEHAND; }
51
52protected:
53 virtual void paintAt(const KisPoint &pos,
54 const double pressure,
55 const double xTilt,
56 const double yTilt);
57
58 virtual void paintLine(const KisPoint & pos1,
59 const double pressure1,
60 const double xtilt1,
61 const double ytilt1,
62 const KisPoint & pos2,
63 const double pressure2,
64 const double xtilt2,
65 const double ytilt2);
66
67 // XXX: why not make this a protected member attribute for the
68 // use of subclasses? BSAR.
69 inline KisPainter * painter() { return m_painter; };
70 virtual void initPaint(KisEvent *e);
71 virtual void endPaint();
72
73 KisImageSP currentImage();
74
75 void paintOutline(const KisPoint& point);
76
77protected:
78 KisPoint m_prevPos;
79 double m_prevPressure;
80 double m_prevXTilt;
81 double m_prevYTilt;
82 double m_dragDist;
83
84 bool m_paintIncremental;
85 bool m_paintOnSelection;
86
87 KisPaintDeviceSP m_target;
88 KisLayerSP m_tempLayer;
89 KisPaintDeviceSP m_source;
90
91 TQString m_transactionText;
92 enumBrushMode m_mode;
93 KisPainter *m_painter;
94
95 KisImageSP m_currentImage;
96private:
97 bool m_paintedOutline;
98};
99
100
101
102#endif // KIS_TOOL_FREEHAND_H_
103
This layer is of a type that can be painted on.
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.
Definition kis_painter.h:56