]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/image.h
Consistently label the graphics part as graphics
[libs/gui.git] / source / graphics / image.h
diff --git a/source/graphics/image.h b/source/graphics/image.h
new file mode 100644 (file)
index 0000000..db65010
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef MSP_GRAPHICS_IMAGE_H_
+#define MSP_GRAPHICS_IMAGE_H_
+
+#include <string>
+#include "pixelformat.h"
+
+namespace Msp {
+namespace Graphics {
+
+class unsupported_image_format: public std::runtime_error
+{
+public:
+       unsupported_image_format(const std::string &w): std::runtime_error(w) { }
+       virtual ~unsupported_image_format() throw() { }
+};
+
+class bad_image_data: public std::runtime_error
+{
+public:
+       bad_image_data(const std::string &w): std::runtime_error(w) { }
+       virtual ~bad_image_data() throw() { }
+};
+
+
+class Image
+{
+public:
+       struct Private;
+
+private:
+       Private *priv;
+
+public:
+       Image();
+       ~Image();
+
+       void load_file(const std::string &);
+       void load_memory(const void *, unsigned);
+       PixelFormat get_format() const;
+       unsigned get_width() const;
+       unsigned get_height() const;
+       const void *get_data() const;
+};
+
+} // namespace Graphics
+} // namespace Msp
+
+#endif