Masking an image to the canvas
HTML
<canvas id="tutorial" width="200" height="158"></canvas>
CSS
body {
background: #CEF;
}
JavaScript
var canvas = document.getElementById('tutorial');
var ctx = canvas.getContext('2d');
var img = new Image();
img.onload = function() {
ctx.beginPath();
ctx.arc(80, 80, 100, 0, Math.PI * 2 , false);
ctx.clip();
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, img.width, img.height);
}
img.src = 'http://javascript.ru/cat/list/donkey.gif';