File indexing completed on 2024-05-12 15:56:10

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Nishant Rodrigues <nishantjr@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 #include <QtGlobal>
0009 
0010 class KisDabShape {
0011     qreal m_scale;
0012     qreal m_ratio;
0013     qreal m_rotation;
0014 
0015 public:
0016 
0017     KisDabShape()
0018         : m_scale(1.0)
0019         , m_ratio(1.0)
0020         , m_rotation(0.0)
0021     {}
0022     KisDabShape(qreal scale, qreal ratio, qreal rotation)
0023         : m_scale(scale)
0024         , m_ratio(ratio)
0025         , m_rotation(rotation)
0026     {}
0027 
0028     bool operator==(const KisDabShape &rhs) const {
0029         return
0030             qFuzzyCompare(m_scale, rhs.m_scale) &&
0031             qFuzzyCompare(m_ratio, rhs.m_ratio) &&
0032             qFuzzyCompare(m_rotation, rhs.m_rotation);
0033     }
0034 
0035     qreal scale()    const { return m_scale; }
0036     qreal scaleX()   const { return scale(); }
0037     qreal scaleY()   const { return m_scale * m_ratio; }
0038     qreal ratio()    const { return m_ratio; }
0039     qreal rotation() const { return m_rotation; }
0040 };