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// Qt-Security score:significant reason:default
4
5
6#ifndef QSVGANIMATEDPROPERTY_P_H
7#define QSVGANIMATEDPROPERTY_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtSvg/private/qtsvgglobal_p.h>
21#include <QtCore/qlist.h>
22#include <QtCore/qvariant.h>
23#include <QtCore/qvarlengtharray.h>
24#include <QtCore/qstring.h>
25#include <QtCore/qpoint.h>
26#include <QtGui/qcolor.h>
27
29
31{
32public:
33 enum Type
34 {
35 Int,
36 Float,
37 Color,
38 Transform,
39 };
40
41 QSvgAbstractAnimatedProperty(const QString &name, Type type);
42 virtual ~QSvgAbstractAnimatedProperty();
43
44 void setKeyFrames(const QList<qreal> &keyFrames);
45 void appendKeyFrame(qreal keyFrame);
46 QList<qreal> keyFrames() const;
47 void setPropertyName(const QString &name);
48 QStringView propertyName() const;
49 Type type() const;
50 QVariant interpolatedValue() const;
51 virtual void interpolate(uint index, qreal t) const = 0;
52
53 static QSvgAbstractAnimatedProperty *createAnimatedProperty(const QString &name);
54protected:
55 QList<qreal> m_keyFrames;
56 mutable QVariant m_interpolatedValue;
57
58private:
59 QString m_propertyName;
60 Type m_type;
61};
62
63class Q_SVG_EXPORT QSvgAnimatedPropertyColor : public QSvgAbstractAnimatedProperty
64{
65public:
66 QSvgAnimatedPropertyColor(const QString &name);
67
68 void setColors(const QList<QColor> &colors);
69 void appendColor(const QColor &color);
70 QList<QColor> colors() const;
71
72 void interpolate(uint index, qreal t) const override;
73
74private:
75 QList<QColor> m_colors;
76};
77
78class Q_SVG_EXPORT QSvgAnimatedPropertyFloat : public QSvgAbstractAnimatedProperty
79{
80public:
81 QSvgAnimatedPropertyFloat(const QString &name);
82
83 void setValues(const QList<qreal> &values);
84 void appendValue(const qreal value);
85 QList<qreal> values() const;
86
87 void interpolate(uint index, qreal t) const override;
88
89private:
90 QList<qreal> m_values;
91};
92
93class Q_SVG_EXPORT QSvgAnimatedPropertyTransform : public QSvgAbstractAnimatedProperty
94{
95public:
96 struct TransformComponent {
97 enum Type {
98 Translate,
99 Scale,
100 Rotate,
101 Skew,
102 Matrix
103 };
104 Type type;
105 QVarLengthArray<qreal, 16> values;
106 };
107
108public:
109 QSvgAnimatedPropertyTransform(const QString &name);
110
111 void setTransformCount(quint32 count);
112 quint32 transformCount() const;
113 void appendComponents(const QList<TransformComponent> &components);
114 QList<TransformComponent> components() const;
115
116 void interpolate(uint index, qreal t) const override;
117
118private:
119 QList<TransformComponent> m_components;
120 quint32 m_transformCount = 0;
121};
122
123QT_END_NAMESPACE
124
125#endif // QSVGANIMATEDPROPERTY_P_H
Combined button and popup list for selecting options.