Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:07:22

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QEASINGCURVE_H
0005 #define QEASINGCURVE_H
0006 
0007 #include <QtCore/qglobal.h>
0008 
0009 QT_REQUIRE_CONFIG(easingcurve);
0010 
0011 #include <QtCore/qlist.h>
0012 #include <QtCore/qobjectdefs.h>
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QEasingCurvePrivate;
0017 class QPointF;
0018 class Q_CORE_EXPORT QEasingCurve
0019 {
0020     Q_GADGET
0021 public:
0022     enum Type {
0023         Linear,
0024         InQuad, OutQuad, InOutQuad, OutInQuad,
0025         InCubic, OutCubic, InOutCubic, OutInCubic,
0026         InQuart, OutQuart, InOutQuart, OutInQuart,
0027         InQuint, OutQuint, InOutQuint, OutInQuint,
0028         InSine, OutSine, InOutSine, OutInSine,
0029         InExpo, OutExpo, InOutExpo, OutInExpo,
0030         InCirc, OutCirc, InOutCirc, OutInCirc,
0031         InElastic, OutElastic, InOutElastic, OutInElastic,
0032         InBack, OutBack, InOutBack, OutInBack,
0033         InBounce, OutBounce, InOutBounce, OutInBounce,
0034         InCurve, OutCurve, SineCurve, CosineCurve,
0035         BezierSpline, TCBSpline, Custom, NCurveTypes
0036     };
0037     Q_ENUM(Type)
0038 
0039     QEasingCurve(Type type = Linear);
0040     QEasingCurve(const QEasingCurve &other);
0041     ~QEasingCurve();
0042 
0043     QEasingCurve &operator=(const QEasingCurve &other)
0044     { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; }
0045     QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; }
0046     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEasingCurve)
0047 
0048     void swap(QEasingCurve &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
0049 
0050     bool operator==(const QEasingCurve &other) const;
0051     inline bool operator!=(const QEasingCurve &other) const
0052     { return !(this->operator==(other)); }
0053 
0054     qreal amplitude() const;
0055     void setAmplitude(qreal amplitude);
0056 
0057     qreal period() const;
0058     void setPeriod(qreal period);
0059 
0060     qreal overshoot() const;
0061     void setOvershoot(qreal overshoot);
0062 
0063     void addCubicBezierSegment(const QPointF &c1, const QPointF &c2, const QPointF &endPoint);
0064     void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
0065     QList<QPointF> toCubicSpline() const;
0066 
0067     Type type() const;
0068     void setType(Type type);
0069     typedef qreal (*EasingFunction)(qreal progress);
0070     void setCustomType(EasingFunction func);
0071     EasingFunction customType() const;
0072 
0073     qreal valueForProgress(qreal progress) const;
0074 
0075 private:
0076     QEasingCurvePrivate *d_ptr;
0077 #ifndef QT_NO_DEBUG_STREAM
0078     friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
0079 #endif
0080 #ifndef QT_NO_DATASTREAM
0081     friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &);
0082     friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
0083 #endif
0084 };
0085 Q_DECLARE_SHARED(QEasingCurve)
0086 
0087 #ifndef QT_NO_DEBUG_STREAM
0088 Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
0089 #endif
0090 
0091 #ifndef QT_NO_DATASTREAM
0092 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &);
0093 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
0094 #endif
0095 
0096 QT_END_NAMESPACE
0097 
0098 #endif