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