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 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
void setTransform(const QString &transformAttribute)
Sets the transform attribute of the current node.
Definition: kgamesvgdocument.cpp:436
This file contains the regexs for parsing the transform attribute of an SVG file using DOM...
QMatrix transformMatrix() const
Returns the transform attribute of the current node as a matrix.
Definition: kgamesvgdocument.cpp:508
QString styleProperty(const QString &propertyName) const
Returns the value of the style property given for the current node.
Definition: kgamesvgdocument.cpp:325
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
QDomNodeList radialGradients() const
Returns the radialGradients in the document.
Definition: kgamesvgdocument.cpp:416
void setTransformMatrix(QMatrix &matrix, const MatrixOptions &options=ApplyToCurrentMatrix)
Sets the transform attribute of the current node.
Definition: kgamesvgdocument.cpp:622
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
QFlags< StylePropertySortOption > StylePropertySortOptions
Q_DECLARE_FLAGS macro confuses doxygen, so create typedef's manually.
Definition: kgamesvgdocument.h:168
static const QString TRANSFORMS
A regex that matches the entire transform attribute.
Definition: kgamesvgdocument_p.h:121
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
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
QFlags< MatrixOption > MatrixOptions
Q_DECLARE_FLAGS macro confuses doxygen, so create typedef's manually.
Definition: kgamesvgdocument.h:152
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
void scale(double xFactor, double yFactor, const MatrixOptions &options=ApplyToCurrentMatrix)
Scales the origin of the current node.
Definition: kgamesvgdocument.cpp:284
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
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 nodeToSvg() const
Returns the current node and it's children as a new xml svg document.
Definition: kgamesvgdocument.cpp:340
QDomNode elementByUniqueAttributeValue(const QString &attributeName, const QString &attributeValue)
Returns the node with the given value for the given attribute.
Definition: kgamesvgdocument.cpp:165
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
void setStyleProperty(const QString &propertyName, const QString &propertyValue)
Sets the value of the style property given for the current node.
Definition: kgamesvgdocument.cpp:330
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:45 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:45 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.