1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

Compositor: Add API to get the color of a pixel

This just returns the color of a given pixel position from the
front bitmap of the corresponding screen.
This commit is contained in:
Mustafa Quraish 2021-09-03 23:12:04 -04:00 committed by Andreas Kling
parent 04ba31b8c5
commit 3da4fdd0eb
2 changed files with 6 additions and 0 deletions

View file

@ -78,6 +78,11 @@ const Gfx::Bitmap& Compositor::front_bitmap_for_screenshot(Badge<ClientConnectio
return *screen.compositor_screen_data().m_front_bitmap;
}
Gfx::Color Compositor::color_at_position(Badge<ClientConnection>, Screen& screen, Gfx::IntPoint const& position) const
{
return screen.compositor_screen_data().m_front_bitmap->get_pixel(position);
}
void CompositorScreenData::init_bitmaps(Compositor& compositor, Screen& screen)
{
// Recreate the screen-number overlay as the Screen instances may have changed, or get rid of it if we no longer need it

View file

@ -176,6 +176,7 @@ public:
const Gfx::Bitmap* cursor_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const;
const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const;
Gfx::Color color_at_position(Badge<ClientConnection>, Screen&, Gfx::IntPoint const&) const;
void register_animation(Badge<Animation>, Animation&);
void unregister_animation(Badge<Animation>, Animation&);