]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/image.h
Use nullptr in place of 0 or NULL
[libs/gui.git] / source / graphics / image.h
index bfaeef84a00fbf7b945dbac8cc51d0fc593673bd..3f8f556e85a42fa88e5f7f886918037b3143434e 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <stdexcept>
 #include <string>
-#include <msp/io/base.h>
+#include <msp/io/seekable.h>
 #include "pixelformat.h"
 
 namespace Msp {
@@ -16,12 +16,16 @@ class 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 +34,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