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_PARAMS_INTERFACE_H 20 #define __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H 21 22 #include "kritaimage_export.h" 23 #include "kis_types.h" 24 #include "kis_default_bounds_base.h" 25 26 #include <QScopedPointer> 27 28 29 class QTransform; 30 class QDomElement; 31 class KisKeyframeChannel; 32 33 class KRITAIMAGE_EXPORT KisTransformMaskParamsInterface 34 { 35 public: 36 virtual ~KisTransformMaskParamsInterface(); 37 38 virtual QTransform finalAffineTransform() const = 0; 39 virtual bool isAffine() const = 0; 40 virtual bool isHidden() const = 0; 41 42 virtual void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const = 0; 43 44 virtual QString id() const = 0; 45 virtual void toXML(QDomElement *e) const = 0; 46 47 virtual void translate(const QPointF &offset) = 0; 48 49 virtual QRect nonAffineChangeRect(const QRect &rc) = 0; 50 virtual QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds) = 0; 51 52 virtual void clearChangedFlag() = 0; 53 virtual bool hasChanged() const = 0; 54 }; 55 56 class KRITAIMAGE_EXPORT KisAnimatedTransformParamsInterface 57 { 58 public: 59 virtual ~KisAnimatedTransformParamsInterface(); 60 61 virtual KisKeyframeChannel *getKeyframeChannel(const QString &id, KisNodeSP parent) = 0; 62 }; 63 64 class QDomElement; 65 66 class KRITAIMAGE_EXPORT KisDumbTransformMaskParams : public KisTransformMaskParamsInterface 67 { 68 public: 69 KisDumbTransformMaskParams(); 70 KisDumbTransformMaskParams(const QTransform &transform); 71 KisDumbTransformMaskParams(bool isHidden); 72 ~KisDumbTransformMaskParams() override; 73 74 75 QTransform finalAffineTransform() const override; 76 bool isAffine() const override; 77 bool isHidden() const override; 78 void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const override; 79 80 QString id() const override; 81 void toXML(QDomElement *e) const override; 82 static KisTransformMaskParamsInterfaceSP fromXML(const QDomElement &e); 83 84 void translate(const QPointF &offset) override; 85 86 // for tesing purposes only 87 QTransform testingGetTransform() const; 88 void testingSetTransform(const QTransform &t); 89 90 QRect nonAffineChangeRect(const QRect &rc) override; 91 QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds) override; 92 93 bool isAnimated() const; 94 KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds); 95 void clearChangedFlag() override; 96 bool hasChanged() const override; 97 98 private: 99 struct Private; 100 const QScopedPointer<Private> m_d; 101 }; 102 103 #endif /* __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H */ 104