]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/imageloader.h
06532753b3e535d152c84c6ad75abae80230167b
[libs/gui.git] / source / graphics / imageloader.h
1 #ifndef MSP_GRAPHICS_IMAGELOADER_H_
2 #define MSP_GRAPHICS_IMAGELOADER_H_
3
4 #include "image.h"
5
6 namespace Msp {
7 namespace Graphics {
8
9 class unsupported_image_format: public std::runtime_error
10 {
11 public:
12         unsupported_image_format(const std::string &w): std::runtime_error(w) { }
13         virtual ~unsupported_image_format() throw() { }
14 };
15
16 class bad_image_data: public std::runtime_error
17 {
18 public:
19         bad_image_data(const std::string &w): std::runtime_error(w) { }
20         virtual ~bad_image_data() throw() { }
21 };
22
23
24 class ImageLoader
25 {
26 private:
27         IO::Base *source;
28 protected:
29
30         ImageLoader();
31 public:
32         virtual ~ImageLoader();
33
34         static ImageLoader *open_file(const std::string &);
35         static ImageLoader *open_io(IO::Base &);
36
37         virtual void load(Image::Data &) = 0;
38 };
39
40 } // namespace Graphics
41 } // namespace Msp
42
43 #endif