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

LibWeb: Implement the CanvasRenderingContext2D::rect path method

This method adds a rectangle to the current 2D path.
This commit is contained in:
Idan Horowitz 2021-04-14 23:29:14 +03:00 committed by Andreas Kling
parent 4c0937225e
commit aab99d5945
5 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>canvas path - rect example</title>
</head>
<body>
<canvas width=500 height=500></canvas>
<script>
function drawRect() {
var canvas = document.querySelector("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, 500, 500);
ctx.fillStyle = 'red';
ctx.beginPath();
ctx.rect(10, 20, 150, 100);
ctx.fill();
ctx.fillStyle = 'green';
ctx.beginPath();
ctx.rect(200, 210, 100, 100);
ctx.fill('evenodd');
}
drawRect();
</script>
</body>
</html>

View file

@ -70,6 +70,7 @@ span#loadtime {
<li><a href="percent-css.html">CSS percentage values</a></li>
<li><a href="inline-block.html">display: inline-block; test</a></li>
<li><a href="canvas-path-quadratic-curve.html">canvas path quadratic curve test</a></li>
<li><a href="canvas-path-rect.html">canvas path rect test</a></li>
<li><a href="pngsuite_siz_png.html">pngsuite odd sizes test</a></li>
<li><a href="pngsuite_bas_png.html">pngsuite basic formats test</a></li>
<li><a href="pngsuite_int_png.html">pngsuite interlacing test</a></li>