42 #include "qplatformdefs.h" 68 #include "private/qmath_p.h" 75 #define QT_INHERIT QLatin1String(qt_inherit_text) 83 if (hex >=
'0' && hex <=
'9')
85 if (hex >=
'a' && hex <=
'f')
86 return hex -
'a' + 10;
87 if (hex >=
'A' && hex <=
'F')
88 return hex -
'A' + 10;
114 }
else if (len == 9) {
118 }
else if (len == 6) {
122 }
else if (len == 3) {
133 *rgb =
qRgb(r, g ,b);
142 for(
int i = 0; i < len; ++i)
143 tmp[i] = str[i].toLatin1();
255 if (strokeRef.isEmpty())
298 for (
int i = 0; i < xmlAttributes.
count(); ++i) {
355 if (strokeRef.isEmpty())
521 newNode.
ptr = svgParent;
559 return ((ch >> 4) == 3) && (magic >> (ch & 15));
564 const int maxLen = 255;
586 bool exponent =
false;
604 if (!exponent && pos < 10) {
606 const char *t = temp;
612 while(*t && *t !=
'.') {
633 #if defined(Q_WS_QWS) && !defined(Q_OS_VXWORKS) 634 if(
sizeof(
qreal) ==
sizeof(float))
635 val = strtof(temp, 0);
749 while ((*itr).isSpace())
753 while ((*itr).isSpace())
771 if (!s[0].isSpace() && !s[end].isSpace())
775 while (start<=end && s[start].isSpace())
778 while (s[end].isSpace())
781 int l = end - start + 1;
820 if (compo.
size() == 1) {
823 for (
int i = 0; i < compo.
size(); ++i)
824 compo[i] *= (
qreal)2.55;
827 if (compo.
size() == 3) {
828 color =
QColor(
int(compo[0]),
928 font->
addGlyph(unicode, path, havx);
949 return len * 3.543307;
952 return len * 35.43307;
1006 QString value = urlRef.toString();
1010 prop->
setFillStyle(reinterpret_cast<QSvgFillStyleProperty *>(style));
1052 State state = Matrix;
1054 const char *ident =
"atrix";
1055 for (
int i = 0; i < 5; ++i)
1061 const char *ident =
"ranslate";
1062 for (
int i = 0; i < 8; ++i)
1068 const char *ident =
"otate";
1069 for (
int i = 0; i < 5; ++i)
1077 const char *ident =
"ale";
1078 for (
int i = 0; i < 3; ++i)
1104 while (str < end && str->isSpace())
1115 if(state == Matrix) {
1116 if(points.
count() != 6)
1118 matrix = matrix *
QMatrix(points[0], points[1],
1119 points[2], points[3],
1120 points[4], points[5]);
1122 if (points.
count() == 1)
1124 else if (points.
count() == 2)
1128 }
else if (state == Rotate) {
1129 if(points.
count() == 1) {
1130 matrix.
rotate(points[0]);
1131 }
else if (points.
count() == 3) {
1133 matrix.
rotate(points[0]);
1134 matrix.
translate(-points[1], -points[2]);
1138 }
else if (state ==
Scale) {
1139 if (points.
count() < 1 || points.
count() > 2)
1141 qreal sx = points[0];
1143 if(points.
count() == 2)
1145 matrix.
scale(sx, sy);
1146 }
else if (state == SkewX) {
1147 if (points.
count() != 1)
1150 matrix.
shear(
qTan(points[0]*deg2rad), 0);
1151 }
else if (state == SkewY) {
1152 if (points.
count() != 1)
1155 matrix.
shear(0,
qTan(points[0]*deg2rad));
1179 QString value = urlRef.toString();
1183 prop->
setStyle(reinterpret_cast<QSvgFillStyleProperty *>(style));
1213 if ((dashes.
size() & 1) != 0)
1214 dashes << QVector<qreal>(dashes);
1289 enum AbsFontSize { XXSmall, XSmall, Small, Medium, Large, XLarge, XXLarge };
1293 size = sizeTable[XXSmall];
1295 size = sizeTable[XSmall];
1297 size = sizeTable[XLarge];
1299 size = sizeTable[XXLarge];
1303 size = sizeTable[Small];
1307 size = sizeTable[Medium];
1311 size = sizeTable[Large];
1401 qreal a00, a01, a10, a11;
1402 qreal x1, y1, x2, y2, x3, y3;
1406 sinTh =
qSin(xAxisRotation * (
Q_PI / 180.0));
1407 cosTh =
qCos(xAxisRotation * (
Q_PI / 180.0));
1414 thHalf = 0.5 * (th1 - th0);
1415 t = (8.0 / 3.0) *
qSin(thHalf * 0.5) *
qSin(thHalf * 0.5) /
qSin(thHalf);
1416 x1 = xc +
qCos(th0) - t *
qSin(th0);
1417 y1 = yc +
qSin(th0) + t *
qCos(th0);
1418 x3 = xc +
qCos(th1);
1419 y3 = yc +
qSin(th1);
1420 x2 = x3 + t *
qSin(th1);
1421 y2 = y3 - t *
qCos(th1);
1423 path.
cubicTo(a00 * x1 + a01 * y1, a10 * x1 + a11 * y1,
1424 a00 * x2 + a01 * y2, a10 * x2 + a11 * y2,
1425 a00 * x3 + a01 * y3, a10 * x3 + a11 * y3);
1457 qreal x_axis_rotation,
1464 qreal sin_th, cos_th;
1465 qreal a00, a01, a10, a11;
1466 qreal x0, y0, x1, y1, xc, yc;
1467 qreal d, sfactor, sfactor_sq;
1468 qreal th0, th1, th_arc;
1470 qreal dx, dy, dx1, dy1, Pr1, Pr2, Px, Py, check;
1475 sin_th =
qSin(x_axis_rotation * (
Q_PI / 180.0));
1476 cos_th =
qCos(x_axis_rotation * (
Q_PI / 180.0));
1478 dx = (curx - x) / 2.0;
1479 dy = (cury - y) / 2.0;
1480 dx1 = cos_th * dx + sin_th * dy;
1481 dy1 = -sin_th * dx + cos_th * dy;
1487 check = Px / Pr1 + Py / Pr2;
1489 rx = rx *
qSqrt(check);
1490 ry = ry *
qSqrt(check);
1497 x0 = a00 * curx + a01 * cury;
1498 y0 = a10 * curx + a11 * cury;
1499 x1 = a00 * x + a01 * y;
1500 y1 = a10 * x + a11 * y;
1506 d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
1507 sfactor_sq = 1.0 / d - 0.25;
1508 if (sfactor_sq < 0) sfactor_sq = 0;
1509 sfactor =
qSqrt(sfactor_sq);
1510 if (sweep_flag == large_arc_flag) sfactor = -sfactor;
1511 xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);
1512 yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
1515 th0 =
qAtan2(y0 - yc, x0 - xc);
1516 th1 =
qAtan2(y1 - yc, x1 - xc);
1519 if (th_arc < 0 && sweep_flag)
1521 else if (th_arc > 0 && !sweep_flag)
1526 for (i = 0; i < n_segs; i++) {
1528 th0 + i * th_arc / n_segs,
1529 th0 + (i + 1) * th_arc / n_segs,
1530 rx, ry, x_axis_rotation);
1536 qreal x0 = 0, y0 = 0;
1543 while (str != end) {
1546 QChar pathElem = *str;
1556 int count = arg.
count();
1567 x = x0 = num[0] + offsetX;
1568 y = y0 = num[1] + offsetY;
1612 x = num[0] + offsetX;
1613 y = num[1] + offsetY;
1634 x = num[0] + offsetX;
1648 y = num[0] + offsetY;
1667 QPointF c1(num[0] + offsetX, num[1] + offsetY);
1668 QPointF c2(num[2] + offsetX, num[3] + offsetY);
1669 QPointF e(num[4] + offsetX, num[5] + offsetY);
1702 if (lastMode ==
'c' || lastMode ==
'C' ||
1703 lastMode ==
's' || lastMode ==
'S')
1704 c1 =
QPointF(2*x-ctrlPt.
x(), 2*y-ctrlPt.
y());
1707 QPointF c2(num[0] + offsetX, num[1] + offsetY);
1708 QPointF e(num[2] + offsetX, num[3] + offsetY);
1724 if (lastMode ==
'c' || lastMode ==
'C' ||
1725 lastMode ==
's' || lastMode ==
'S')
1726 c1 =
QPointF(2*x-ctrlPt.
x(), 2*y-ctrlPt.
y());
1745 QPointF c(num[0] + offsetX, num[1] + offsetY);
1746 QPointF e(num[2] + offsetX, num[3] + offsetY);
1777 QPointF e(num[0] + offsetX, num[1] + offsetY);
1781 if (lastMode ==
'q' || lastMode ==
'Q' ||
1782 lastMode ==
't' || lastMode ==
'T')
1783 c =
QPointF(2*x-ctrlPt.
x(), 2*y-ctrlPt.
y());
1802 if (lastMode ==
'q' || lastMode ==
'Q' ||
1803 lastMode ==
't' || lastMode ==
'T')
1804 c =
QPointF(2*x-ctrlPt.
x(), 2*y-ctrlPt.
y());
1819 qreal rx = (*num++);
1820 qreal ry = (*num++);
1821 qreal xAxisRotation = (*num++);
1822 qreal largeArcFlag = (*num++);
1823 qreal sweepFlag = (*num++);
1824 qreal ex = (*num++) + offsetX;
1825 qreal ey = (*num++) + offsetY;
1829 pathArc(path, rx, ry, xAxisRotation,
int(largeArcFlag),
1830 int(sweepFlag), ex, ey, curx, cury);
1842 qreal rx = (*num++);
1843 qreal ry = (*num++);
1844 qreal xAxisRotation = (*num++);
1845 qreal largeArcFlag = (*num++);
1846 qreal sweepFlag = (*num++);
1847 qreal ex = (*num++);
1848 qreal ey = (*num++);
1852 pathArc(path, rx, ry, xAxisRotation,
int(largeArcFlag),
1853 int(sweepFlag), ex, ey, curx, cury);
1879 for (
int i = 0; i < declarations.
count(); ++i) {
1881 if (decl.
d->property.isEmpty())
1885 if (decl.
d->values.count() != 1) {
1886 for (
int i=0; i<decl.
d->values.count(); ++i) {
1887 const QString &value = decl.
d->values[i].toString();
1903 for (
int i = 1; i < lst.
count(); ++i) {
1905 if ((i +1) < lst.
count())
1926 m_cssParser.init(css);
1931 while (m_cssParser.hasNext()) {
1932 m_cssParser.skipSpace();
1934 if (!m_cssParser.hasNext())
1939 if (m_cssParser.hasEscapeSequences) {
1940 key = m_cssParser.lexem();
1947 m_cssParser.skipSpace();
1951 m_cssParser.skipSpace();
1952 if (!m_cssParser.hasNext())
1958 const int firstSymbol = m_cssParser.index;
1959 int symbolCount = 0;
1963 }
while (m_cssParser.hasNext() && !m_cssParser.test(
QCss::SEMICOLON));
1965 bool canExtractValueByRef = !m_cssParser.hasEscapeSequences;
1966 if (canExtractValueByRef) {
1967 int len = m_cssParser.symbols.at(firstSymbol).len;
1968 for (
int i = firstSymbol + 1; i < firstSymbol + symbolCount; ++i) {
1969 len += m_cssParser.symbols.at(i).len;
1971 if (m_cssParser.symbols.at(i - 1).start + m_cssParser.symbols.at(i - 1).len
1972 != m_cssParser.symbols.at(i).start) {
1973 canExtractValueByRef =
false;
1977 if (canExtractValueByRef) {
1978 const QCss::Symbol &sym = m_cssParser.symbols.at(firstSymbol);
1982 if (!canExtractValueByRef) {
1984 for (
int i = firstSymbol; i < m_cssParser.index - 1; ++i)
1985 value += m_cssParser.symbols.
at(i).lexem();
1989 attributes->
append(attribute);
1991 m_cssParser.skipSpace();
2024 for (
int i = 0; i < attributes.
count(); ++i) {
2085 #define NOOP qDebug()<<"Operation: "<<op<<" is not implemented" 2216 parsePen(node, attributes, handler);
2224 value = attributes.value(
"audio-level");
2226 value = attributes.value(
"color-rendering");
2228 value = attributes.value(
"display-align");
2230 value = attributes.value(
"image-rendering");
2232 value = attributes.value(
"line-increment");
2234 value = attributes.value(
"pointer-events");
2236 value = attributes.value(
"shape-rendering");
2238 value = attributes.value(
"solid-color");
2240 value = attributes.value(
"solid-opacity");
2242 value = attributes.value(
"text-rendering");
2244 value = attributes.value(
"vector-effect");
2246 value = attributes.value(
"viewport-fill");
2248 value = attributes.value(
"viewport-fill-opacity");
2292 QColor startColor, endColor;
2295 colors.
append(startColor);
2309 beginStr = beginStr.
trimmed();
2323 int begin =
static_cast<int>(
toDouble(beginStr) * ms);
2324 int end =
static_cast<int>((
toDouble(durStr) + begin) * ms);
2351 for (
int i = 3 - list.size(); i > 0; --i)
2395 }
else if (!byStr.
isEmpty()) {
2399 for (
int i = vals.
size() - 3; i < vals.
size(); ++i)
2400 vals[i] += vals[i - 3];
2416 beginStr = beginStr.
trimmed();
2423 int begin =
static_cast<int>(
toDouble(beginStr) * ms);
2432 int end =
static_cast<int>(
toDouble(durStr)*ms) + begin;
2450 anim->
setArgs(type, additive, vals);
2489 QRectF rect(ncx-nr, ncy-nr, nr*2, nr*2);
2532 QRectF rect(ncx-nrx, ncy-nry, nrx*2, nry*2);
2547 parent = parent->
parent();
2695 filename = filename.
trimmed();
2705 qDebug()<<
"QSvgHandler::createImageNode: Unrecognized inline image format!";
2708 image =
QImage(filename);
2711 qDebug()<<
"couldn't create image from "<<filename;
2740 QLineF lineBounds(nx1, ny1, nx2, ny2);
2779 matrix = inherited->
qmatrix();
2898 for (
int i = 0; i < poly.size(); ++i)
2899 poly[i] =
QPointF(points.
at(2 * i), points.
at(2 * i + 1));
2914 for (
int i = 0; i < poly.size(); ++i)
2915 poly[i] =
QPointF(points.
at(2 * i), points.
at(2 * i + 1));
2991 if (nrx > bounds.
width()/2)
2992 nrx = bounds.
width()/2;
2993 if (nry > bounds.
height()/2)
3004 nrx *= (100/(bounds.
width()/2));
3005 nry *= (100/(bounds.
height()/2));
3037 if (solidOpacityStr.
isEmpty())
3041 if (!
constructColor(solidColorStr, solidOpacityStr, color, handler))
3065 cssNode.
ptr = &anim;
3069 for (
int i = 0; i < decls.
count(); ++i) {
3072 if (decl.
d->property.isEmpty())
3074 if (decl.
d->values.count() != 1)
3108 stops = grad->
stops();
3111 offset = stops.
back().
first + FLT_EPSILON;
3116 if ((stops.
size() == 1) || (stops.
at(stops.
size() - 2).first < 1.0 - FLT_EPSILON)) {
3152 qWarning(
"Profile is %s while we only support tiny!",
3186 if (viewBoxValues.
count() == 4) {
3200 }
else if (width && height) {
3227 static_cast<QSvgText*
>(parent)->addLineBreak();
3286 switch (parent->
type()) {
3514 , m_ownsReader(true)
3595 if (xmlSpace.isNull()) {
3604 "Valid values are \"preserve\" and \"default\".").
arg(xmlSpace.toString());
3640 node = method(
m_nodes.
top(), attributes,
this);
3658 qWarning(
"\'text\' or \'textArea\' element contains invalid element type.");
3664 qWarning(
"Could not add child element to parent element because the types are incorrect.");
3683 if (!method(
m_nodes.
top(), attributes,
this)) {
3696 if (!method(
m_style, attributes,
this)) {
3866 while ((pos = rx.
indexIn(data, pos)) != -1) {
static void parseCompOp(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *)
The QColor class provides colors based on RGB, HSV or CMYK values.
bool isGradientResolved() const
QString toString() const
Returns a copy of the string reference as a QString object.
void setRgb(int r, int g, int b, int a=255)
Sets the RGB value to r, g, b and the alpha value to a.
virtual Type type() const =0
const T * constData() const
const unsigned char magic[QSXE_MAGIC_BYTES]
virtual NodePtr previousSiblingNode(NodePtr node) const
QStack< int > m_colorTagCount
virtual bool isNullNode(NodePtr node) const
void setTextAnchor(Qt::Alignment anchor)
void setLineJoin(Qt::PenJoinStyle join)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
QString cap(int nth=0) const
Returns the text captured by the nth subexpression.
#define QT_END_NAMESPACE
This macro expands to.
static QVector< qreal > parseNumbersList(const QChar *&str)
void appendStyleProperty(QSvgStyleProperty *prop, const QString &id)
static QSvgStyleProperty * createFontNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static QSvgNode * createVideoNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
void setWeight(int weight)
static QSvgNode * createPolygonNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
int length() const
Returns the number of characters referred to by the string reference.
static bool parseFontFaceUriNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
const QChar at(int i) const
Returns the character at the given index position in the string.
CompositionMode
Defines the modes supported for digital image compositing.
void setOpacity(qreal opacity)
The QRegExp class provides pattern matching using regular expressions.
static QString idFromUrl(const QString &url)
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QMatrix class specifies 2D transformations of a coordinate system.
static QSvgStyleProperty * createRadialGradientNode(QSvgNode *node, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
#define it(className, varName)
static bool parseDiscardNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
virtual QStringList nodeNames(NodePtr node) const
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void setGradientId(const QString &Id)
QStringRef strokeDashArray
void setRequiredExtensions(const QStringList &lst)
void setWidth(int len, bool percent)
static bool constructColor(const QStringRef &colorStr, const QStringRef &opacity, QColor &color, QSvgHandler *handler)
QVector< QSvgCssAttribute > m_cssAttributes
static QSvgNode * createCircleNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static bool parseFontFaceSrcNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
bool isNull() const
Returns true if it is a null image, otherwise returns false.
static void parseNumberTriplet(QVector< qreal > &values, const QChar *&s)
void setHeight(int len, bool percent)
QString & replace(int i, int len, QChar after)
The QByteArray class provides an array of bytes.
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
QString & prepend(QChar c)
The QPointF class defines a point in the plane using floating point precision.
virtual void freeNode(NodePtr node) const
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
QString gradientId() const
static QMatrix parseTransformationMatrix(const QStringRef &value)
QStringRef value() const
Returns the attribute's value.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QSvgTinyDocument * document() const
QSvgFont * svgFont(const QString &family) const
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
int matchedLength() const
Returns the length of the last matched string, or -1 if there was no match.
static bool parseTbreakNode(QSvgNode *parent, const QXmlStreamAttributes &, QSvgHandler *)
QGradient * qgradient() const
bool(* ParseMethod)(QSvgNode *, const QXmlStreamAttributes &, QSvgHandler *)
static void parseVisibility(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *)
QSvgHandler(QIODevice *device)
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QString absoluteFilePath() const
Returns an absolute path including the file name.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool exists() const
Returns true if the file exists; otherwise returns false.
static QSvgNode * createPolylineNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
QSvgNode * scopeNode(const QString &id) const
void setStyle(QFont::Style fontStyle)
QStringRef name() const
Returns the local name of a StartElement, EndElement, or an EntityReference.
int count(const T &t) const
Returns the number of occurrences of value in the list.
QList< QSvgNode * > renderers() const
void setXmlClass(const QString &str)
QSvgFont * svgFont() const
static StyleParseMethod findStyleUtilFactoryMethod(const QString &name)
static QSvgStyleProperty * styleFromUrl(QSvgNode *node, const QString &url)
static QSvgNode * createDefsNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
QSvgNode *(* FactoryMethod)(QSvgNode *, const QXmlStreamAttributes &, QSvgHandler *)
QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHandler *handler)
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
bool atEnd() const
Returns true if the reader has read until the end of the XML document, or if an error() has occurred ...
QSvgNode * parent() const
void setVectorEffect(bool nonScalingStroke)
The QString class provides a Unicode character string.
static QSvgNode * createAnimationNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static bool parseAimateMotionNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static bool parseAnimateNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static void parseTransform(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *)
static ParseMethod findUtilFactory(const QString &name)
Q_DECL_CONSTEXPR T qAbs(const T &t)
static bool parseForeignObjectNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
void setRepeatCount(qreal repeatCount)
static QString someId(const QXmlStreamAttributes &attributes)
static QStringList stringToList(const QString &str)
Q_GUI_EXPORT QString extensions()
QMatrix & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
static bool parseStyle(QSvgNode *node, const QXmlStreamAttributes &attributes, QSvgHandler *)
static bool parsePathDataFast(const QStringRef &data, QPainterPath &path)
The QPen class defines how a QPainter should draw lines and outlines of shapes.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
QXmlStreamReader *const xml
static QSvgNode * createRectNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
QStringRef qualifiedName() const
Returns the attribute's qualified name.
The QChar class provides a 16-bit Unicode character.
void setFillRule(Qt::FillRule f)
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
static void parseOthers(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *)
static bool parseMissingGlyphNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
Format format() const
Returns the format of the image.
static QSvgStyleProperty * createSolidColorNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
QSvgStyleSelector * selector() const
void setViewBox(const QRectF &rect)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
static int qsvg_hex2int(const char *s)
static const char * QSvgStyleSelector_nodeString[]
virtual NodePtr parentNode(NodePtr node) const
void setRequiredLanguages(const QStringList &lst)
qreal x() const
Returns the x-coordinate of this point.
QStringRef value(const QString &namespaceUri, const QString &name) const
Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined.
The QLineF class provides a two-dimensional vector using floating point precision.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
QStringRef strokeDashOffset
QExplicitlySharedDataPointer< DeclarationData > d
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first character in the string. ...
static QSvgNode * createGNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
T pop()
Removes the top item from the stack and returns it.
const QChar * constData() const
Same as unicode().
The QXmlStreamAttribute class represents a single XML attribute.
bool qsvg_get_hex_rgb(const char *name, QRgb *rgb)
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
Q_CORE_EXPORT void qDebug(const char *,...)
QGradientStops stops() const
Returns the stop points for this gradient.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
friend class const_iterator
void setSpread(Spread spread)
Specifies the spread method that should be used for this gradient.
static void parseOpacity(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *)
void setAnimPeriod(int start, int end)
static QSvgNode * createSvgNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
void pushColor(const QColor &color)
void append(const T &t)
Inserts value at the end of the list.
void setMinimal(bool minimal)
Enables or disables minimal matching.
int size() const
Returns the number of characters referred to by the string reference.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
bool(* StyleParseMethod)(QSvgStyleProperty *, const QXmlStreamAttributes &, QSvgHandler *)
static const char * qt_inherit_text
void setWidth(qreal width)
static bool isEmpty(const char *str)
QMatrix & rotate(qreal a)
Rotates the coordinate system the given degrees counterclockwise.
static bool parseAudioNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
QSvgStyleProperty *(* StyleFactoryMethod)(QSvgNode *, const QXmlStreamAttributes &, QSvgHandler *)
static void pathArcSegment(QPainterPath &path, qreal xc, qreal yc, qreal th0, qreal th1, qreal rx, qreal ry, qreal xAxisRotation)
int indexIn(const QString &str, int offset=0, CaretMode caretMode=CaretAtZero) const
Attempts to find a match in str from position offset (0 by default).
void setFreeze(bool freeze)
void setInterpolationMode(InterpolationMode mode)
Sets the interpolation mode of this gradient to mode.
QStringRef strokeMiterLimit
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setGradientResolved(bool resolved)
void setFillStyle(QSvgFillStyleProperty *style)
void addSvgFont(QSvgFont *)
virtual QString attribute(NodePtr node, const QString &name) const
QSvgNode * svgNode(NodePtr node) const
void setBrush(QBrush brush)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
qreal height() const
Returns the height of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
void setGradientStopsSet(bool set)
The QStringList class provides a list of strings.
static bool parseAnimateColorNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
void setRequiredFormats(const QStringList &lst)
void resolveGradients(QSvgNode *node)
The QPolygonF class provides a vector of points using floating point precision.
void addChild(QSvgNode *child, const QString &id)
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
void append(const T &t)
Inserts value at the end of the vector.
bool endElement(const QStringRef &localName)
Q_CORE_EXPORT void qWarning(const char *,...)
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
static bool parseFontFaceNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler *handler)
void setRequiredFeatures(const QStringList &lst)
static QVector< Declaration > declarations(const QVector< StyleRule > &styleRules, const QString &part, quint64 pseudoClass=PseudoClass_Unspecified)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static void parseFont(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *handler)
static bool parseScriptNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static const char * data(const QByteArray &arr)
void setArgs(bool fill, const QList< QColor > &colors)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QStack< QSvgNode * > m_nodes
virtual NodePtr duplicateNode(NodePtr node) const
The Translate object provides a way to move an Item without changing its x or y properties.
qreal qAtan2(qreal x, qreal y)
static QSvgNode * createLineNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
qreal width() const
Returns the width of the rectangle.
static void parseBrush(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *handler)
const QChar * unicode() const
Returns a Unicode representation of the string reference.
QVector< StyleSheet > styleSheets
virtual QStringList nodeIds(NodePtr node) const
static bool isDigit(ushort ch)
static void pathArc(QPainterPath &path, qreal rx, qreal ry, qreal x_axis_rotation, int large_arc_flag, int sweep_flag, qreal x, qreal y, qreal curx, qreal cury)
static bool parseCoreNode(QSvgNode *node, const QXmlStreamAttributes &attributes)
static QSvgNode * createTextNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
The State element defines configurations of objects and properties.
static QSvgNode * createUseNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
virtual ~QSvgStyleSelector()
void setMiterLimit(qreal limit)
void setFamilyName(const QString &name)
QMatrix & shear(qreal sh, qreal sv)
Shears the coordinate system by sh horizontally and sv vertically, and returns a reference to the mat...
void push(const T &t)
Adds element t to the top of the stack.
static FactoryMethod findGroupFactory(const QString &name)
void setVariant(QFont::Capitalization fontVariant)
The QStringRef class provides a thin wrapper around QString substrings.
static QStringRef trimRef(const QStringRef &str)
static void parseColor(QSvgNode *, const QSvgAttributes &attributes, QSvgHandler *handler)
static bool parseGlyphNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static bool parseStyleNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
static FactoryMethod findGraphicsFactory(const QString &name)
const T & at(int i) const
Returns the item at index position i in the vector.
void setDashOffset(qreal offset)
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
QString gradientId() const
TokenType readNext()
Reads the next token and returns its type.
static bool parseFontFaceNameNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static QSvgStyleProperty * createLinearGradientNode(QSvgNode *node, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
static QSvgNode::DisplayMode displayStringToEnum(const QString &str)
LengthType defaultCoordinateSystem() const
static qreal convertToPixels(qreal len, bool, QSvgHandler::LengthType type)
static void parseCSStoXMLAttrs(const QVector< QCss::Declaration > &declarations, QXmlStreamAttributes &attributes)
static bool createSvgGlyph(QSvgFont *font, const QXmlStreamAttributes &attributes)
QRgb qRgb(int r, int g, int b)
Returns the ARGB quadruplet (255, {r}, {g}, {b}).
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool isNull() const
Returns true if this string is null; otherwise returns false.
static QVector< qreal > parsePercentageList(const QChar *&str)
void setMatrix(const QMatrix &matrix)
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
static QByteArray fromBase64(const QByteArray &base64)
Returns a decoded copy of the Base64 array base64.
static bool parseMetadataNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
int position() const
Returns the starting position in the referenced string that is referred to by the string reference...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
static bool parseHkernNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static QPainter::CompositionMode svgToQtCompositionMode(const QString &op)
void setFillOpacity(qreal opacity)
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
static bool parseAnchorNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
QString & append(QChar c)
int compare(const QString &s) const
void setFamily(const QString &family)
QSvgTinyDocument * doc() const
The Scale element provides a way to scale an Item.
The QFile class provides an interface for reading from and writing to files.
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
void setUnitsPerEm(qreal upem)
const QString * string() const
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a ...
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
QSvgStyleProperty * styleProperty(QSvgStyleProperty::Type type) const
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
The QGradient class is used in combination with QBrush to specify gradient fills. ...
QStack< CurrentNode > m_skipNodes
virtual Type type() const =0
QSvgStructureNode * nodeToStructure(QSvgNode *n) const
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
static bool parseStopNode(QSvgStyleProperty *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
void setCoordinateMode(CoordinateMode mode)
Sets the coordinate mode of this gradient to mode.
static QSvgNode * createImageNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
static QSvgNode * createTextAreaNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
uint qstrlen(const char *str)
#define st(var, type, card)
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
reference back()
This function is provided for STL compatibility.
LengthType m_defaultCoords
double toDouble(bool *ok=0) const
Returns the string converted to a double value.
void setDisplayMode(DisplayMode display)
QString nodeToName(QSvgNode *node) const
void parseCSStoXMLAttrs(QString css, QVector< QSvgCssAttribute > *attributes)
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
void addGlyph(QChar unicode, const QPainterPath &path, qreal horizAdvX=-1)
void setDefaultCoordinateSystem(LengthType type)
The QRect class defines a rectangle in the plane using integer precision.
int animationDuration() const
virtual bool hasAttributes(NodePtr node) const
static bool parseTitleNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
void setLineCap(Qt::PenCapStyle cap)
static QSvgNode * createSwitchNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
QVector< Declaration > declarationsForNode(NodePtr node, const char *extraPseudo=0)
char toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0.
void quadTo(const QPointF &ctrlPt, const QPointF &endPt)
Adds a quadratic Bezier curve between the current position and the given endPoint with the control po...
static bool parseMpathNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
void setStyle(QSvgFillStyleProperty *style)
QStringRef processingInstructionData() const
Returns the data of a ProcessingInstruction.
qreal y() const
Returns the y-coordinate of this point.
void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt)
Adds a cubic Bezier curve between the current position and the given endPoint using the control point...
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
void setStroke(QBrush brush)
QStack< QColor > m_colorStack
QSvgNode * previousSiblingNode(QSvgNode *n) const
QStringRef strokeLineJoin
static bool parseDescNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static qreal parseLength(const QString &str, QSvgHandler::LengthType &type, QSvgHandler *handler, bool *ok=NULL)
bool startElement(const QString &localName, const QXmlStreamAttributes &attributes)
bool characters(const QStringRef &str)
void setVisible(bool visible)
static qreal toDouble(const QChar *&str)
static qreal convertToNumber(const QString &str, QSvgHandler *handler, bool *ok=NULL)
void setStopLink(const QString &link, QSvgTinyDocument *doc)
bool gradientStopsSet() const
void setDashArray(const QVector< qreal > &dashes)
static void cssStyleLookup(QSvgNode *node, QSvgHandler *handler, QSvgStyleSelector *selector)
bool parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity=Qt::CaseSensitive)
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
bool isIdentity() const
Returns true if the matrix is the identity matrix, otherwise returns false.
bool processingInstruction(const QString &target, const QString &data)
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
virtual bool nodeNameEquals(NodePtr node, const QString &nodeName) const
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
static bool parseSetNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
void reserve(int size)
Attempts to allocate memory for at least size elements.
void setNodeId(const QString &i)
bool isValid() const
Returns true if the color is valid; otherwise returns false.
QStringRef processingInstructionTarget() const
Returns the target of a ProcessingInstruction.
QString familyName() const
void setTextArea(const QSizeF &size)
QMatrix & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
static bool parseAnimateTransformNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
bool isGradientResolved() const
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
QSvgTinyDocument * document() const
QStringRef text() const
Returns the text of Characters , Comment , DTD , or EntityReference.
static StyleFactoryMethod findStyleFactoryMethod(const QString &name)
void setRequiredFonts(const QStringList &lst)
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
static QSvgNode * createTspanNode(QSvgNode *parent, const QXmlStreamAttributes &, QSvgHandler *)
QSvgStructureNode * svgStructure(NodePtr node) const
void setNamespaceProcessing(bool)
The QFileInfo class provides system-independent file information.
QImageIOHandler * handler
void setGradientId(const QString &Id)
static bool parsePrefetchNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
static int qsvg_h2i(char hex)
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
QColor currentColor() const
void append(const QString &namespaceUri, const QString &name, const QString &value)
Appends a new attribute with name in the namespace described with namespaceUri, and value value...
#define qPrintable(string)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static bool parseHandlerNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
QSvgRefCounter< QSvgStyleProperty > m_style
int size() const
Returns the number of items in the vector.
static QImage fromData(const uchar *data, int size, const char *format=0)
Constructs a QImage from the first size bytes of the given binary data.
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok)
void setGradientResolved(bool resolved)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QXmlStreamAttributes attributes() const
Returns the attributes of a StartElement.
static QSvgNode * createPathNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
const QChar * constData() const
Returns a pointer to the data stored in the QString.
static QSvgNode * createEllipseNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *)
const QChar at(int i) const
Returns the character at the given index position in the string reference.
static void parseNumbersArray(const QChar *&str, QVarLengthArray< qreal, 8 > &points)
QSvgStyleSelector * m_selector
QStack< QSvgText::WhitespaceMode > m_whitespaceMode
Follows the depths of elements.
QXmlStreamStringRef value
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
T & top()
Returns a reference to the stack's top item.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
static void parsePen(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *handler)
static void parseBaseGradient(QSvgNode *node, const QXmlStreamAttributes &attributes, QSvgGradientStyle *gradProp, QSvgHandler *handler)