]> git.sven.stormbind.net Git - sven/vym.git/blob - src/imageobj.h
Replace Pierre as the maintainer
[sven/vym.git] / src / imageobj.h
1 #ifndef IMAGEOBJ_H
2 #define IMAGEOBJ_H
3
4 #include <QGraphicsPixmapItem>
5 #include <QGraphicsScene>
6 #include <QGraphicsSvgItem>
7
8 /*! \brief Base class for images, which can be pixmaps or svg
9  *
10  * ImageObj is used both by items part of the map "tree" in
11  * ImageItem and as flag in FlagObj
12  *
13  * Both of these types are actually drawn onto the map
14  */
15
16 class ImageObj : public QGraphicsItem {
17   public:
18     enum ImageType { Undefined, Pixmap, SVG, ClonedSVG };
19
20     ImageObj();
21     ImageObj(QGraphicsItem *);
22     ~ImageObj();
23     void init();
24     void copy(ImageObj *);
25     void setPos(const QPointF &pos);
26     void setPos(const qreal &x, const qreal &y);
27     void setZValue(qreal z);
28     void setVisibility(bool);
29     void setWidth(qreal w);
30     void setScaleFactor(qreal f);
31     qreal getScaleFactor();
32     virtual QRectF boundingRect() const;
33     virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
34     bool load(const QString &, bool createClone = false);
35     bool save(const QString &);
36     QString getExtension();
37     ImageType getType();
38     QIcon getIcon();
39
40   protected:
41     ImageObj::ImageType imageType;
42
43     QGraphicsSvgItem *svgItem;
44     QString svgCachePath;
45
46     QGraphicsPixmapItem *pixmapItem;
47
48     qreal scaleFactor;
49
50     ulong imageID;
51 };
52 #endif