mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
1c0669f010
Instead of LibGUI and WindowServer building their own copies of the drawing and graphics code, let's it in a separate LibDraw library. This avoids building the code twice, and will encourage better separation of concerns. :^)
22 lines
530 B
C++
22 lines
530 B
C++
#include "PickerTool.h"
|
|
#include <LibDraw/GraphicsBitmap.h>
|
|
|
|
PickerTool::PickerTool()
|
|
{
|
|
}
|
|
|
|
PickerTool::~PickerTool()
|
|
{
|
|
}
|
|
|
|
void PickerTool::on_mousedown(GMouseEvent& event)
|
|
{
|
|
ASSERT(m_widget);
|
|
if (!m_widget->bitmap().rect().contains(event.position()))
|
|
return;
|
|
auto color = m_widget->bitmap().get_pixel(event.position());
|
|
if (event.button() == GMouseButton::Left)
|
|
m_widget->set_primary_color(color);
|
|
else if (event.button() == GMouseButton::Right)
|
|
m_widget->set_secondary_color(color);
|
|
}
|