Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsvgstructure_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 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 QSVGSTRUCTURE_P_H
5
#define QSVGSTRUCTURE_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 "
qsvgnode_p.h
"
19
20
#include "QtCore/qlist.h"
21
#include "QtCore/qhash.h"
22
23
QT_BEGIN_NAMESPACE
24
25
class
QSvgTinyDocument
;
26
class
QSvgNode
;
27
class
QPainter
;
28
class
QSvgDefs
;
29
30
class
Q_SVG_EXPORT
QSvgStructureNode
:
public
QSvgNode
31
{
32
public
:
33
QSvgStructureNode
(
QSvgNode
*parent);
34
~QSvgStructureNode
();
35
QSvgNode
*scopeNode(
const
QString
&
id
)
const
;
36
void
addChild(
QSvgNode
*
child
,
const
QString
&
id
);
37
QRectF
bounds(
QPainter
*
p
,
QSvgExtraStates
&
states
)
const override
;
38
QSvgNode
*previousSiblingNode(
QSvgNode
*
n
)
const
;
39
QList<QSvgNode*>
renderers
()
const
{
return
m_renderers; }
40
protected
:
41
QList<QSvgNode*>
m_renderers
;
42
QHash<QString, QSvgNode*>
m_scope
;
43
QList<QSvgStructureNode*>
m_linkedScopes
;
44
mutable
bool
m_recursing =
false
;
45
};
46
47
class
Q_SVG_EXPORT
QSvgG
:
public
QSvgStructureNode
48
{
49
public
:
50
QSvgG
(
QSvgNode
*parent);
51
void
drawCommand(
QPainter
*,
QSvgExtraStates
&)
override
;
52
bool
shouldDrawNode(
QPainter
*
p
,
QSvgExtraStates
&
states
)
const override
;
53
Type
type
()
const override
;
54
};
55
56
class
Q_SVG_EXPORT
QSvgDefs
:
public
QSvgStructureNode
57
{
58
public
:
59
QSvgDefs
(
QSvgNode
*parent);
60
void
drawCommand
(
QPainter
*,
QSvgExtraStates
&)
override
{};
61
bool
shouldDrawNode(
QPainter
*
p
,
QSvgExtraStates
&
states
)
const override
;
62
Type
type
()
const override
;
63
};
64
65
class
Q_SVG_EXPORT
QSvgSymbolLike
:
public
QSvgStructureNode
66
{
67
// Marker, Symbol and potentially other elements share a lot of common
68
// attributes and functionality. By making a common base class we can
69
// avoid repetition.
70
public
:
71
enum class
Overflow
:
quint8
{
72
Visible,
73
Hidden,
74
Scroll = Visible,
//Will not support scrolling
75
Auto = Visible
76
};
77
78
enum class
PreserveAspectRatio
:
quint8
{
79
None
= 0b000000,
80
xMin = 0b000001,
81
xMid = 0b000010,
82
xMax = 0b000011,
83
yMin = 0b000100,
84
yMid = 0b001000,
85
yMax = 0b001100,
86
meet = 0b010000,
87
slice = 0b100000,
88
xMask = xMin | xMid | xMax,
89
yMask = yMin | yMid | yMax,
90
xyMask = xMask | yMask,
91
meetSliceMask = meet | slice
92
};
93
Q_DECLARE_FLAGS
(PreserveAspectRatios, PreserveAspectRatio)
94
95
QSvgSymbolLike
(
QSvgNode
*parent,
QRectF
bounds,
QRectF
viewBox,
QPointF
refP,
96
QSvgSymbolLike::PreserveAspectRatios pAspectRatios,
QSvgSymbolLike::Overflow
overflow);
97
void
drawCommand
(
QPainter
*,
QSvgExtraStates
&)
override
{};
98
protected
:
99
void
setPainterToRectAndAdjustment(
QPainter
*
p
)
const
;
100
protected
:
101
QRectF
m_rect
;
102
QRectF
m_viewBox
;
103
QPointF
m_refP
;
104
PreserveAspectRatios
m_pAspectRatios
;
105
Overflow
m_overflow
;
106
};
107
108
Q_DECLARE_OPERATORS_FOR_FLAGS
(QSvgSymbolLike::PreserveAspectRatios)
109
110
class Q_SVG_EXPORT
QSvgSymbol
: public
QSvgSymbolLike
111
{
112
public
:
113
QSvgSymbol
(
QSvgNode
*parent,
QRectF
bounds,
QRectF
viewBox,
QPointF
refP,
114
QSvgSymbolLike::PreserveAspectRatios pAspectRatios,
QSvgSymbolLike::Overflow
overflow);
115
void
drawCommand(
QPainter
*
p
,
QSvgExtraStates
&
states
)
override
;
116
Type
type
()
const override
;
117
};
118
119
class
Q_SVG_EXPORT
QSvgMarker
:
public
QSvgSymbolLike
120
{
121
public
:
122
enum class
Orientation
:
quint8
{
123
Auto,
124
AutoStartReverse,
125
Value
126
};
127
enum class
MarkerUnits
:
quint8
{
128
StrokeWidth,
129
UserSpaceOnUse
130
};
131
132
QSvgMarker
(
QSvgNode
*parent,
QRectF
bounds,
QRectF
viewBox,
QPointF
refP,
133
QSvgSymbolLike::PreserveAspectRatios pAspectRatios,
QSvgSymbolLike::Overflow
overflow,
134
Orientation orientation,
qreal
orientationAngle, MarkerUnits markerUnits);
135
void
drawCommand(
QPainter
*
p
,
QSvgExtraStates
&
states
)
override
;
136
static
void
drawMarkersForNode(
QSvgNode
*node,
QPainter
*
p
,
QSvgExtraStates
&
states
);
137
Orientation
orientation
()
const
{
138
return
m_orientation;
139
}
140
qreal
orientationAngle
()
const
{
141
return
m_orientationAngle;
142
}
143
MarkerUnits
markerUnits
()
const
{
144
return
m_markerUnits;
145
}
146
Type
type
()
const override
;
147
private
:
148
struct
PositionMarkerPair {
149
qreal
x
;
150
qreal
y
;
151
qreal
angle
;
152
QString
markerId;
153
bool
isStartNode =
false
;
154
};
155
Orientation m_orientation;
156
qreal
m_orientationAngle;
157
MarkerUnits m_markerUnits;
158
};
159
160
class
Q_SVG_EXPORT
QSvgFilterContainer
:
public
QSvgStructureNode
161
{
162
public
:
163
164
QSvgFilterContainer
(
QSvgNode
*parent,
const
QSvgRectF
&bounds,
QtSvg::UnitTypes
filterUnits,
QtSvg::UnitTypes
primitiveUnits);
165
void
drawCommand
(
QPainter
*,
QSvgExtraStates
&)
override
{};
166
bool
shouldDrawNode(
QPainter
*,
QSvgExtraStates
&)
const override
;
167
Type
type
()
const override
;
168
QImage
applyFilter(
QSvgNode
*referenceNode,
const
QImage
&
buffer
,
QPainter
*
p
,
QRectF
bounds)
const
;
169
void
setSupported(
bool
supported);
170
bool
supported()
const
;
171
private
:
172
QSvgRectF
m_rect;
173
QtSvg::UnitTypes
m_filterUnits;
174
QtSvg::UnitTypes
m_primitiveUnits;
175
bool
m_supported;
176
};
177
178
179
class
Q_SVG_EXPORT
QSvgSwitch
:
public
QSvgStructureNode
180
{
181
public
:
182
QSvgSwitch
(
QSvgNode
*parent);
183
void
drawCommand(
QPainter
*
p
,
QSvgExtraStates
&
states
)
override
;
184
Type
type
()
const override
;
185
private
:
186
void
init
();
187
private
:
188
QString
m_systemLanguage;
189
QString
m_systemLanguagePrefix;
190
};
191
192
class
Q_SVG_EXPORT
QSvgMask
:
public
QSvgStructureNode
193
{
194
public
:
195
QSvgMask
(
QSvgNode
*parent,
QSvgRectF
bounds,
196
QtSvg::UnitTypes
contentsUnits);
197
void
drawCommand
(
QPainter
*,
QSvgExtraStates
&)
override
{};
198
bool
shouldDrawNode(
QPainter
*,
QSvgExtraStates
&)
const override
;
199
Type
type
()
const override
;
200
QImage
createMask(
QPainter
*
p
,
QSvgExtraStates
&
states
,
QSvgNode
*targetNode,
QRectF
*globalRect)
const
;
201
QImage
createMask(
QPainter
*
p
,
QSvgExtraStates
&
states
,
const
QRectF
&localRect,
QRectF
*globalRect)
const
;
202
203
QSvgRectF
rect
()
const
204
{
205
return
m_rect;
206
}
207
208
QtSvg::UnitTypes
contentUnits
()
const
209
{
210
return
m_contentUnits;
211
}
212
213
private
:
214
QSvgRectF
m_rect;
215
QtSvg::UnitTypes
m_contentUnits;
216
};
217
218
class
Q_SVG_EXPORT
QSvgPattern
:
public
QSvgStructureNode
219
{
220
public
:
221
QSvgPattern
(
QSvgNode
*parent,
QSvgRectF
bounds,
QRectF
viewBox,
222
QtSvg::UnitTypes
contentUnits,
QTransform
transform
);
223
void
drawCommand
(
QPainter
*,
QSvgExtraStates
&)
override
{};
224
bool
shouldDrawNode(
QPainter
*,
QSvgExtraStates
&)
const override
;
225
QImage
patternImage(
QPainter
*
p
,
QSvgExtraStates
&
states
,
const
QSvgNode
*patternElement);
226
Type
type
()
const override
;
227
const
QTransform
&
appliedTransform
()
const
{
return
m_appliedTransform; }
228
229
private
:
230
QImage
renderPattern(
QSize
size
,
qreal
contentScaleX,
qreal
contentScaleY);
231
void
calculateAppliedTransform(
QTransform
& worldTransform,
QRectF
peLocalBB,
QSize
imageSize
);
232
233
private
:
234
QTransform
m_appliedTransform;
235
QSvgRectF
m_rect;
236
QRectF
m_viewBox;
237
QtSvg::UnitTypes
m_contentUnits;
238
QTransform
m_transform;
239
};
240
241
QT_END_NAMESPACE
242
243
#endif
// QSVGSTRUCTURE_P_H
QImage
\inmodule QtGui
Definition
qimage.h:37
QPainter
The QPainter class performs low-level painting on widgets and other paint devices.
Definition
qpainter.h:46
QPointF
\inmodule QtCore\reentrant
Definition
qpoint.h:217
QRectF
\inmodule QtCore\reentrant
Definition
qrect.h:484
QSize
\inmodule QtCore
Definition
qsize.h:25
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:129
QSvgDefs
Definition
qsvgstructure_p.h:57
QSvgDefs::drawCommand
void drawCommand(QPainter *, QSvgExtraStates &) override
Definition
qsvgstructure_p.h:60
QSvgFilterContainer
Definition
qsvgstructure_p.h:161
QSvgFilterContainer::drawCommand
void drawCommand(QPainter *, QSvgExtraStates &) override
Definition
qsvgstructure_p.h:165
QSvgG
Definition
qsvgstructure_p.h:48
QSvgMarker
Definition
qsvgstructure_p.h:120
QSvgMarker::markerUnits
MarkerUnits markerUnits() const
Definition
qsvgstructure_p.h:143
QSvgMarker::Orientation
Orientation
Definition
qsvgstructure_p.h:122
QSvgMarker::orientationAngle
qreal orientationAngle() const
Definition
qsvgstructure_p.h:140
QSvgMarker::orientation
Orientation orientation() const
Definition
qsvgstructure_p.h:137
QSvgMarker::MarkerUnits
MarkerUnits
Definition
qsvgstructure_p.h:127
QSvgMask
Definition
qsvgstructure_p.h:193
QSvgMask::drawCommand
void drawCommand(QPainter *, QSvgExtraStates &) override
Definition
qsvgstructure_p.h:197
QSvgMask::contentUnits
QtSvg::UnitTypes contentUnits() const
Definition
qsvgstructure_p.h:208
QSvgMask::rect
QSvgRectF rect() const
Definition
qsvgstructure_p.h:203
QSvgNode
Definition
qsvgnode_p.h:31
QSvgPattern
Definition
qsvgstructure_p.h:219
QSvgPattern::drawCommand
void drawCommand(QPainter *, QSvgExtraStates &) override
Definition
qsvgstructure_p.h:223
QSvgPattern::appliedTransform
const QTransform & appliedTransform() const
Definition
qsvgstructure_p.h:227
QSvgRectF
Definition
qsvghelper_p.h:25
QSvgStructureNode
Definition
qsvgstructure_p.h:31
QSvgStructureNode::m_linkedScopes
QList< QSvgStructureNode * > m_linkedScopes
Definition
qsvgstructure_p.h:43
QSvgStructureNode::m_scope
QHash< QString, QSvgNode * > m_scope
Definition
qsvgstructure_p.h:42
QSvgStructureNode::renderers
QList< QSvgNode * > renderers() const
Definition
qsvgstructure_p.h:39
QSvgStructureNode::m_renderers
QList< QSvgNode * > m_renderers
Definition
qsvgstructure_p.h:41
QSvgSwitch
Definition
qsvgstructure_p.h:180
QSvgSymbolLike
Definition
qsvgstructure_p.h:66
QSvgSymbolLike::PreserveAspectRatio
PreserveAspectRatio
Definition
qsvgstructure_p.h:78
QSvgSymbolLike::Overflow
Overflow
Definition
qsvgstructure_p.h:71
QSvgSymbolLike::m_viewBox
QRectF m_viewBox
Definition
qsvgstructure_p.h:102
QSvgSymbolLike::drawCommand
void drawCommand(QPainter *, QSvgExtraStates &) override
Definition
qsvgstructure_p.h:97
QSvgSymbolLike::m_rect
QRectF m_rect
Definition
qsvgstructure_p.h:101
QSvgSymbolLike::m_pAspectRatios
PreserveAspectRatios m_pAspectRatios
Definition
qsvgstructure_p.h:104
QSvgSymbolLike::m_refP
QPointF m_refP
Definition
qsvgstructure_p.h:103
QSvgSymbolLike::m_overflow
Overflow m_overflow
Definition
qsvgstructure_p.h:105
QSvgSymbol
Definition
qsvgstructure_p.h:111
QSvgTinyDocument
Definition
qsvgtinydocument_p.h:37
QTransform
The QTransform class specifies 2D transformations of a coordinate system.
Definition
qtransform.h:20
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
QtSvg::UnitTypes
UnitTypes
Definition
qtsvgglobal_p.h:25
Q_DECLARE_FLAGS
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition
qflags.h:174
Q_DECLARE_OPERATORS_FOR_FLAGS
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition
qflags.h:194
None
@ None
Definition
qhash.cpp:531
x
GLint GLint GLint GLint GLint x
[0]
Definition
qopengles2ext.h:605
size
GLenum GLuint GLintptr GLsizeiptr size
[1]
Definition
qopengles2ext.h:660
buffer
GLenum GLuint buffer
Definition
qopengles2ext.h:659
type
GLenum type
Definition
qopengles2ext.h:150
angle
GLfloat angle
Definition
qopengles2ext.h:3231
n
GLfloat n
Definition
qopengles2ext.h:795
imageSize
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
Definition
qopengles2ext.h:606
y
GLint y
Definition
qopengles2ext.h:206
transform
GLuint GLenum GLenum transform
Definition
qopenglext.h:11564
p
GLfloat GLfloat p
[1]
Definition
qopenglext.h:12698
states
GLuint * states
Definition
qopenglext.h:9584
qsvgnode_p.h
init
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
Definition
qtextboundaryfinder.cpp:10
qreal
double qreal
Definition
qtypes.h:187
quint8
unsigned char quint8
Definition
qtypes.h:46
child
QLayoutItem * child
[0]
Definition
src_gui_kernel_qlayout.cpp:25
QSvgExtraStates
Definition
qsvgstyle_p.h:105
Type
Definition
moc.h:23
qtsvg
src
svg
qsvgstructure_p.h
Generated by
1.10.0