1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 06:25:06 +00:00

LibWeb: Add a few extra spec links to CanvasGradient

This commit is contained in:
MacDue 2023-01-28 00:10:54 +00:00 committed by Linus Groh
parent f86b66dc2d
commit afb84df290

View file

@ -25,12 +25,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> CanvasGradient::create_rad
return realm.heap().allocate<CanvasGradient>(realm, realm, *radial_gradient);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createlineargradient
JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_linear(JS::Realm& realm, double x0, double y0, double x1, double y1)
{
auto linear_gradient = Gfx::CanvasLinearGradientPaintStyle::create(Gfx::FloatPoint { x0, y0 }, Gfx::FloatPoint { x1, y1 });
return realm.heap().allocate<CanvasGradient>(realm, realm, *linear_gradient);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createconicgradient
JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_conic(JS::Realm& realm, double start_angle, double x, double y)
{
auto conic_gradient = Gfx::CanvasConicGradientPaintStyle::create(Gfx::FloatPoint { x, y }, start_angle);