krita

kis_tool_freehand.h

00001 /*
00002  *  kis_tool_brush.h - part of Krita
00003  *
00004  *  Copyright (c) 2003-2004 Boudewijn Rempt <boud@valdyas.org>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef KIS_TOOL_FREEHAND_H_
00022 #define KIS_TOOL_FREEHAND_H_
00023 
00024 #include "kis_types.h"
00025 #include "kis_tool_paint.h"
00026 #include "kis_point.h"
00027 #include "koffice_export.h"
00028 
00029 class KisPainter;
00030 class KisBrush;
00031 class KisEvent;
00032 class KisPaintLayer;
00033 
00034 
00035 class KRITACORE_EXPORT KisToolFreehand : public KisToolPaint {
00036     Q_OBJECT
00037     typedef KisToolPaint super;
00038 
00039 public:
00040     KisToolFreehand(const QString transactionText);
00041     virtual ~KisToolFreehand();
00042 
00043     virtual void update(KisCanvasSubject *subject);
00044 
00045     virtual void buttonPress(KisButtonPressEvent *e);
00046     virtual void move(KisMoveEvent *e);
00047     virtual void buttonRelease(KisButtonReleaseEvent *e);
00048 
00049     virtual enumToolType toolType() { return TOOL_FREEHAND; }
00050 
00051 protected:
00052     virtual void paintAt(const KisPoint &pos,
00053                  const double pressure,
00054                  const double xTilt,
00055                  const double yTilt);
00056 
00057     virtual void paintLine(const KisPoint & pos1,
00058                    const double pressure1,
00059                    const double xtilt1,
00060                    const double ytilt1,
00061                    const KisPoint & pos2,
00062                    const double pressure2,
00063                    const double xtilt2,
00064                    const double ytilt2);
00065 
00066     // XXX: why not make this a protected member attribute for the
00067     // use of subclasses? BSAR.
00068     inline KisPainter * painter() { return m_painter; };
00069     virtual void initPaint(KisEvent *e);
00070     virtual void endPaint();
00071 
00072     KisImageSP currentImage();
00073 
00074     void paintOutline(const KisPoint& point);
00075 
00076 protected:
00077     KisPoint m_prevPos;
00078     double m_prevPressure;
00079     double m_prevXTilt;
00080     double m_prevYTilt;
00081     double m_dragDist;
00082 
00083     bool m_paintIncremental;
00084     bool m_paintOnSelection;
00085     
00086     KisPaintDeviceSP m_target;
00087     KisLayerSP m_tempLayer;
00088     KisPaintDeviceSP m_source;
00089 
00090     QString m_transactionText;
00091     enumBrushMode m_mode;
00092     KisPainter *m_painter;
00093 
00094     KisImageSP m_currentImage;
00095 private:
00096     bool m_paintedOutline;
00097 };
00098 
00099 
00100 
00101 #endif // KIS_TOOL_FREEHAND_H_
00102 
KDE Home | KDE Accessibility Home | Description of Access Keys