forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Implement the CanvasRenderingContext2D::rect path method
This method adds a rectangle to the current 2D path.
- Loading branch information
1 parent
4c09372
commit aab99d5
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters