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 <QtSvg/private/qsvgeasinginterface_p.h>
22#include <QtCore/qlist.h>
23#include <QtCore/qvariant.h>
24#include <QtCore/qvarlengtharray.h>
25#include <QtCore/qstring.h>
26#include <QtCore/qpoint.h>
27#include <QtGui/qcolor.h>
28
30
32{
33public:
34 enum Type
35 {
36 Int,
37 Float,
38 Color,
39 Transform,
40 };
41
42 QSvgAbstractAnimatedProperty(const QString &name, Type type);
43 virtual ~QSvgAbstractAnimatedProperty();
44
45 void setKeyFrames(const QList<qreal> &keyFrames);
46 void appendKeyFrame(qreal keyFrame);
47 QList<qreal> keyFrames() const;
48
49 void appendEasing(QSvgEasingInterfacePtr easing);
50 const QSvgEasingInterface *easingAt(unsigned int i) const;
51 void setPropertyName(const QString &name);
52 QStringView propertyName() const;
53 Type type() const;
54 QVariant interpolatedValue() const;
55 virtual void interpolate(uint index, qreal t) const = 0;
56
57 static QSvgAbstractAnimatedProperty *createAnimatedProperty(const QString &name);
58protected:
59 QList<qreal> m_keyFrames;
60 std::vector<QSvgEasingInterfacePtr> m_easings;
61 mutable QVariant m_interpolatedValue;
62
63private:
64 QString m_propertyName;
65 Type m_type;
66
67private:
68 Q_DISABLE_COPY_X(QSvgAbstractAnimatedProperty, "Class has a vector of unique"
69 "pointers as member variable")
70};
71
72class Q_SVG_EXPORT QSvgAnimatedPropertyColor : public QSvgAbstractAnimatedProperty
73{
74public:
75 QSvgAnimatedPropertyColor(const QString &name);
76
77 void setColors(const QList<QColor> &colors);
78 void appendColor(const QColor &color);
79 QList<QColor> colors() const;
80
81 void interpolate(uint index, qreal t) const override;
82
83private:
84 QList<QColor> m_colors;
85};
86
87class Q_SVG_EXPORT QSvgAnimatedPropertyFloat : public QSvgAbstractAnimatedProperty
88{
89public:
90 QSvgAnimatedPropertyFloat(const QString &name);
91
92 void setValues(const QList<qreal> &values);
93 void appendValue(const qreal value);
94 QList<qreal> values() const;
95
96 void interpolate(uint index, qreal t) const override;
97
98private:
99 QList<qreal> m_values;
100};
101
102class Q_SVG_EXPORT QSvgAnimatedPropertyTransform : public QSvgAbstractAnimatedProperty
103{
104public:
105 struct TransformComponent {
106 enum Type {
107 Translate,
108 Scale,
109 Rotate,
110 Skew,
111 Matrix
112 };
113 Type type;
114 QVarLengthArray<qreal, 16> values;
115 };
116
117public:
118 QSvgAnimatedPropertyTransform(const QString &name);
119
120 void setTransformCount(quint32 count);
121 quint32 transformCount() const;
122 void appendComponents(const QList<TransformComponent> &components);
123 QList<TransformComponent> components() const;
124
125 void interpolate(uint index, qreal t) const override;
126
127private:
128 QList<TransformComponent> m_components;
129 quint32 m_transformCount = 0;
130};
131
132QT_END_NAMESPACE
133
134#endif // QSVGANIMATEDPROPERTY_P_H
Combined button and popup list for selecting options.