mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibWeb: Implement the CanvasRenderingContext2D::rect path method
This method adds a rectangle to the current 2D path.
This commit is contained in:
parent
4c0937225e
commit
aab99d5945
5 changed files with 46 additions and 0 deletions
|
@ -188,6 +188,17 @@ void CanvasRenderingContext2D::quadratic_curve_to(float cx, float cy, float x, f
|
|||
m_path.quadratic_bezier_curve_to({ cx, cy }, { x, y });
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::rect(float x, float y, float width, float height)
|
||||
{
|
||||
m_path.move_to({ x, y });
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
m_path.line_to({ x + width, y });
|
||||
m_path.line_to({ x + width, y + height });
|
||||
m_path.line_to({ x, y + height });
|
||||
m_path.close();
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::stroke()
|
||||
{
|
||||
auto painter = this->painter();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue