mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:07:35 +00:00
Base: Add a little test web page for canvas drawImage() :^)
This commit is contained in:
parent
067ea5a2e0
commit
aab022b77b
2 changed files with 29 additions and 0 deletions
28
Base/home/anon/www/img-canvas.html
Normal file
28
Base/home/anon/www/img-canvas.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>canvas drawImage() test</title>
|
||||
<style>
|
||||
canvas {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
img = document.querySelectorAll("img")[0];
|
||||
|
||||
img.addEventListener("load", function() {
|
||||
var ctx = document.querySelectorAll("canvas")[0].getContext("2d");
|
||||
ctx.fillStyle = '#666';
|
||||
ctx.fillRect(0, 0, 400, 400);
|
||||
ctx.scale(2, 2);
|
||||
ctx.drawImage(img, 30, 30);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas width=400 height=400></canvas>
|
||||
<img src="../../../res/icons/buggie.png">
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue