libkdegames/libkdegamesprivate
kgamesvgdocument.cpp
Go to the documentation of this file.
66 QDomNode findElementById(const QString& attributeName, const QString& attributeValue, const QDomNode& node);
141 const QString KGameSvgDocumentPrivate::SVG_XML_PREPEND = QLatin1String("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><svg>");
165 QDomNode KGameSvgDocument::elementByUniqueAttributeValue(const QString& attributeName, const QString& attributeValue)
330 void KGameSvgDocument::setStyleProperty(const QString& propertyName, const QString& propertyValue)
353 pattern = QLatin1String( "url" ) + WSP_ASTERISK + OPEN_PARENS + WSP_ASTERISK + QLatin1String( "#(.*)" ) + WSP_ASTERISK + CLOSE_PARENS;
398 return d->m_currentElement.attribute( QLatin1String( "style" ), QLatin1String( "Element has no style attribute." ));
433 return d->m_currentElement.attribute( QLatin1String( "transform" ), QLatin1String( "Element has no transform attribute." ) );
468 void KGameSvgDocument::setStyleProperties(const QHash<QString, QString>& _styleProperties, const StylePropertySortOptions& options)
473 d->m_inkscapeOrder << QLatin1String( "fill" ) << QLatin1String( "fill-opacity" ) << QLatin1String( "fill-rule" ) << QLatin1String( "stroke" ) << QLatin1String( "stroke-width" ) << QLatin1String( "stroke-linecap" )
474 << QLatin1String( "stroke-linejoin" ) << QLatin1String( "stroke-miterlimit" ) << QLatin1String( "stroke-dasharray" ) << QLatin1String( "stroke-opacity" );
483 styleBuffer += property + QLatin1Char( ':' ) + styleProperties.take(property) + QLatin1Char( ';' );
544 while (transformAttribute.size() > 0 && i < 32) // 32 is an arbitrary limit for the number of transforms for a single node
640 if ((transform() == QLatin1String( "Element has no transform attribute." )) && (matrix == null))
655 QDomNode KGameSvgDocumentPrivate::findElementById(const QString& attributeName, const QString& attributeValue, const QDomNode& node)
658 QString value = e.attribute( attributeName, QLatin1String( "Element has no attribute with that name." ));
QString cap(int nth) const
iterator insert(const Key &key, const T &value)
QString svgFilename() const
Returns the name of the SVG file this DOM represents.
Definition: kgamesvgdocument.cpp:315
void setSvgFilename(const QString &svgFilename)
Sets the current SVG filename.
Definition: kgamesvgdocument.cpp:320
const Key & key() const
void setTransform(const QString &transformAttribute)
Sets the transform attribute of the current node.
Definition: kgamesvgdocument.cpp:436
QString attribute(const QString &name, const QString &defValue) const
This file contains the regexs for parsing the transform attribute of an SVG file using DOM...
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
bool hasNext() const
QMatrix transformMatrix() const
Returns the transform attribute of the current node as a matrix.
Definition: kgamesvgdocument.cpp:508
const T & at(int i) const
int size() const
void removeAt(int i)
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QString styleProperty(const QString &propertyName) const
Returns the value of the style property given for the current node.
Definition: kgamesvgdocument.cpp:325
bool startsWith(const QByteArray &ba) const
QHash< QString, QString > styleProperties() const
Returns a hash of the style properties of the current node.
Definition: kgamesvgdocument.cpp:441
QString style() const
Returns the style attribute of the current node.
Definition: kgamesvgdocument.cpp:396
QDomElement documentElement() const
QDomNodeList radialGradients() const
Returns the radialGradients in the document.
Definition: kgamesvgdocument.cpp:416
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
void chop(int n)
double toDouble(bool *ok) const
void setTransformMatrix(QMatrix &matrix, const MatrixOptions &options=ApplyToCurrentMatrix)
Sets the transform attribute of the current node.
Definition: kgamesvgdocument.cpp:622
int size() const
QDomNode nextSibling() const
void setPattern(const QString &pattern)
QDomElement toElement() const
int matchedLength() const
qreal m21() const
qreal m22() const
qreal m11() const
qreal m12() const
int indexIn(const QString &str, int offset, CaretMode caretMode) const
int count(const T &value) const
void append(const T &value)
qreal dx() const
qreal dy() const
When building a style attribute, sort properties the same way Inkscape does.
Definition: kgamesvgdocument.h:165
void shear(double xRadians, double yRadians, const MatrixOptions &options=ApplyToCurrentMatrix)
Shears the origin of the current node.
Definition: kgamesvgdocument.cpp:260
static const QString TRANSFORMS
A regex that matches the entire transform attribute.
Definition: kgamesvgdocument_p.h:121
QMatrix & translate(qreal dx, qreal dy)
QDomNodeList elementsByTagName(const QString &tagname) const
bool isEmpty() const
QString trimmed() const
QByteArray readAll()
static const QString TRANSFORM
A regex that matches any single transform.
Definition: kgamesvgdocument_p.h:115
QDomNode currentNode() const
Returns the last node found by elementById, or null if node not found.
Definition: kgamesvgdocument.cpp:304
KGameSvgDocument & operator=(const KGameSvgDocument &doc)
Assignment Operator.
Definition: kgamesvgdocument.cpp:158
void setStyleProperties(const QHash< QString, QString > &_styleProperties, const StylePropertySortOptions &options=Unsorted)
Sets the style properties of the current node.
Definition: kgamesvgdocument.cpp:468
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
This file contains the KGameSvgDocument class, used for manipulating an SVG file using DOM...
QString transform() const
Returns the transform attribute of the current node.
Definition: kgamesvgdocument.cpp:431
Item next()
void skew(double xDegrees, double yDegrees, const MatrixOptions &options=ApplyToCurrentMatrix)
Skews the origin of the current node.
Definition: kgamesvgdocument.cpp:276
static const QString WSP_ASTERISK
A regex that matches zero or more whitespace.
Definition: kgamesvgdocument_p.h:38
virtual void close()
void scale(double xFactor, double yFactor, const MatrixOptions &options=ApplyToCurrentMatrix)
Scales the origin of the current node.
Definition: kgamesvgdocument.cpp:284
bool isNull() const
QMatrix & rotate(qreal degrees)
Replace the current matrix.
Definition: kgamesvgdocument.h:149
void translate(int xPixels, int yPixels, const MatrixOptions &options=ApplyToCurrentMatrix)
Moves the origin of the current node.
Definition: kgamesvgdocument.cpp:244
QString * string() const
void save(QTextStream &str, int indent) const
QDomNode firstChild() const
QString mid(int position, int n) const
T take(const Key &key)
bool isEmpty() const
QDomDocument & operator=(const QDomDocument &x)
QString & setNum(short n, int base)
static const QString OPEN_PARENS
A regex that matches opening parenthesis.
Definition: kgamesvgdocument_p.h:60
static const QString CLOSE_PARENS
A regex that matches closing parenthesis.
Definition: kgamesvgdocument_p.h:65
QString fromLatin1(const char *str, int size)
QString nodeToSvg() const
Returns the current node and it's children as a new xml svg document.
Definition: kgamesvgdocument.cpp:340
bool contains(const Key &key) const
QDomNode elementByUniqueAttributeValue(const QString &attributeName, const QString &attributeValue)
Returns the node with the given value for the given attribute.
Definition: kgamesvgdocument.cpp:165
const T & value() const
QDomNodeList patterns() const
Returns the patterns in the document.
Definition: kgamesvgdocument.cpp:406
QDomNodeList linearGradients() const
Returns the linearGradients in the document.
Definition: kgamesvgdocument.cpp:411
QByteArray nodeToByteArray() const
Builds a new svg document and returns a QByteArray suitable for passing to QSvgRenderer::load().
Definition: kgamesvgdocument.cpp:391
void setCurrentNode(const QDomNode &node)
Sets the current node.
Definition: kgamesvgdocument.cpp:309
QDomNode elementById(const QString &attributeValue)
Returns a node with the given id.
Definition: kgamesvgdocument.cpp:178
void setStyle(const QString &styleAttribute)
Sets the style attribute of the current node.
Definition: kgamesvgdocument.cpp:401
void rotate(double degrees, const MatrixOptions &options=ApplyToCurrentMatrix)
Rotates the origin of the current node counterclockwise.
Definition: kgamesvgdocument.cpp:228
bool exactMatch(const QString &str) const
void setStyleProperty(const QString &propertyName, const QString &propertyValue)
Sets the value of the style property given for the current node.
Definition: kgamesvgdocument.cpp:330
QMatrix & scale(qreal sx, qreal sy)
QDomNode at(int index) const
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
QMatrix & shear(qreal sh, qreal sv)
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.