I'm following the canvas tutorial on w3schools and I've just discovered that there is a canvas function for drawing images.
This is the example that I was looking at:
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var img = document.getElementById("scream");
ctx.drawImage(img, 10, 10);
};
Well ... sience I've always used the <img>
tag for showing an image in my page I asked myself what was the difference between this two ways of showing images.
Any idea ?