]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pixelstore.h
Deal with nontrivial image configurations
[libs/gl.git] / source / pixelstore.h
diff --git a/source/pixelstore.h b/source/pixelstore.h
new file mode 100644 (file)
index 0000000..0c43030
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef MSP_GL_PIXELSTORE_H_
+#define MSP_GL_PIXELSTORE_H_
+
+#include <msp/graphics/image.h>
+#include "bindable.h"
+
+namespace Msp {
+namespace GL {
+
+class PixelStore: public BindableWithDefault<PixelStore>
+{
+private:
+       unsigned row_length;
+       unsigned image_height;
+       unsigned skip_pixels;
+       unsigned skip_rows;
+       unsigned skip_images;
+       unsigned alignment;
+
+public:
+       PixelStore();
+
+       static PixelStore from_image(const Graphics::Image &);
+
+       void set_canvas_size(unsigned, unsigned);
+       void set_origin(unsigned, unsigned, unsigned);
+       void set_alignment(unsigned);
+
+       void bind() const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif