2020-01-18 08:38:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-16 09:33:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Tool.h"
|
2020-02-06 14:04:03 +00:00
|
|
|
#include <LibCore/Timer.h>
|
2020-02-06 19:33:02 +00:00
|
|
|
#include <LibGUI/ActionGroup.h>
|
|
|
|
#include <LibGUI/Painter.h>
|
2019-06-16 09:33:20 +00:00
|
|
|
|
2020-05-20 18:35:35 +00:00
|
|
|
namespace PixelPaint {
|
2020-05-12 21:44:46 +00:00
|
|
|
|
2019-06-16 09:33:20 +00:00
|
|
|
class SprayTool final : public Tool {
|
|
|
|
public:
|
|
|
|
SprayTool();
|
|
|
|
virtual ~SprayTool() override;
|
|
|
|
|
2021-08-25 08:07:24 +00:00
|
|
|
virtual void on_mousedown(Layer*, MouseEvent&) override;
|
|
|
|
virtual void on_mouseup(Layer*, MouseEvent&) override;
|
|
|
|
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
2020-10-15 17:57:07 +00:00
|
|
|
virtual GUI::Widget* get_properties_widget() override;
|
2021-08-08 18:50:27 +00:00
|
|
|
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
|
2019-06-16 09:33:20 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void paint_it();
|
2020-10-15 17:57:07 +00:00
|
|
|
|
|
|
|
RefPtr<GUI::Widget> m_properties_widget;
|
2020-02-02 11:34:39 +00:00
|
|
|
RefPtr<Core::Timer> m_timer;
|
2020-06-10 08:57:59 +00:00
|
|
|
Gfx::IntPoint m_last_pos;
|
2019-06-16 09:33:20 +00:00
|
|
|
Color m_color;
|
2020-10-15 17:57:07 +00:00
|
|
|
int m_thickness { 10 };
|
|
|
|
int m_density { 40 };
|
2019-06-16 09:33:20 +00:00
|
|
|
};
|
2020-05-12 21:44:46 +00:00
|
|
|
|
|
|
|
}
|