ladybird/Userland/Applications/PixelPaint/PickerTool.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

34 lines
714 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"
#include <LibGfx/Bitmap.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);
}
}