mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
28 lines
763 B
HTML
28 lines
763 B
HTML
<!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/graphics/buggie.png">
|
|
</body>
|
|
</html>
|