diff options
Diffstat (limited to 'libraries/daguerre/include')
-rw-r--r-- | libraries/daguerre/include/daguerre/image.hpp | 2 | ||||
-rw-r--r-- | libraries/daguerre/include/daguerre/impl/image.hpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libraries/daguerre/include/daguerre/image.hpp b/libraries/daguerre/include/daguerre/image.hpp index 4c44dd0..a55f43b 100644 --- a/libraries/daguerre/include/daguerre/image.hpp +++ b/libraries/daguerre/include/daguerre/image.hpp @@ -55,6 +55,8 @@ namespace daguerre { ~image(); void fill(const color_t &color); + void fill( + const color_t &color, int start_x, int start_y, int width, int height); //does not check bounds color_t &at(int x, int y); diff --git a/libraries/daguerre/include/daguerre/impl/image.hpp b/libraries/daguerre/include/daguerre/impl/image.hpp index 9160951..6cf2ca9 100644 --- a/libraries/daguerre/include/daguerre/impl/image.hpp +++ b/libraries/daguerre/include/daguerre/impl/image.hpp @@ -104,6 +104,14 @@ namespace daguerre { } template <class color_t> + void image<color_t>::fill( + const color_t &color, int start_x, int start_y, int width, int height) { + for (int y = start_y; y < start_y + height; ++y) + for (int x = 0; x < start_x + width; ++x) + buffer[y * buffer_pitch + x] = color; + } + + template <class color_t> color_t &image<color_t>::at(int x, int y) { return buffer[y * buffer_pitch + x]; } |