blob: a21add25ac4cb812c9dc8eb9e6106c18b11c1abb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<!DOCTYPE html>
<html>
<head>
<title>canvas drawImage() test</title>
<style>
canvas {
border: 1px solid black;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
img = document.querySelector("img");
img.addEventListener("load", function() {
var ctx = document.querySelector("canvas").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>
|