ComicImageView now uses an array of ImlibImageList instead of an array of ImlibImage...
[qcomicbook-oblomov] / src / imlibimage.h
1 /*
2  * This file is a part of QComicBook.
3  *
4  * Copyright (C) 2005-2006 Pawel Stolowski <yogin@linux.bydg.org>
5  *
6  * QComicBook is free software; you can redestribute it and/or modify it
7  * under terms of GNU General Public License by Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY. See GPL for more details.
11  */
12
13 #ifndef __IMLIBIMAGE_H
14 #define __IMLIBIMAGE_H
15
16 /*! \file imlibimage.h */
17
18 #include <qmutex.h>
19 #include <qptrlist.h>
20
21 class QPaintDevice;
22 class QString;
23
24 namespace QComicBook
25 {
26         enum ImageFormat {
27                 STRIP_FORMAT  = 0,
28                 PAGE_FORMAT   = 1,
29                 SPREAD_FORMAT = 2,
30                 OTHER_FORMAT  = 1 << 31
31         };
32
33         class ImlibImage
34         {
35                 private:
36                         void *data;
37                         void *context;
38                         int w, h;
39                         static QMutex mutex;
40                         ImageFormat frmt;
41
42                 public:
43                         ImlibImage();
44                         ~ImlibImage();
45                         int load(const QString &path);
46                         void draw(QPaintDevice *p, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);
47                         int width() const;
48                         int height() const;
49                         ImageFormat getFormat() const;
50                         void setFormat(ImageFormat format);
51                         void rotate(int orient);
52                         ImlibImage* rotateClone(int orient);
53                         void reset();
54
55                         static void setCacheSize(int bytes);
56         };
57
58         typedef QPtrList<ImlibImage> ImlibImageList;
59 };
60
61 #endif
62