using a texture for the grid is better
[vrfileman] / src / image.h
diff --git a/src/image.h b/src/image.h
new file mode 100644 (file)
index 0000000..0ddbd12
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef IMAGE_H_
+#define IMAGE_H_
+
+
+class Image {
+public:
+       enum Format {
+               FMT_GREY,
+               FMT_RGB,
+               FMT_RGBA,
+               FMT_GREY_FLOAT,
+               FMT_RGB_FLOAT,
+               FMT_RGBA_FLOAT
+       };
+
+private:
+       Format fmt;
+       int width, height;
+       void *pixels;
+
+public:
+       Image();
+       ~Image();
+
+       Image(const Image &img);
+       Image &operator =(const Image &img);
+
+       Image(Image &&img);
+       Image &operator =(Image &&img);
+
+       int get_width() const;
+       int get_height() const;
+
+       Format get_format() const;
+
+       bool create(int x, int y, Format fmt = FMT_RGBA);
+       bool set_pixels(int x, int y, void *pixels, Format fmt = FMT_RGBA);
+       void *get_pixels() const;
+
+       bool load(const char *fname);
+       bool save(const char *fname) const;
+};
+
+#endif // IMAGE_H_