KDEGames

kgamesvgdocument.h
Go to the documentation of this file.
1 
6 /***************************************************************************
7  * Copyright (C) 2007 Mark A. Taff <[email protected]> *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU Library General Public License *
11  * version 2 as published by the Free Software Foundation *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU Library General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Library General Public *
19  * License along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  ***************************************************************************/
23 
24 #ifndef _KGAMESVGDOCUMENT_H_
25 #define _KGAMESVGDOCUMENT_H_
26 
27 #include <QHash>
28 #include <QStringList>
29 #include <QTransform>
30 #include <QDomDocument>
31 #include <QLoggingCategory>
32 
33 #include "libkdegamesprivate_export.h"
34 
35 Q_DECLARE_LOGGING_CATEGORY(GAMES_LIB)
36 
37 class KGameSvgDocumentPrivate;
38 
118 class KDEGAMESPRIVATE_EXPORT KGameSvgDocument : public QDomDocument
119 {
120 public:
124  explicit KGameSvgDocument();
125 
130 
134  virtual ~KGameSvgDocument();
135 
139  KGameSvgDocument& operator=(const KGameSvgDocument &doc);
140 
148  ApplyToCurrentMatrix = 0x01,
152  ReplaceCurrentMatrix = 0x02
153  };
156 
164  Unsorted = 0x01,
168  UseInkscapeOrder = 0x02
169  };
172 
190  QDomNode elementByUniqueAttributeValue(const QString& attributeName, const QString& attributeValue);
191 
205  QDomNode elementById(const QString& attributeValue);
206 
211  void load();
212 
220  void load(const QString& svgFilename);
221 
230  void rotate(double degrees, const MatrixOptions& options = ApplyToCurrentMatrix);
231 
241  void translate(int xPixels, int yPixels, const MatrixOptions& options = ApplyToCurrentMatrix);
242 
252  void shear(double xRadians, double yRadians, const MatrixOptions& options = ApplyToCurrentMatrix);
253 
266  void skew(double xDegrees, double yDegrees, const MatrixOptions& options = ApplyToCurrentMatrix);
267 
280  void scale(double xFactor, double yFactor, const MatrixOptions& options = ApplyToCurrentMatrix);
281 
288  QDomNode currentNode() const;
289 
297  void setCurrentNode(const QDomNode& node);
298 
305  QString svgFilename() const;
306 
314  void setSvgFilename(const QString& svgFilename);
315 
330  QString styleProperty(const QString& propertyName) const;
331 
346  void setStyleProperty(const QString& propertyName, const QString& propertyValue);
347 
353  QString nodeToSvg() const;
354 
363  QByteArray nodeToByteArray() const;
364 
374  QString style() const;
375 
387  void setStyle(const QString& styleAttribute);
388 
394  QDomNodeList patterns() const;
395 
401  QDomNodeList linearGradients() const;
402 
408  QDomNodeList radialGradients() const;
409 
415  QDomNodeList defs() const;
416 
422  QDomNode def() const;
423 
429  QString transform() const;
430 
441  void setTransform(const QString& transformAttribute);
442 
448  QHash<QString, QString> styleProperties() const;
449 
462  void setStyleProperties(const QHash<QString, QString>& _styleProperties, const StylePropertySortOptions& options = Unsorted);
463 
470  QTransform transformMatrix() const;
471 
484  void setTransformMatrix(QTransform& matrix, const MatrixOptions& options = ApplyToCurrentMatrix);
485 
486 private:
487 
488 
492  KGameSvgDocumentPrivate * const d;
493 
494 };
495 Q_DECLARE_OPERATORS_FOR_FLAGS(KGameSvgDocument::MatrixOptions)
496 Q_DECLARE_OPERATORS_FOR_FLAGS(KGameSvgDocument::StylePropertySortOptions)
497 
498 #endif // _KGAMESVGDOCUMENT_H_
QFlags< StylePropertySortOption > StylePropertySortOptions
Q_DECLARE_FLAGS macro confuses doxygen, so create typedef&#39;s manually.
StylePropertySortOption
Options for sorting style properties when building a style attribute.
A class for manipulating an SVG file using DOM.
QFlags< MatrixOption > MatrixOptions
Q_DECLARE_FLAGS macro confuses doxygen, so create typedef&#39;s manually.
MatrixOption
Options for applying (multiplying) or replacing the current matrix.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:37:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.