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
23QT_BEGIN_NAMESPACE
24
25class BMBase;
26class BMLayer;
27class BMRect;
28class BMFill;
29class BMGFill;
30class BMImage;
31class BMStroke;
32class BMBasicTransform;
33class BMLayerTransform;
34class BMShapeTransform;
35class BMRepeaterTransform;
36class BMShapeLayer;
37class BMEllipse;
38class BMRound;
39class BMFreeFormShape;
40class BMTrimPath;
41class BMFillEffect;
42class BMRepeater;
43
44class BODYMOVIN_EXPORT LottieRenderer
45{
46public:
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
72protected:
73 void saveTrimmingState();
74 void restoreTrimmingState();
75
76 TrimmingState m_trimmingState = Off;
77
78private:
79 QStack<LottieRenderer::TrimmingState> m_trimStateStack;
80};
81
82QT_END_NAMESPACE
83
84#endif // LOTTIERENDERER_H
85

source code of qtlottie/src/bodymovin/lottierenderer_p.h