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{
33 Q_DISABLE_COPY_MOVE(QSvgAbstractAnimatedProperty)
34public:
35 enum Type
36 {
37 Int,
38 Float,
39 Color,
40 Transform,
41 };
42
43 QSvgAbstractAnimatedProperty(const QString &name, Type type);
44 virtual ~QSvgAbstractAnimatedProperty();
45
46 void setKeyFrames(const QList<qreal> &keyFrames);
47 void appendKeyFrame(qreal keyFrame);
48 QList<qreal> keyFrames() const;
49
50 void appendEasing(QSvgEasingInterfacePtr easing);
51 const QSvgEasingInterface *easingAt(unsigned int i) const;
52 void setPropertyName(const QString &name);
54 Type type() const;
56 virtual void interpolate(uint index, qreal t) const = 0;
57
58 static QSvgAbstractAnimatedProperty *createAnimatedProperty(const QString &name);
59protected:
60 QList<qreal> m_keyFrames;
63
64private:
65 QString m_propertyName;
66 Type m_type;
67};
68
69class Q_SVG_EXPORT QSvgAnimatedPropertyColor : public QSvgAbstractAnimatedProperty
70{
71public:
72 QSvgAnimatedPropertyColor(const QString &name);
73 ~QSvgAnimatedPropertyColor() override;
74
75 void setColors(const QList<QColor> &colors);
76 void appendColor(const QColor &color);
77 QList<QColor> colors() const;
78
79 void interpolate(uint index, qreal t) const override;
80
81private:
82 QList<QColor> m_colors;
83};
84
85class Q_SVG_EXPORT QSvgAnimatedPropertyFloat : public QSvgAbstractAnimatedProperty
86{
87public:
88 QSvgAnimatedPropertyFloat(const QString &name);
89 ~QSvgAnimatedPropertyFloat() override;
90
91 void setValues(const QList<qreal> &values);
92 void appendValue(const qreal value);
93 QList<qreal> values() const;
94
95 void interpolate(uint index, qreal t) const override;
96
97private:
98 QList<qreal> m_values;
99};
100
101class Q_SVG_EXPORT QSvgAnimatedPropertyTransform : public QSvgAbstractAnimatedProperty
102{
103public:
104 struct TransformComponent {
105 enum Type {
106 Translate,
107 Scale,
108 Rotate,
109 Skew,
110 Matrix
111 };
112 Type type;
113 QVarLengthArray<qreal, 16> values;
114 };
115
116public:
117 QSvgAnimatedPropertyTransform(const QString &name);
118 ~QSvgAnimatedPropertyTransform() override;
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
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false.
QSet< QPrintEngine::PrintEnginePropertyKey > m_properties
Definition qprinter_p.h:102
QSvgAbstractAnimatedProperty(const QString &name, Type type)
std::vector< QSvgEasingInterfacePtr > m_easings
void appendEasing(QSvgEasingInterfacePtr easing)
static QSvgAbstractAnimatedProperty * createAnimatedProperty(const QString &name)
void setKeyFrames(const QList< qreal > &keyFrames)
void setPropertyName(const QString &name)
const QSvgEasingInterface * easingAt(unsigned int i) const
virtual void interpolate(uint index, qreal t) const =0
QList< QSvgAbstractAnimatedProperty * > properties() const
QSvgEasingInterface * easing() const
QSvgEasingInterfacePtr m_easing
void setRunningTime(int startMs, int durationMs)
void setEasing(QSvgEasingInterfacePtr easing)
virtual AnimationType animationType() const =0
virtual void appendProperty(QSvgAbstractAnimatedProperty *property)
void evaluateAnimation(qreal elapsedTime)
Combined button and popup list for selecting options.