mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
LibWeb: Add CanvasRenderingContext2D.bezierCurveTo()
This commit is contained in:
parent
34f6c88ffd
commit
90a8744823
3 changed files with 9 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -189,6 +189,11 @@ void CanvasRenderingContext2D::quadratic_curve_to(float cx, float cy, float x, f
|
||||||
m_path.quadratic_bezier_curve_to({ cx, cy }, { x, y });
|
m_path.quadratic_bezier_curve_to({ cx, cy }, { x, y });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CanvasRenderingContext2D::bezier_curve_to(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)
|
||||||
|
{
|
||||||
|
m_path.cubic_bezier_curve_to(Gfx::FloatPoint(cp1x, cp1y), Gfx::FloatPoint(cp2x, cp2y), Gfx::FloatPoint(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
DOM::ExceptionOr<void> CanvasRenderingContext2D::arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise)
|
DOM::ExceptionOr<void> CanvasRenderingContext2D::arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise)
|
||||||
{
|
{
|
||||||
if (radius < 0)
|
if (radius < 0)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -56,6 +56,7 @@ public:
|
||||||
void move_to(float x, float y);
|
void move_to(float x, float y);
|
||||||
void line_to(float x, float y);
|
void line_to(float x, float y);
|
||||||
void quadratic_curve_to(float cx, float cy, float x, float y);
|
void quadratic_curve_to(float cx, float cy, float x, float y);
|
||||||
|
void bezier_curve_to(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
|
||||||
|
|
||||||
DOM::ExceptionOr<void> arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise);
|
DOM::ExceptionOr<void> arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise);
|
||||||
DOM::ExceptionOr<void> ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise);
|
DOM::ExceptionOr<void> ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise);
|
||||||
|
|
|
@ -15,6 +15,7 @@ interface CanvasRenderingContext2D {
|
||||||
undefined moveTo(double x, double y);
|
undefined moveTo(double x, double y);
|
||||||
undefined lineTo(double x, double y);
|
undefined lineTo(double x, double y);
|
||||||
undefined quadraticCurveTo(double cpx, double cpy, double x, double y);
|
undefined quadraticCurveTo(double cpx, double cpy, double x, double y);
|
||||||
|
undefined bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
|
||||||
|
|
||||||
undefined arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean counterclockwise = false);
|
undefined arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean counterclockwise = false);
|
||||||
undefined ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean counterclockwise = false);
|
undefined ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean counterclockwise = false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue