From e6c3a80b01ffb52079783cddd9be6d392d0f7039 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 29 Jul 2024 19:59:52 -0400 Subject: redesign compositor protocol, start widget library --- libraries/daguerre/include/daguerre/image.hpp | 2 ++ libraries/daguerre/include/daguerre/impl/image.hpp | 8 ++++++++ 2 files changed, 10 insertions(+) (limited to 'libraries/daguerre/include') 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 @@ -103,6 +103,14 @@ namespace daguerre { buffer[y * buffer_pitch + x] = color; } + template + void image::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 color_t &image::at(int x, int y) { return buffer[y * buffer_pitch + x]; -- cgit v1.2.3