summaryrefslogtreecommitdiff
path: root/Base/res
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-04-14 23:29:14 +0300
committerAndreas Kling <kling@serenityos.org>2021-04-14 23:01:23 +0200
commitaab99d594504208c0a04261838551eacd0098c8a (patch)
treedb63bfe62228191529e47f1a15d32345678ac83b /Base/res
parent4c0937225ea064e528ac4a4d140c4b75cdbf51b1 (diff)
downloadserenity-aab99d594504208c0a04261838551eacd0098c8a.zip
LibWeb: Implement the CanvasRenderingContext2D::rect path method
This method adds a rectangle to the current 2D path.
Diffstat (limited to 'Base/res')
-rw-r--r--Base/res/html/misc/canvas-path-rect.html31
-rw-r--r--Base/res/html/misc/welcome.html1
2 files changed, 32 insertions, 0 deletions
diff --git a/Base/res/html/misc/canvas-path-rect.html b/Base/res/html/misc/canvas-path-rect.html
new file mode 100644
index 0000000000..a132e52c0c
--- /dev/null
+++ b/Base/res/html/misc/canvas-path-rect.html
@@ -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>
diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html
index e54552d00b..65b4dbfc08 100644
--- a/Base/res/html/misc/welcome.html
+++ b/Base/res/html/misc/welcome.html
@@ -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>