1 /*
2  *  Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
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_TRANSFORM_MASK_ADAPTER_H
20 #define __KIS_TRANSFORM_MASK_ADAPTER_H
21 
22 #include <QScopedPointer>
23 #include "kis_transform_mask_params_interface.h"
24 #include "kritatooltransform_export.h"
25 
26 class ToolTransformArgs;
27 
28 
29 class KRITATOOLTRANSFORM_EXPORT KisTransformMaskAdapter : public KisTransformMaskParamsInterface
30 {
31 public:
32     KisTransformMaskAdapter(const ToolTransformArgs &args);
33     ~KisTransformMaskAdapter() override;
34 
35     QTransform finalAffineTransform() const override;
36     bool isAffine() const override;
37     bool isHidden() const override;
38 
39     void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const override;
40 
41     virtual const ToolTransformArgs& transformArgs() const;
42 
43     QString id() const override;
44     void toXML(QDomElement *e) const override;
45     static KisTransformMaskParamsInterfaceSP fromXML(const QDomElement &e);
46 
47     void translate(const QPointF &offset) override;
48 
49     QRect nonAffineChangeRect(const QRect &rc) override;
50     QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds) override;
51 
52     bool isAnimated() const;
53     KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds);
54     void clearChangedFlag() override;
55     bool hasChanged() const override;
56 
57 private:
58     struct Private;
59     const QScopedPointer<Private> m_d;
60 };
61 
62 #endif /* __KIS_TRANSFORM_MASK_ADAPTER_H */
63