1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

LibWeb: Extract CanvasPath class from CRC2D

This better matches the spec, and makes it possible for things like
Path2D to reuse the same implementation without duplicate code. :^)
This commit is contained in:
Sam Atkins 2022-08-11 16:10:04 +01:00 committed by Andreas Kling
parent 8fd83b56d5
commit a37ab7b9f8
7 changed files with 184 additions and 132 deletions

View file

@ -3,7 +3,10 @@
#import <HTML/ImageData.idl>
#import <HTML/TextMetrics.idl>
#import <HTML/CanvasGradient.idl>
#import <HTML/Canvas/CanvasPath.idl>
// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d
[Exposed=Window]
interface CanvasRenderingContext2D {
undefined fillRect(double x, double y, double w, double h);
@ -15,17 +18,8 @@ interface CanvasRenderingContext2D {
undefined rotate(double radians);
undefined beginPath();
undefined closePath();
undefined fill(optional DOMString fillRule = "nonzero");
undefined stroke();
undefined moveTo(double x, double y);
undefined lineTo(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 ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean counterclockwise = false);
undefined rect(double x, double y, double width, double height);
undefined fillText(DOMString text, double x, double y, optional double maxWidth);
undefined strokeText(DOMString text, double x, double y, optional double maxWidth);
@ -65,3 +59,5 @@ interface CanvasRenderingContext2D {
undefined clip();
};
CanvasRenderingContext2D includes CanvasPath;