]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/imageloader.h
Split image loading into headers and pixels
[libs/gui.git] / source / graphics / imageloader.h
index 9dc17269ef7d8054224492ad792795f0ad133afd..1ad6cc8c895aad812264df8663920cd6a56f6528 100644 (file)
@@ -23,6 +23,14 @@ public:
 
 class ImageLoader
 {
+public:
+       enum State
+       {
+               INITIAL,
+               HEADERS_LOADED,
+               FINISHED
+       };
+
 protected:
        class RegisterBase
        {
@@ -56,6 +64,7 @@ protected:
 
 private:
        IO::Base *source;
+       State state;
 
 protected:
        ImageLoader();
@@ -65,7 +74,14 @@ public:
        static ImageLoader *open_file(const std::string &);
        static ImageLoader *open_io(IO::Seekable &);
 
-       virtual void load(Image::Data &) = 0;
+       virtual void load(Image::Data &);
+       virtual void load_headers(Image::Data &);
+protected:
+       virtual void load_headers_(Image::Data &) = 0;
+       virtual void load_pixels_(Image::Data &) = 0;
+
+public:
+       State get_state() const { return state; }
 
        template<typename T>
        static void register_loader();