1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef BMLAYER_P_H
5#define BMLAYER_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 <QtBodymovin/private/bmbase_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class LottieRenderer;
23
24class BODYMOVIN_EXPORT BMLayer : public BMBase
25{
26public:
27 enum MatteClipMode {NoClip, Alpha, InvertedAlpha, Luminence, InvertedLuminence};
28
29 BMLayer() = default;
30 explicit BMLayer (const BMLayer &other);
31 ~BMLayer() override;
32
33 BMBase *clone() const override;
34
35 static BMLayer *construct(QJsonObject definition, const QVersionNumber &version);
36
37 bool active(int frame) const override;
38
39 void parse(const QJsonObject &definition) override;
40
41 void updateProperties(int frame) override;
42 void render(LottieRenderer &renderer) const override;
43
44 BMBase *findChild(const QString &childName) override;
45
46 bool isClippedLayer() const;
47 bool isMaskLayer() const;
48 MatteClipMode clipMode() const;
49
50 int layerId() const;
51 BMBasicTransform *transform() const;
52
53protected:
54 void renderEffects(LottieRenderer &renderer) const;
55
56 virtual BMLayer *resolveLinkedLayer();
57 virtual BMLayer *linkedLayer() const;
58
59 int m_layerIndex = 0;
60 int m_startFrame;
61 int m_endFrame;
62 qreal m_startTime;
63 int m_blendMode;
64 bool m_3dLayer = false;
65 BMBase *m_effects = nullptr;
66 qreal m_stretch;
67 BMBasicTransform *m_layerTransform = nullptr;
68
69 int m_parentLayer = 0;
70 int m_td = 0;
71 MatteClipMode m_clipMode = NoClip;
72
73private:
74 void parseEffects(const QJsonArray &definition, BMBase *effectRoot = nullptr);
75
76 BMLayer *m_linkedLayer = nullptr;
77};
78
79QT_END_NAMESPACE
80
81#endif // BMLAYER_P_H
82

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