libkdegames
kgamesvgdocument.h
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _KGAMESVGDOCUMENT_H_
00025 #define _KGAMESVGDOCUMENT_H_
00026
00027 #include <QtCore/QHash>
00028 #include <QtCore/QStringList>
00029 #include <QtGui/QMatrix>
00030 #include <QtXml/QDomDocument>
00031 #include <libkdegames_export.h>
00032
00033
00034 class KGameSvgDocumentPrivate;
00035
00113 class KDEGAMES_EXPORT KGameSvgDocument : public QDomDocument
00114 {
00115 public:
00119 explicit KGameSvgDocument();
00120
00124 KGameSvgDocument(const KGameSvgDocument &doc);
00125
00129 virtual ~KGameSvgDocument();
00130
00134 KGameSvgDocument& operator=(const KGameSvgDocument &doc);
00135
00139 enum MatrixOption {
00143 ApplyToCurrentMatrix = 0x01,
00147 ReplaceCurrentMatrix = 0x02
00148 };
00150 typedef QFlags<MatrixOption> MatrixOptions;
00151
00155 enum StylePropertySortOption {
00159 Unsorted = 0x01,
00163 UseInkscapeOrder = 0x02
00164 };
00166 typedef QFlags<StylePropertySortOption> StylePropertySortOptions;
00167
00185 QDomNode elementByUniqueAttributeValue(const QString& attributeName, const QString& attributeValue);
00186
00200 QDomNode elementById(const QString& attributeValue);
00201
00206 void load();
00207
00215 void load(const QString& svgFilename);
00216
00225 void rotate(double degrees, const MatrixOptions& options = ApplyToCurrentMatrix);
00226
00236 void translate(int xPixels, int yPixels, const MatrixOptions& options = ApplyToCurrentMatrix);
00237
00247 void shear(double xRadians, double yRadians, const MatrixOptions& options = ApplyToCurrentMatrix);
00248
00261 void skew(double xDegrees, double yDegrees, const MatrixOptions& options = ApplyToCurrentMatrix);
00262
00275 void scale(double xFactor, double yFactor, const MatrixOptions& options = ApplyToCurrentMatrix);
00276
00283 QDomNode currentNode() const;
00284
00292 void setCurrentNode(const QDomNode& node);
00293
00300 QString svgFilename() const;
00301
00309 void setSvgFilename(const QString& svgFilename);
00310
00325 QString styleProperty(const QString& propertyName) const;
00326
00341 void setStyleProperty(const QString& propertyName, const QString& propertyValue);
00342
00348 QString nodeToSvg() const;
00349
00358 QByteArray nodeToByteArray() const;
00359
00369 QString style() const;
00370
00382 void setStyle(const QString& styleAttribute);
00383
00389 QDomNodeList patterns() const;
00390
00396 QDomNodeList linearGradients() const;
00397
00403 QDomNodeList radialGradients() const;
00404
00410 QDomNodeList defs() const;
00411
00417 QDomNode def() const;
00418
00424 QString transform() const;
00425
00436 void setTransform(const QString& transformAttribute);
00437
00443 QHash<QString, QString> styleProperties() const;
00444
00457 void setStyleProperties(const QHash<QString, QString>& _styleProperties, const StylePropertySortOptions& options = Unsorted);
00458
00465 QMatrix transformMatrix() const;
00466
00479 void setTransformMatrix(QMatrix& matrix, const MatrixOptions& options = ApplyToCurrentMatrix);
00480
00481 private:
00482
00483
00487 KGameSvgDocumentPrivate * const d;
00488
00489 };
00490 Q_DECLARE_OPERATORS_FOR_FLAGS(KGameSvgDocument::MatrixOptions)
00491 Q_DECLARE_OPERATORS_FOR_FLAGS(KGameSvgDocument::StylePropertySortOptions)
00492
00493 #endif // _KGAMESVGDOCUMENT_H_