1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:37:43 +00:00

LibGfx: Implement filling paths

There are some imperfections with intersecting edges (because the main
algorithm used is scanline, and that is not geared towards drawing
complex shapes), however, it behaves mostly fine for normal use :^)
This commit is contained in:
AnotherTest 2020-05-06 11:55:12 +04:30 committed by Andreas Kling
parent 4d20cf57db
commit f54b41f748
5 changed files with 274 additions and 8 deletions

View file

@ -37,7 +37,7 @@ class FloatRect;
class FloatPoint {
public:
FloatPoint() {}
FloatPoint() { }
FloatPoint(float x, float y)
: m_x(x)
, m_y(y)
@ -112,6 +112,13 @@ public:
}
FloatPoint operator+(const FloatPoint& other) const { return { m_x + other.m_x, m_y + other.m_y }; }
FloatPoint& operator/=(float factor)
{
m_x /= factor;
m_y /= factor;
return *this;
}
String to_string() const { return String::format("[%g,%g]", x(), y()); }
bool is_null() const { return !m_x && !m_y; }