blob: 54fdc5bf3c007786c91266cd586f56bba3ff8f89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKNODEINFO_P_H
#define QQUICKNODEINFO_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QString>
#include <QPainter>
#include <QPainterPath>
#include <QMatrix4x4>
#include <QQuickItem>
#include <QtGui/private/qfixed_p.h>
#include <QtCore/qmap.h>
#include "qquickanimatedproperty_p.h"
QT_BEGIN_NAMESPACE
namespace QQuickVectorImageGenerator {
struct NodeInfo
{
QString id;
QString nodeId;
QString typeName;
QString maskId;
QString transformReferenceId;
QString customItemType;
QQuickAnimatedProperty transform = QQuickAnimatedProperty(QVariant::fromValue(QTransform{}));
QQuickAnimatedProperty opacity = QQuickAnimatedProperty(QVariant::fromValue(1.0));
// Special case: Motion path holds curves that the node moves along. The default value
// holds additional parameters: First of the pair is whether or not the node adapts to
// the angle of the tangent of the path. Second is an additional rotation to apply on top
QQuickAnimatedProperty motionPath = QQuickAnimatedProperty(QVariant::fromValue(QVariantPair(false, 0.0)));
bool isDefaultTransform = true;
bool isDefaultOpacity = true;
bool isVisible = true;
bool isDisplayed = true; // TODO: Map to display enum in QtSvg
bool isMaskAlpha = false;
bool isMaskInverted = false;
QQuickAnimatedProperty visibility = QQuickAnimatedProperty(QVariant::fromValue(true));
int visibilityEndTime = -1;
QRectF bounds;
};
struct ImageNodeInfo : NodeInfo
{
QImage image;
QRectF rect;
QString externalFileReference;
};
struct StrokeStyle
{
Qt::PenCapStyle lineCapStyle = Qt::SquareCap;
Qt::PenJoinStyle lineJoinStyle = Qt::MiterJoin;
int miterLimit = 4;
bool cosmetic = false;
qreal dashOffset = 0;
QList<qreal> dashArray;
QQuickAnimatedProperty color = QQuickAnimatedProperty(QVariant::fromValue(QColorConstants::Transparent));
QQuickAnimatedProperty opacity = QQuickAnimatedProperty(QVariant::fromValue(qreal(1.0)));
qreal width = 1.0;
static StrokeStyle fromPen(const QPen &p)
{
StrokeStyle style;
style.lineCapStyle = p.capStyle();
style.lineJoinStyle = p.joinStyle() == Qt::SvgMiterJoin ? Qt::MiterJoin : p.joinStyle(); //TODO support SvgMiterJoin
style.miterLimit = qRound(p.miterLimit());
style.cosmetic = p.isCosmetic();
style.dashOffset = p.dashOffset();
style.dashArray = p.dashPattern();
style.width = p.widthF();
return style;
}
};
struct PathTrimInfo
{
bool enabled = false;
QQuickAnimatedProperty start = QQuickAnimatedProperty(QVariant::fromValue(0.0));
QQuickAnimatedProperty end = QQuickAnimatedProperty(QVariant::fromValue(1.0));
QQuickAnimatedProperty offset = QQuickAnimatedProperty(QVariant::fromValue(0.0));
};
struct PathNodeInfo : NodeInfo
{
QQuickAnimatedProperty path = QQuickAnimatedProperty(QVariant::fromValue(QPainterPath{}));
Qt::FillRule fillRule = Qt::FillRule::WindingFill;
QQuickAnimatedProperty fillColor = QQuickAnimatedProperty(QVariant::fromValue(QColor{}));
QQuickAnimatedProperty fillOpacity = QQuickAnimatedProperty(QVariant::fromValue(qreal(1.0)));
StrokeStyle strokeStyle;
QGradient grad;
QTransform fillTransform;
PathTrimInfo trim;
};
struct TextNodeInfo : NodeInfo
{
bool isTextArea;
bool needsRichText;
QPointF position;
QSizeF size;
QString text;
QFont font;
Qt::Alignment alignment;
QQuickAnimatedProperty fillColor = QQuickAnimatedProperty(QVariant::fromValue(QColor{}));
QQuickAnimatedProperty fillOpacity = QQuickAnimatedProperty(QVariant::fromValue(qreal(1.0)));
QQuickAnimatedProperty strokeColor = QQuickAnimatedProperty(QVariant::fromValue(QColor{}));
QQuickAnimatedProperty strokeOpacity = QQuickAnimatedProperty(QVariant::fromValue(qreal(1.0)));
};
struct AnimateColorNodeInfo : NodeInfo
{
};
enum class StructureNodeStage
{
Start,
End
};
struct UseNodeInfo : NodeInfo
{
StructureNodeStage stage;
};
struct StructureNodeInfo : NodeInfo
{
StructureNodeStage stage = StructureNodeStage::Start;
bool forceSeparatePaths = false;
QRectF viewBox;
QSize size;
QRectF clipBox;
bool isPathContainer = false;
};
struct MaskNodeInfo : NodeInfo
{
StructureNodeStage stage = StructureNodeStage::Start;
bool isMaskRectRelativeCoordinates = false;
QRectF maskRect;
};
}
QT_END_NAMESPACE
#endif //QQUICKNODEINFO_P_H
|