diff options
author | Benji Dial <benji@benjidial.net> | 2024-07-29 19:59:52 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-07-29 19:59:52 -0400 |
commit | e6c3a80b01ffb52079783cddd9be6d392d0f7039 (patch) | |
tree | 148276b9878f287bc81638f90249ec4d7b86eaf0 /libraries/daguerre | |
parent | be691582ee12613278af24cb5a824eeb357f6324 (diff) | |
download | hilbert-os-e6c3a80b01ffb52079783cddd9be6d392d0f7039.tar.gz |
redesign compositor protocol, start widget library
Diffstat (limited to 'libraries/daguerre')
-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]; } |