1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QLOTTIESHAPE_P_H
5#define QLOTTIESHAPE_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 <QtLottie/private/qlottiebase_p.h>
21#include <QtLottie/private/qlottieproperty_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class QLottieFill;
26class QLottieStroke;
27class QLottieTrimPath;
28
29#define LOTTIE_SHAPE_ANY_TYPE_IX -1
30#define LOTTIE_SHAPE_ELLIPSE_IX 0
31#define LOTTIE_SHAPE_FILL_IX 1
32#define LOTTIE_SHAPE_GFILL_IX 2
33#define LOTTIE_SHAPE_GSTROKE_IX 3
34#define LOTTIE_SHAPE_GROUP_IX 4
35#define LOTTIE_SHAPE_RECT_IX 5
36#define LOTTIE_SHAPE_ROUND_IX 6
37#define LOTTIE_SHAPE_SHAPE_IX 7
38#define LOTTIE_SHAPE_STAR_IX 8
39#define LOTTIE_SHAPE_STROKE_IX 9
40#define LOTTIE_SHAPE_TRIM_IX 10
41#define LOTTIE_SHAPE_TRANS_IX 11
42#define LOTTIE_SHAPE_REPEATER_IX 12
43
44class Q_LOTTIE_EXPORT QLottieShape : public QLottieBase
45{
46public:
47 QLottieShape() = default;
48 explicit QLottieShape(const QLottieShape &other);
49
50 QLottieBase *clone() const override;
51
52 static QLottieShape *construct(QJsonObject definition, QLottieBase *parent = nullptr);
53
54 virtual const QPainterPath &path() const;
55 virtual bool acceptsTrim() const;
56 virtual void applyTrim(const QLottieTrimPath& trimmer);
57 const QLottieTrimPath *currentTrim() const { return m_appliedTrim; };
58
59 int direction() const;
60 bool hasReversedDirection() const { return m_direction == 3; }
61
62protected:
63 QPainterPath m_path;
64 QLottieTrimPath *m_appliedTrim = nullptr;
65 int m_direction = 0;
66};
67
68QT_END_NAMESPACE
69
70#endif // QLOTTIESHAPE_P_H
71

source code of qtlottie/src/lottie/qlottieshape_p.h