krita

kis_autobrush_resource.h

00001 /*
00002  *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef _KIS_AUTOBRUSH_RESOURCE_H_
00020 #define _KIS_AUTOBRUSH_RESOURCE_H_
00021 
00022 #include "kis_brush.h"
00023 
00024 class KisAutobrushShape {
00025     public:
00026         KisAutobrushShape(Q_INT32 w, Q_INT32 h, double fh, double fv) : m_w(w), m_h(h), m_fh(fh), m_fv(fv)
00027         { };
00028         void createBrush( QImage* img);
00029     protected:
00030         virtual Q_INT8 valueAt(Q_INT32 x, Q_INT32 y) =0;
00031         Q_INT32 m_w, m_h;
00032         double m_fh, m_fv;
00033 };
00034 
00035 class KisAutobrushCircleShape : public KisAutobrushShape {
00036     public:
00037         KisAutobrushCircleShape(Q_INT32 w, Q_INT32 h, double fh, double fv);
00038     public:
00039         virtual Q_INT8 valueAt(Q_INT32 x, Q_INT32 y);
00040     private:
00041         double norme(double a, double b)
00042         {
00043             return a*a + b * b;
00044         }
00045     private:
00046         double m_xcentre, m_ycentre;
00047         double m_xcoef, m_ycoef;
00048         double m_xfadecoef, m_yfadecoef;
00049 };
00050 
00051 class KisAutobrushRectShape : public KisAutobrushShape {
00052     public:
00053         KisAutobrushRectShape(Q_INT32 w, Q_INT32 h, double fh, double fv);
00054     protected:
00055         virtual Q_INT8 valueAt(Q_INT32 x, Q_INT32 y);
00056     private:
00057         double m_xcentre, m_ycentre, m_c;
00058 };
00059 
00060 class KisAutobrushResource : public KisBrush
00061 {
00062     public:
00063         KisAutobrushResource(QImage& img) : KisBrush("")
00064         {
00065             setImage(img);
00066             setBrushType(MASK);
00067         };
00068     public:
00069         virtual bool load() { return false; };
00070 };
00071 #endif // _KIS_AUTOBRUSH_RESOURCE_H_
KDE Home | KDE Accessibility Home | Description of Access Keys