]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/image.h
Change the ImageLoader API to use IO::Seekable
[libs/gui.git] / source / graphics / image.h
1 #ifndef MSP_GRAPHICS_IMAGE_H_
2 #define MSP_GRAPHICS_IMAGE_H_
3
4 #include <stdexcept>
5 #include <string>
6 #include <msp/io/seekable.h>
7 #include "pixelformat.h"
8
9 namespace Msp {
10 namespace Graphics {
11
12 class ImageLoader;
13
14 class Image
15 {
16 public:
17         struct Data
18         {
19                 PixelFormat fmt;
20                 unsigned width;
21                 unsigned height;
22                 char *data;
23
24                 Data();
25                 ~Data();
26         };
27
28 private:
29         Data data;
30
31 public:
32         void load_file(const std::string &);
33         void load_io(IO::Seekable &);
34         void load(ImageLoader &);
35
36         PixelFormat get_format() const { return data.fmt; }
37         unsigned get_width() const { return data.width; }
38         unsigned get_height() const { return data.height; }
39         const void *get_data() const { return data.data; }
40 };
41
42 } // namespace Graphics
43 } // namespace Msp
44
45 #endif