]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/image.h
Add decorations for things which should be exported from the library
[libs/gui.git] / source / graphics / image.h
index 9f170046a333880bcad995e2fbd3e0574b28e538..15685c606e98353bf92d00c701c8f756f00b1fe2 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdexcept>
 #include <string>
 #include <msp/io/seekable.h>
+#include "mspgui_api.h"
 #include "pixelformat.h"
 
 namespace Msp {
@@ -11,18 +12,19 @@ namespace Graphics {
 
 class ImageLoader;
 
-class Image
+class MSPGUI_API Image
 {
 public:
        struct Data
        {
-               PixelFormat fmt;
-               unsigned width;
-               unsigned height;
-               unsigned stride;
-               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();
@@ -35,12 +37,15 @@ public:
        void load_file(const std::string &);
        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; }
        unsigned get_stride() const { return data.stride; }
-       const void *get_data() const { return data.data; }
+       DEPRECATED const void *get_data() const { return data.pixels; }
+       const void *get_pixels() const { return data.pixels; }
 };
 
 } // namespace Graphics