PixelPaint: Map color_distance_squared from 0 to 1

This commit is contained in:
Musab Kılıç 2021-10-29 16:20:31 +03:00 committed by Andreas Kling
parent 686efb6737
commit 4de7b3ad24
Notes: sideshowbarker 2024-07-18 01:37:11 +09:00

View file

@ -34,7 +34,7 @@ static float color_distance_squared(Gfx::Color const& lhs, Gfx::Color const& rhs
int a = rhs.red() - lhs.red();
int b = rhs.green() - lhs.green();
int c = rhs.blue() - lhs.blue();
return (a * a + b * b + c * c) / (255.0f * 255.0f);
return (a * a + b * b + c * c) / (3.0f * 255.0f * 255.0f);
}
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint const& start_position, Color target_color, Color fill_color, int threshold)