File indexing completed on 2024-06-16 04:17:59

0001 /*
0002  *  SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_LIQUIFY_PROPERTIES_H
0008 #define __KIS_LIQUIFY_PROPERTIES_H
0009 
0010 #include <QtGlobal>
0011 #include <QDebug>
0012 #include <boost/operators.hpp>
0013 #include "kritatooltransform_export.h"
0014 
0015 class QDomElement;
0016 
0017 
0018 class KRITATOOLTRANSFORM_EXPORT KisLiquifyProperties : boost::equality_comparable<KisLiquifyProperties>
0019 {
0020 public:
0021     enum LiquifyMode {
0022         MOVE,
0023         SCALE,
0024         ROTATE,
0025         OFFSET,
0026         UNDO,
0027 
0028         N_MODES
0029     };
0030 
0031     KisLiquifyProperties()
0032         : m_mode(MOVE),
0033           m_size(60),
0034           m_amount(0.05),
0035           m_spacing(0.2),
0036           m_sizeHasPressure(false),
0037           m_amountHasPressure(false),
0038           m_reverseDirection(false),
0039           m_useWashMode(false),
0040           m_flow(0.2)
0041     {
0042     }
0043 
0044 
0045     KisLiquifyProperties(const KisLiquifyProperties &rhs);
0046 
0047     KisLiquifyProperties& operator=(const KisLiquifyProperties &rhs);
0048 
0049     bool operator==(const KisLiquifyProperties &other) const;
0050 
0051     LiquifyMode mode() const {
0052         return m_mode;
0053     }
0054     void setMode(LiquifyMode value) {
0055         m_mode = value;
0056     }
0057 
0058     qreal size() const {
0059         return m_size;
0060     }
0061     void setSize(qreal value) {
0062         m_size = value;
0063     }
0064 
0065     static qreal minSize() {
0066         return 5.0;
0067     }
0068 
0069     static qreal maxSize() {
0070         return 1000.0;
0071     }
0072 
0073     qreal amount() const {
0074         return m_amount;
0075     }
0076     void setAmount(qreal value) {
0077         m_amount = value;
0078     }
0079 
0080     qreal spacing() const {
0081         return m_spacing;
0082     }
0083     void setSpacing(qreal value) {
0084         m_spacing = value;
0085     }
0086 
0087     bool sizeHasPressure() const {
0088         return m_sizeHasPressure;
0089     }
0090     void setSizeHasPressure(bool value) {
0091         m_sizeHasPressure = value;
0092     }
0093 
0094     bool amountHasPressure() const {
0095         return m_amountHasPressure;
0096     }
0097     void setAmountHasPressure(bool value) {
0098         m_amountHasPressure = value;
0099     }
0100 
0101     bool reverseDirection() const {
0102         return m_reverseDirection;
0103     }
0104     void setReverseDirection(bool value) {
0105         m_reverseDirection = value;
0106     }
0107 
0108     bool useWashMode() const {
0109         return m_useWashMode;
0110     }
0111     void setUseWashMode(bool value) {
0112         m_useWashMode = value;
0113     }
0114 
0115     qreal flow() const {
0116         return m_flow;
0117     }
0118     void setFlow(qreal value) {
0119         m_flow = value;
0120     }
0121 
0122     void saveMode() const;
0123     void loadMode();
0124 
0125     void loadAndResetMode();
0126 
0127     void toXML(QDomElement *e) const;
0128     static KisLiquifyProperties fromXML(const QDomElement &e);
0129 
0130 private:
0131     LiquifyMode m_mode;
0132     qreal m_size;
0133     qreal m_amount;
0134     qreal m_spacing;
0135     bool m_sizeHasPressure;
0136     bool m_amountHasPressure;
0137     bool m_reverseDirection;
0138 
0139     bool m_useWashMode;
0140     qreal m_flow;
0141 };
0142 
0143 QDebug KRITATOOLTRANSFORM_EXPORT operator<<(QDebug dbg, const KisLiquifyProperties &properties);
0144 
0145 #endif /* __KIS_LIQUIFY_PROPERTIES_H */