1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibGfx: Add Painter::draw_quadratic_bezier_curve()

Also adds a QuadraticBezierCurveTo mode to Gfx::Path
This commit is contained in:
AnotherTest 2020-05-05 05:45:17 +04:30 committed by Andreas Kling
parent 73a7a589c2
commit 9f3f98d4c0
5 changed files with 75 additions and 2 deletions

View file

@ -39,13 +39,15 @@ public:
Invalid,
MoveTo,
LineTo,
QuadraticBezierCurveTo,
};
Type type { Type::Invalid };
FloatPoint point;
Optional<FloatPoint> through {};
};
Path() {}
Path() { }
void move_to(const FloatPoint& point)
{
@ -57,6 +59,11 @@ public:
m_segments.append({ Segment::Type::LineTo, point });
}
void quadratic_bezier_curve_to(const FloatPoint& through, const FloatPoint& point)
{
m_segments.append({ Segment::Type::QuadraticBezierCurveTo, point, through });
}
void close();
const Vector<Segment>& segments() const { return m_segments; }