I have to draw multiple images on one canvas. I make a program that works, though, I have to speed up the display. I see images appear one by one:
var ctx = document.getElementById('images_tiles').getContext('2d');
function handler() {
var i = this.i;
ctx.drawImage(this.img_src, this.r * tileSize, this.c*tileSize, tileSize * tileList[i].qw, tileSize * tileList[i].qh);
}
//Draw tiles in spiral
for (i=0; i<tileList.length; i++)
{
var o = { img_src: new Image, c: tileList[i].y, r: tileList[i].x, i: i };
o.img_src.onload = handler.bind(o);
o.img_src.src = './viewer/images/'+path+'/LOD'+glod+'/tiles_'+ o.c + '_' + o.r +'.jpeg';
}
I see Webworker can make parallelization but not for display. So do you have a solution or/and a trick.