X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fimage.h;h=9f170046a333880bcad995e2fbd3e0574b28e538;hb=8e58f5bca4258e73e84e604ff2573fe9713b7b3f;hp=137f856f21f5736d40dbecae6275a26919c42536;hpb=1ca709deba08e55d95066be564a8fd43a321af19;p=libs%2Fgui.git diff --git a/source/graphics/image.h b/source/graphics/image.h index 137f856..9f17004 100644 --- a/source/graphics/image.h +++ b/source/graphics/image.h @@ -3,45 +3,44 @@ #include #include -#include +#include #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 ImageLoader; class Image { public: - struct Private; + struct Data + { + PixelFormat fmt; + unsigned width; + unsigned height; + unsigned stride; + char *data; + + Data(); + Data(const Data &); + Data &operator=(const Data &); + ~Data(); + }; private: - Private *priv; + Data data; public: - Image(); - ~Image(); - void load_file(const std::string &); - void load_io(IO::Base &); - PixelFormat get_format() const; - unsigned get_width() const; - unsigned get_height() const; - const void *get_data() const; + void load_io(IO::Seekable &); + void load(ImageLoader &); + + PixelFormat get_format() const { return data.fmt; } + unsigned get_width() const { return data.width; } + unsigned get_height() const { return data.height; } + unsigned get_stride() const { return data.stride; } + const void *get_data() const { return data.data; } }; } // namespace Graphics