mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +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:
parent
4d20cf57db
commit
f54b41f748
5 changed files with 274 additions and 8 deletions
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue