createPattern example
function boot() {
draw(document.getElementById('canvas').getContext('2d'));
draw(document.getElementById('vmlcanvas').getContext('2d'));
}
function draw(ctx) {
// create new image object to use as pattern
var img = new Image();
img.onload = function(){
// create pattern
var ptrn = ctx.createPattern(img,'repeat');
ctx.fillStyle = ptrn;
ctx.fillRect(0,0,150,150);
}
img.src = 'images/wallpaper.png?' + new Date().getTime();
}