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
qsvganimatedproperty_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 QSVGANIMATEDPROPERTY_P_H
5#define QSVGANIMATEDPROPERTY_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 <QtSvg/private/qtsvgglobal_p.h>
19#include <QtCore/qlist.h>
20#include <QtCore/qvariant.h>
21#include <QtCore/qvarlengtharray.h>
22#include <QtCore/qstring.h>
23#include <QtCore/qpoint.h>
24#include <QtGui/qcolor.h>
25
27
29{
30public:
31 enum Type
32 {
33 Int,
34 Float,
35 Color,
36 Transform,
37 };
38
39 QSvgAbstractAnimatedProperty(const QString &name, Type type);
40 virtual ~QSvgAbstractAnimatedProperty();
41
42 void setKeyFrames(const QList<qreal> &keyFrames);
43 void appendKeyFrame(qreal keyFrame);
44 QList<qreal> keyFrames() const;
45 void setPropertyName(const QString &name);
46 QStringView propertyName() const;
47 Type type() const;
48 QVariant interpolatedValue() const;
49 virtual void interpolate(uint index, qreal t) const = 0;
50
51 static QSvgAbstractAnimatedProperty *createAnimatedProperty(const QString &name);
52protected:
53 QList<qreal> m_keyFrames;
54 mutable QVariant m_interpolatedValue;
55
56private:
57 QString m_propertyName;
58 Type m_type;
59};
60
61class Q_SVG_EXPORT QSvgAnimatedPropertyColor : public QSvgAbstractAnimatedProperty
62{
63public:
64 QSvgAnimatedPropertyColor(const QString &name);
65
66 void setColors(const QList<QColor> &colors);
67 void appendColor(const QColor &color);
68 QList<QColor> colors() const;
69
70 void interpolate(uint index, qreal t) const override;
71
72private:
73 QList<QColor> m_colors;
74};
75
76class Q_SVG_EXPORT QSvgAnimatedPropertyFloat : public QSvgAbstractAnimatedProperty
77{
78public:
79 QSvgAnimatedPropertyFloat(const QString &name);
80
81 void setValues(const QList<qreal> &values);
82 void appendValue(const qreal value);
83 QList<qreal> values() const;
84
85 void interpolate(uint index, qreal t) const override;
86
87private:
88 QList<qreal> m_values;
89};
90
91class Q_SVG_EXPORT QSvgAnimatedPropertyTransform : public QSvgAbstractAnimatedProperty
92{
93public:
94 struct TransformComponent {
95 enum Type {
96 Translate,
97 Scale,
98 Rotate,
99 Skew,
100 Matrix
101 };
102 Type type;
103 QVarLengthArray<qreal, 16> values;
104 };
105
106public:
107 QSvgAnimatedPropertyTransform(const QString &name);
108
109 void setTransformCount(quint32 count);
110 quint32 transformCount() const;
111 void appendComponents(const QList<TransformComponent> &components);
112 QList<TransformComponent> components() const;
113
114 void interpolate(uint index, qreal t) const override;
115
116private:
117 QList<TransformComponent> m_components;
118 quint32 m_transformCount = 0;
119};
120
121QT_END_NAMESPACE
122
123#endif // QSVGANIMATEDPROPERTY_P_H