• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames

kgamesvgdocument.h

Go to the documentation of this file.
00001 
00006 /***************************************************************************
00007  *   Copyright (C) 2007 Mark A. Taff <kde@marktaff.com>                    *
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU Library General Public License          *
00011  *   version 2 as published by the Free Software Foundation                *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU Library General Public License for more details.                  *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU Library General Public     *
00019  *   License along with this program; if not, write to the                 *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
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_

libkdegames

Skip menu "libkdegames"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal