X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fimage.h;h=15685c606e98353bf92d00c701c8f756f00b1fe2;hb=a6eecc5117d91534aaf13e93baf64855f4b963c0;hp=bfaeef84a00fbf7b945dbac8cc51d0fc593673bd;hpb=cfd3548464e6424fc9decf0539d6cd04b031ba10;p=libs%2Fgui.git diff --git a/source/graphics/image.h b/source/graphics/image.h index bfaeef8..15685c6 100644 --- a/source/graphics/image.h +++ b/source/graphics/image.h @@ -3,7 +3,8 @@ #include #include -#include +#include +#include "mspgui_api.h" #include "pixelformat.h" namespace Msp { @@ -11,17 +12,21 @@ namespace Graphics { class ImageLoader; -class Image +class MSPGUI_API Image { public: struct Data { - PixelFormat fmt; - unsigned width; - unsigned height; - char *data; - - Data(); + PixelFormat fmt = RGB; + unsigned width = 0; + unsigned height = 0; + unsigned stride = 0; + char *owned_pixels = nullptr; + char *pixels = nullptr; + + Data() = default; + Data(const Data &); + Data &operator=(const Data &); ~Data(); }; @@ -30,13 +35,17 @@ private: public: void load_file(const std::string &); - void load_io(IO::Base &); + void load_io(IO::Seekable &); void load(ImageLoader &); + void load_into(ImageLoader &, void *); + void load_headers(ImageLoader &); PixelFormat get_format() const { return data.fmt; } unsigned get_width() const { return data.width; } unsigned get_height() const { return data.height; } - const void *get_data() const { return data.data; } + unsigned get_stride() const { return data.stride; } + DEPRECATED const void *get_data() const { return data.pixels; } + const void *get_pixels() const { return data.pixels; } }; } // namespace Graphics