1 /*
2  *  Copyright (c) 2008-2009 Cyrille Berger <cberger@cberger.net>
3  *  Copyright (c) 2018 Ivan Santa Maria <ghevan@gmail.com>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef _KIS_RECT_MASK_GENERATOR_H_
21 #define _KIS_RECT_MASK_GENERATOR_H_
22 
23 #include <QScopedPointer>
24 #include "kritaimage_export.h"
25 
26 #include "kis_mask_generator.h"
27 
28 /**
29  * Represent, serialize and deserialize a rectangular 8-bit mask.
30  */
31 class KRITAIMAGE_EXPORT KisRectangleMaskGenerator : public KisMaskGenerator
32 {
33 public:
34     struct FastRowProcessor;
35 public:
36 
37     KisRectangleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges);
38     KisRectangleMaskGenerator(const KisRectangleMaskGenerator &rhs);
39     ~KisRectangleMaskGenerator() override;
40 
41     KisMaskGenerator* clone() const override;
42 
43     bool shouldSupersample() const override;
44     quint8 valueAt(qreal x, qreal y) const override;
45     void setScale(qreal scaleX, qreal scaleY) override;
46     void setSoftness(qreal softness) override;
47 
48     bool shouldVectorize() const override;
49     KisBrushMaskApplicatorBase* applicator() override;
50     void resetMaskApplicator(bool forceScalar);
51 
52 private:
53     struct Private;
54     const QScopedPointer<Private> d;
55 };
56 
57 #endif
58