From 60b4d906081730558c0275e344e0723fd0d0e7d3 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 12 Aug 2024 00:49:35 +0300 Subject: [PATCH] LibGUI: Add Window::get_pixel() This is fine as its not reading from video memory --- userspace/libraries/LibGUI/include/LibGUI/Window.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/userspace/libraries/LibGUI/include/LibGUI/Window.h b/userspace/libraries/LibGUI/include/LibGUI/Window.h index 970538a5..b3e88aff 100644 --- a/userspace/libraries/LibGUI/include/LibGUI/Window.h +++ b/userspace/libraries/LibGUI/include/LibGUI/Window.h @@ -112,6 +112,13 @@ namespace LibGUI m_framebuffer[y * m_width + x] = color; } + uint32_t get_pixel(uint32_t x, uint32_t y) const + { + ASSERT(x < m_width); + ASSERT(y < m_height); + return m_framebuffer[y * m_width + x]; + } + void fill_rect(int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t color); void fill(uint32_t color) { return fill_rect(0, 0, width(), height(), color); }