diff options
Diffstat (limited to 'src/render/image.h')
-rw-r--r-- | src/render/image.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/render/image.h b/src/render/image.h index 244948e..3182fc8 100644 --- a/src/render/image.h +++ b/src/render/image.h @@ -20,7 +20,7 @@ public: ~Image(); /// pointer to the raw image data - inline unsigned char *data() { + inline unsigned char *ptr() { return image_data; } @@ -28,6 +28,10 @@ public: inline unsigned char *operator[](size_t index) { return &image_data[index]; } + + inline unsigned char *pixel(size_t x, size_t y) { + return &image_data[(y * image_width + x) * image_channels]; + } /// width of the image in pixels inline unsigned int width() const { @@ -61,10 +65,16 @@ public: void swap_channels(); /// flip upside-down - void flip(); + void flip_vertical(); + + /// flip left-right + void flip_horizontal(); /// pad width and height up to 8 bytes void pad(); + + /// load an image + static Image *load(const std::string & name); private: unsigned char *image_data; |