1 | // Copyright (C) 2020 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef LOTTIERENDERER_H |
5 | #define LOTTIERENDERER_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 <QStack> |
19 | #include <private/qglobal_p.h> |
20 | |
21 | #include "bmglobal.h" |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class BMBase; |
26 | class BMLayer; |
27 | class BMRect; |
28 | class BMFill; |
29 | class BMGFill; |
30 | class BMImage; |
31 | class BMStroke; |
32 | class BMBasicTransform; |
33 | class BMLayerTransform; |
34 | class BMShapeTransform; |
35 | class BMRepeaterTransform; |
36 | class BMShapeLayer; |
37 | class BMEllipse; |
38 | class BMRound; |
39 | class BMFreeFormShape; |
40 | class BMTrimPath; |
41 | class BMFillEffect; |
42 | class BMRepeater; |
43 | |
44 | class BODYMOVIN_EXPORT LottieRenderer |
45 | { |
46 | public: |
47 | enum TrimmingState{Off = 0, Simultaneous, Individual}; |
48 | |
49 | virtual ~LottieRenderer() = default; |
50 | |
51 | virtual void saveState() = 0; |
52 | virtual void restoreState() = 0; |
53 | |
54 | virtual void setTrimmingState(TrimmingState state); |
55 | virtual TrimmingState trimmingState() const; |
56 | |
57 | virtual void render(const BMLayer &layer) = 0; |
58 | virtual void render(const BMRect &rect) = 0; |
59 | virtual void render(const BMEllipse &ellipse) = 0; |
60 | virtual void render(const BMRound &round) = 0; |
61 | virtual void render(const BMFill &fill) = 0; |
62 | virtual void render(const BMGFill &fill) = 0; |
63 | virtual void render(const BMImage &image) = 0; |
64 | virtual void render(const BMStroke &stroke) = 0; |
65 | virtual void render(const BMBasicTransform &trans) = 0; |
66 | virtual void render(const BMShapeTransform &trans) = 0; |
67 | virtual void render(const BMFreeFormShape &shape) = 0; |
68 | virtual void render(const BMTrimPath &trans) = 0; |
69 | virtual void render(const BMFillEffect &effect) = 0; |
70 | virtual void render(const BMRepeater &repeater) = 0; |
71 | |
72 | protected: |
73 | void saveTrimmingState(); |
74 | void restoreTrimmingState(); |
75 | |
76 | TrimmingState m_trimmingState = Off; |
77 | |
78 | private: |
79 | QStack<LottieRenderer::TrimmingState> m_trimStateStack; |
80 | }; |
81 | |
82 | QT_END_NAMESPACE |
83 | |
84 | #endif // LOTTIERENDERER_H |
85 | |