| 1 | // Copyright (C) 2018 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QLOTTIETRIMPATH_P_H |
| 5 | #define QLOTTIETRIMPATH_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QPainterPath> |
| 19 | #include <QJsonObject> |
| 20 | |
| 21 | #include <QtLottie/private/qlottieproperty_p.h> |
| 22 | #include <QtLottie/private/qlottiegroup_p.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class Q_LOTTIE_EXPORT QLottieTrimPath : public QLottieShape |
| 27 | { |
| 28 | public: |
| 29 | QLottieTrimPath(); |
| 30 | QLottieTrimPath(const QJsonObject &definition, QLottieBase *parent = nullptr); |
| 31 | explicit QLottieTrimPath(const QLottieTrimPath &other); |
| 32 | |
| 33 | void inherit(const QLottieTrimPath &other); |
| 34 | |
| 35 | QLottieBase *clone() const override; |
| 36 | |
| 37 | void construct(const QJsonObject &definition); |
| 38 | |
| 39 | void updateProperties(int frame) override; |
| 40 | void render(QLottieRenderer &renderer) const override; |
| 41 | |
| 42 | bool acceptsTrim() const override; |
| 43 | void applyTrim(const QLottieTrimPath &trimmer) override; |
| 44 | |
| 45 | qreal start() const; |
| 46 | qreal end() const; |
| 47 | qreal offset() const; |
| 48 | bool isParallel() const; |
| 49 | |
| 50 | QPainterPath trim(const QPainterPath &path) const; |
| 51 | |
| 52 | QLottieProperty<qreal> startProperty() const { return m_start; } |
| 53 | QLottieProperty<qreal> endProperty() const { return m_end; } |
| 54 | QLottieProperty<qreal> offsetProperty() const { return m_offset; } |
| 55 | |
| 56 | protected: |
| 57 | QLottieProperty<qreal> m_start; |
| 58 | QLottieProperty<qreal> m_end; |
| 59 | QLottieProperty<qreal> m_offset; |
| 60 | bool m_isParallel = false; |
| 61 | }; |
| 62 | |
| 63 | QT_END_NAMESPACE |
| 64 | |
| 65 | #endif // QLOTTIETRIMPATH_P_H |
| 66 | |