]> git.sesse.net Git - kdenlive/blob - src/titledocument.h
Add 3d rotation to objects in titler, based on patch from Till Theato
[kdenlive] / src / titledocument.h
1 /***************************************************************************
2                           titledocument.h  -  description
3                              -------------------
4     begin                : Feb 28 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 #ifndef TITLEDOCUMENT_H
18 #define TITLEDOCUMENT_H
19
20 #include <QDomDocument>
21
22 #include <KUrl>
23
24 class QGraphicsScene;
25 class QGraphicsRectItem;
26
27 const int ROTATEFACTOR = 103;
28 const int ZOOMFACTOR = 104;
29
30 class TitleDocument
31 {
32
33 public:
34     TitleDocument();
35     void setScene(QGraphicsScene* scene, int width, int height);
36     bool saveDocument(const KUrl& url, QGraphicsRectItem* startv, QGraphicsRectItem* endv, int out);
37     QDomDocument xml(QGraphicsRectItem* startv, QGraphicsRectItem* endv);
38     int loadFromXml(QDomDocument doc, QGraphicsRectItem* startv, QGraphicsRectItem* endv, int *out);
39     /** \brief Get the background color (incl. alpha) from the document, if possibly
40      * \returns The background color of the document, inclusive alpha. If none found, returns (0,0,0,0) */
41     QColor getBackgroundColor();
42     int frameWidth() const;
43     int frameHeight() const;
44
45     enum ItemOrigin {OriginXLeft = 0, OriginYTop = 1};
46     enum AxisPosition {AxisDefault = 0, AxisInverted = 1};
47
48 private:
49     QGraphicsScene* m_scene;
50     int m_width;
51     int m_height;
52     QString colorToString(const QColor&);
53     QString rectFToString(const QRectF&);
54     QRectF stringToRect(const QString &);
55     QColor stringToColor(const QString &);
56     QTransform stringToTransform(const QString &);
57     QList<QVariant> stringToList(const QString &);
58 };
59
60 #endif
61
62