| 1 | // Copyright (C) 2018 The Qt Company Ltd. | 
|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef BMSHAPE_P_H | 
|---|
| 5 | #define BMSHAPE_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 |  | 
|---|
| 20 | #include <QtBodymovin/private/bmbase_p.h> | 
|---|
| 21 | #include <QtBodymovin/private/bmproperty_p.h> | 
|---|
| 22 |  | 
|---|
| 23 | QT_BEGIN_NAMESPACE | 
|---|
| 24 |  | 
|---|
| 25 | class BMFill; | 
|---|
| 26 | class BMStroke; | 
|---|
| 27 | class BMTrimPath; | 
|---|
| 28 |  | 
|---|
| 29 | #define BM_SHAPE_ANY_TYPE_IX    -1 | 
|---|
| 30 | #define BM_SHAPE_ELLIPSE_IX     0 | 
|---|
| 31 | #define BM_SHAPE_FILL_IX        1 | 
|---|
| 32 | #define BM_SHAPE_GFILL_IX       2 | 
|---|
| 33 | #define BM_SHAPE_GSTROKE_IX     3 | 
|---|
| 34 | #define BM_SHAPE_GROUP_IX       4 | 
|---|
| 35 | #define BM_SHAPE_RECT_IX        5 | 
|---|
| 36 | #define BM_SHAPE_ROUND_IX       6 | 
|---|
| 37 | #define BM_SHAPE_SHAPE_IX       7 | 
|---|
| 38 | #define BM_SHAPE_STAR_IX        8 | 
|---|
| 39 | #define BM_SHAPE_STROKE_IX      9 | 
|---|
| 40 | #define BM_SHAPE_TRIM_IX        10 | 
|---|
| 41 | #define BM_SHAPE_TRANS_IX       11 | 
|---|
| 42 | #define BM_SHAPE_REPEATER_IX    12 | 
|---|
| 43 |  | 
|---|
| 44 | class BODYMOVIN_EXPORT BMShape : public BMBase | 
|---|
| 45 | { | 
|---|
| 46 | public: | 
|---|
| 47 | BMShape() = default; | 
|---|
| 48 | explicit BMShape(const BMShape &other); | 
|---|
| 49 |  | 
|---|
| 50 | BMBase *clone() const override; | 
|---|
| 51 |  | 
|---|
| 52 | static BMShape *construct(QJsonObject definition, const QVersionNumber &version, | 
|---|
| 53 | BMBase *parent = nullptr); | 
|---|
| 54 |  | 
|---|
| 55 | virtual const QPainterPath &path() const; | 
|---|
| 56 | virtual bool acceptsTrim() const; | 
|---|
| 57 | virtual void applyTrim(const BMTrimPath& trimmer); | 
|---|
| 58 |  | 
|---|
| 59 | int direction() const; | 
|---|
| 60 | bool hasReversedDirection() const { return m_direction == 3; } | 
|---|
| 61 |  | 
|---|
| 62 | protected: | 
|---|
| 63 | QPainterPath m_path; | 
|---|
| 64 | BMTrimPath *m_appliedTrim = nullptr; | 
|---|
| 65 | int m_direction = 0; | 
|---|
| 66 | }; | 
|---|
| 67 |  | 
|---|
| 68 | QT_END_NAMESPACE | 
|---|
| 69 |  | 
|---|
| 70 | #endif // BMSHAPE_P_H | 
|---|
| 71 |  | 
|---|