mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
PixelPaint: Refactor falloff computation and extend hardness range
This commit is contained in:
parent
7fae46361b
commit
b6d921f682
4 changed files with 14 additions and 7 deletions
|
@ -28,6 +28,12 @@ public:
|
|||
void set_hardness(int hardness) { m_hardness = hardness; }
|
||||
int hardness() const { return m_hardness; }
|
||||
|
||||
double get_falloff(double distance)
|
||||
{
|
||||
double multiplicand = hardness() == 100 ? 1.0 : 1.0 / (100 - hardness());
|
||||
return (1.0 - double { distance / size() }) * multiplicand;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Color color_for(GUI::MouseEvent const& event);
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color const& color, Gfx::IntPoint const& point);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue