| 1 | // Copyright (C) 2018 The Qt Company Ltd. | 
|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef BMTRIMPATH_P_H | 
|---|
| 5 | #define BMTRIMPATH_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 <QtBodymovin/private/bmproperty_p.h> | 
|---|
| 22 | #include <QtBodymovin/private/bmgroup_p.h> | 
|---|
| 23 |  | 
|---|
| 24 | QT_BEGIN_NAMESPACE | 
|---|
| 25 |  | 
|---|
| 26 | class BODYMOVIN_EXPORT BMTrimPath : public BMShape | 
|---|
| 27 | { | 
|---|
| 28 | public: | 
|---|
| 29 | BMTrimPath(); | 
|---|
| 30 | BMTrimPath(const QJsonObject &definition, const QVersionNumber &version, | 
|---|
| 31 | BMBase *parent = nullptr); | 
|---|
| 32 | explicit BMTrimPath(const BMTrimPath &other); | 
|---|
| 33 |  | 
|---|
| 34 | void inherit(const BMTrimPath &other); | 
|---|
| 35 |  | 
|---|
| 36 | BMBase *clone() const override; | 
|---|
| 37 |  | 
|---|
| 38 | void construct(const QJsonObject &definition, const QVersionNumber &version); | 
|---|
| 39 |  | 
|---|
| 40 | void updateProperties(int frame) override; | 
|---|
| 41 | void render(LottieRenderer &renderer) const override; | 
|---|
| 42 |  | 
|---|
| 43 | bool acceptsTrim() const override; | 
|---|
| 44 | void applyTrim(const BMTrimPath  &trimmer) override; | 
|---|
| 45 |  | 
|---|
| 46 | qreal start() const; | 
|---|
| 47 | qreal end() const; | 
|---|
| 48 | qreal offset() const; | 
|---|
| 49 | bool simultaneous() const; | 
|---|
| 50 |  | 
|---|
| 51 | QPainterPath trim(const QPainterPath &path) const; | 
|---|
| 52 |  | 
|---|
| 53 | protected: | 
|---|
| 54 | BMProperty<qreal> m_start; | 
|---|
| 55 | BMProperty<qreal> m_end; | 
|---|
| 56 | BMProperty<qreal> m_offset; | 
|---|
| 57 | bool m_simultaneous = false; | 
|---|
| 58 | }; | 
|---|
| 59 |  | 
|---|
| 60 | QT_END_NAMESPACE | 
|---|
| 61 |  | 
|---|
| 62 | #endif // BMTRIMPATH_P_H | 
|---|
| 63 |  | 
|---|