ladybird/Applications/PaintBrush/PickerTool.cpp
Andreas Kling 1c0669f010 LibDraw: Introduce (formerly known as SharedGraphics.)
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. :^)
2019-07-18 10:18:16 +02:00

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);
}