ImlibImage loading now also sets the image format (strip, page, spread or other/unknnown)
[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
20 class QPaintDevice;
21 class QString;
22
23 namespace QComicBook
24 {
25         enum ImageFormat {
26                 STRIP_FORMAT  = 0,
27                 PAGE_FORMAT   = 1,
28                 SPREAD_FORMAT = 2,
29                 OTHER_FORMAT  = 1 << 31
30         };
31
32         class ImlibImage
33         {
34                 private:
35                         void *data;
36                         void *context;
37                         int w, h;
38                         static QMutex mutex;
39                         ImageFormat frmt;
40
41                 public:
42                         ImlibImage();
43                         ~ImlibImage();
44                         int load(const QString &path);
45                         void draw(QPaintDevice *p, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);
46                         int width() const;
47                         int height() const;
48                         ImageFormat getFormat() const;
49                         void setFormat(ImageFormat format);
50                         void rotate(int orient);
51                         ImlibImage* rotateClone(int orient);
52                         void reset();
53
54                         static void setCacheSize(int bytes);
55         };
56 };
57
58 #endif
59