1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-17 00:25:06 +00:00
serenity/Userland/Applications/PixelPaint/PickerTool.cpp
2021-08-01 08:10:16 +02:00

32 lines
687 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "PickerTool.h"
#include "ImageEditor.h"
#include "Layer.h"
namespace PixelPaint {
PickerTool::PickerTool()
{
}
PickerTool::~PickerTool()
{
}
void PickerTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&)
{
if (!layer.rect().contains(event.position()))
return;
auto color = layer.bitmap().get_pixel(event.position());
if (event.button() == GUI::MouseButton::Left)
m_editor->set_primary_color(color);
else if (event.button() == GUI::MouseButton::Right)
m_editor->set_secondary_color(color);
}
}