]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/image.h
Consistently label the graphics part as graphics
[libs/gui.git] / source / graphics / image.h
1 #ifndef MSP_GRAPHICS_IMAGE_H_
2 #define MSP_GRAPHICS_IMAGE_H_
3
4 #include <string>
5 #include "pixelformat.h"
6
7 namespace Msp {
8 namespace Graphics {
9
10 class unsupported_image_format: public std::runtime_error
11 {
12 public:
13         unsupported_image_format(const std::string &w): std::runtime_error(w) { }
14         virtual ~unsupported_image_format() throw() { }
15 };
16
17 class bad_image_data: public std::runtime_error
18 {
19 public:
20         bad_image_data(const std::string &w): std::runtime_error(w) { }
21         virtual ~bad_image_data() throw() { }
22 };
23
24
25 class Image
26 {
27 public:
28         struct Private;
29
30 private:
31         Private *priv;
32
33 public:
34         Image();
35         ~Image();
36
37         void load_file(const std::string &);
38         void load_memory(const void *, unsigned);
39         PixelFormat get_format() const;
40         unsigned get_width() const;
41         unsigned get_height() const;
42         const void *get_data() const;
43 };
44
45 } // namespace Graphics
46 } // namespace Msp
47
48 #endif