mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
PaintBrush: Port all the existing toolbox tools to the Layer world :^)
Many tools are not working perfectly right yet, but we'll fix them!
This commit is contained in:
parent
7dd8f1b921
commit
83d24dcb1d
25 changed files with 302 additions and 199 deletions
|
@ -25,8 +25,12 @@
|
|||
*/
|
||||
|
||||
#include "PickerTool.h"
|
||||
#include "Layer.h"
|
||||
#include "PaintableWidget.h"
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
||||
namespace PaintBrush {
|
||||
|
||||
PickerTool::PickerTool()
|
||||
{
|
||||
}
|
||||
|
@ -35,14 +39,15 @@ PickerTool::~PickerTool()
|
|||
{
|
||||
}
|
||||
|
||||
void PickerTool::on_mousedown(GUI::MouseEvent& event)
|
||||
void PickerTool::on_mousedown(Layer& layer, GUI::MouseEvent& event)
|
||||
{
|
||||
ASSERT(m_widget);
|
||||
if (!m_widget->bitmap().rect().contains(event.position()))
|
||||
if (!layer.rect().contains(event.position()))
|
||||
return;
|
||||
auto color = m_widget->bitmap().get_pixel(event.position());
|
||||
auto color = layer.bitmap().get_pixel(event.position());
|
||||
if (event.button() == GUI::MouseButton::Left)
|
||||
m_widget->set_primary_color(color);
|
||||
PaintableWidget::the().set_primary_color(color);
|
||||
else if (event.button() == GUI::MouseButton::Right)
|
||||
m_widget->set_secondary_color(color);
|
||||
PaintableWidget::the().set_secondary_color(color);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue