mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibGfx: Add Path::[horizontal,vertical]_path_to()
The SVG spec describes some path operations using these, so we might as well have them. :^)
This commit is contained in:
parent
9424c67ed5
commit
aa2f20fb60
1 changed files with 16 additions and 0 deletions
|
@ -150,6 +150,22 @@ public:
|
|||
invalidate_split_lines();
|
||||
}
|
||||
|
||||
void horizontal_line_to(float x)
|
||||
{
|
||||
float previous_y = 0;
|
||||
if (!m_segments.is_empty())
|
||||
previous_y = m_segments.last().point().y();
|
||||
line_to({ x, previous_y });
|
||||
}
|
||||
|
||||
void vertical_line_to(float y)
|
||||
{
|
||||
float previous_x = 0;
|
||||
if (!m_segments.is_empty())
|
||||
previous_x = m_segments.last().point().x();
|
||||
line_to({ previous_x, y });
|
||||
}
|
||||
|
||||
void quadratic_bezier_curve_to(const FloatPoint& through, const FloatPoint& point)
|
||||
{
|
||||
append_segment<QuadraticBezierCurveSegment>(point, through);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue