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