1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

LibWeb: Add canvas.fill

This implements only one of the two forms of this function,
ctx.fill(winding_rule).
Also tweaks the quadratic curve demo to have a nice looking filled
shape.
This commit is contained in:
AnotherTest 2020-05-06 11:56:47 +04:30 committed by Andreas Kling
parent f54b41f748
commit a82419469f
5 changed files with 52 additions and 0 deletions

View file

@ -33,6 +33,18 @@ canvas.addEventListener("mousemove", function(e) {
ctx.moveTo(0, 0);
ctx.quadraticCurveTo(e.offsetX, e.offsetY, x, y);
ctx.stroke();
ctx.moveTo(30, 90);
ctx.lineTo(110, 20);
ctx.lineTo(240, 130);
ctx.lineTo(60, 130);
ctx.lineTo(190, 20);
ctx.lineTo(270, 90);
ctx.closePath();
// Fill path
ctx.fillStyle = 'green';
ctx.fill('evenodd');
});
}