]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/pixelstore.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / core / pixelstore.h
diff --git a/source/core/pixelstore.h b/source/core/pixelstore.h
new file mode 100644 (file)
index 0000000..80032c3
--- /dev/null
@@ -0,0 +1,46 @@
+#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:
+       enum ParameterMask
+       {
+               SIZE = 1,
+               ORIGIN = 2,
+               ALIGNMENT = 4
+       };
+
+       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 &);
+
+private:
+       void update_parameter(int) const;
+
+public:
+       void set_canvas_size(unsigned, unsigned);
+       void set_origin(unsigned, unsigned, unsigned);
+       void set_alignment(unsigned);
+
+       void bind() const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif