<canvas id="canvas" width="180" height="130"></canvas>
<canvas id="canvas2" width="200" height="200"></canvas>
<canvas id="vmlcanvas" class="vml" width="180" height="130"></canvas>
<canvas id="vmlcanvas2" class="vml" width="200" height="200"></canvas>
function boot() {
draw(document.getElementById('canvas').getContext('2d'),
document.getElementById('canvas2').getContext('2d'));
draw(document.getElementById('vmlcanvas').getContext('2d'),
document.getElementById('vmlcanvas2').getContext('2d'));
}
function draw(ctx, ctx2) {
var img = new Image();
img.onload = function(){
ctx.translate(-10, 5);
ctx.scale(1.2, 0.8);
ctx.rotate(5 * Math.PI / 180);
ctx.drawImage(img,0,0);
ctx.beginPath();
ctx.moveTo(30,96);
ctx.lineTo(70,66);
ctx.lineTo(103,76);
ctx.lineTo(170,15);
ctx.stroke();
ctx2.globalAlpha = 0.5;
ctx2.shadowColor = "red";
ctx2.shadowBlur = 3;
ctx2.fillStyle = "green";
ctx2.fillRect(0, 0, ctx2.canvas.width, ctx2.canvas.height);
ctx2.drawImage(ctx.canvas, 10, 10);
ctx2.drawImage(ctx.canvas, 30, 30, 100, 130);
ctx2.drawImage(ctx.canvas, 10, 10, 40, 40, 60, 100, 80, 80);
}
img.src = 'images/backdrop.png?' + new Date().getTime();
}
Source image