Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsvganimate_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSVGANIMATE_P_H
5#define QSVGANIMATE_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 "qsvgnode_p.h"
19#include "private/qsvgabstractanimation_p.h"
20
22
23class Q_SVG_EXPORT QSvgAnimateNode : public QSvgNode, public QSvgAbstractAnimation
24{
25public:
26 enum Additive
27 {
28 Sum,
29 Replace
30 };
31 enum Fill
32 {
33 Freeze,
34 Remove
35 };
36
37public:
38 QSvgAnimateNode(QSvgNode *parent = nullptr);
39 virtual ~QSvgAnimateNode() {}
40
41 void setLinkId(const QString &link) { m_linkId = link; }
42 const QString &linkId() const { return m_linkId; }
43
44 virtual AnimationType animationType() const override { return AnimationType::SMIL; }
45 virtual bool isActive() const override { return !finished() || m_fill == Fill::Freeze; }
46
47 void setRunningTime(int startMs, int durMs, int endMs, int by);
48 void setRepeatCount(qreal repeatCount) { setIterationCount(repeatCount); }
49
50 void setFill(Fill fill) { m_fill = fill; }
51 Fill fill() const { return m_fill; }
52
53 void setAdditiveType(Additive additive = Additive::Replace) { m_additive = additive; }
54 Additive additiveType() const { return m_additive; }
55
56 virtual void drawCommand(QPainter *p, QSvgExtraStates &states) override;
57 virtual bool shouldDrawNode(QPainter *p, QSvgExtraStates &states) const override;
58
59protected:
60 qreal m_end;
61 Fill m_fill;
62 Additive m_additive;
63 QString m_linkId;
64};
65
66class Q_SVG_EXPORT QSvgAnimateColor : public QSvgAnimateNode
67{
68public:
69 QSvgAnimateColor(QSvgNode *parent = nullptr) : QSvgAnimateNode(parent) {}
70 virtual Type type() const override { return QSvgNode::AnimateColor; }
71};
72
73class Q_SVG_EXPORT QSvgAnimateTransform : public QSvgAnimateNode
74{
75public:
76 QSvgAnimateTransform(QSvgNode *parent = nullptr) : QSvgAnimateNode(parent) {}
77 virtual Type type() const override { return Type::AnimateTransform; }
78};
79
80QT_END_NAMESPACE
81
82#endif // QSVGANIMATE_P_H