chalk

kis_autobrush_resource.h
1/*
2 * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
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 _KIS_AUTOBRUSH_RESOURCE_H_
20#define _KIS_AUTOBRUSH_RESOURCE_H_
21
22#include "kis_brush.h"
23
24class KisAutobrushShape {
25 public:
26 KisAutobrushShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv) : m_w(w), m_h(h), m_fh(fh), m_fv(fv)
27 { };
28 void createBrush( TQImage* img);
29 protected:
30 virtual TQ_INT8 valueAt(TQ_INT32 x, TQ_INT32 y) =0;
31 TQ_INT32 m_w, m_h;
32 double m_fh, m_fv;
33};
34
35class KisAutobrushCircleShape : public KisAutobrushShape {
36 public:
37 KisAutobrushCircleShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv);
38 public:
39 virtual TQ_INT8 valueAt(TQ_INT32 x, TQ_INT32 y);
40 private:
41 double norme(double a, double b)
42 {
43 return a*a + b * b;
44 }
45 private:
46 double m_xcentre, m_ycentre;
47 double m_xcoef, m_ycoef;
48 double m_xfadecoef, m_yfadecoef;
49};
50
51class KisAutobrushRectShape : public KisAutobrushShape {
52 public:
53 KisAutobrushRectShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv);
54 protected:
55 virtual TQ_INT8 valueAt(TQ_INT32 x, TQ_INT32 y);
56 private:
57 double m_xcentre, m_ycentre, m_c;
58};
59
60class KisAutobrushResource : public KisBrush
61{
62 public:
63 KisAutobrushResource(TQImage& img) : KisBrush("")
64 {
65 setImage(img);
66 setBrushType(MASK);
67 };
68 public:
69 virtual bool load() { return false; };
70};
71#endif // _KIS_AUTOBRUSH_RESOURCE_H_