dimanche 1 février 2015

canvas.drawImage behaves differently if the source is an image or if it is a offscreen context


I am blitting an image to a context using several drawimage to get a non-linear interpolation on y axis. Here is a very simplified version of my code.



var destY = 0;
for (i=0; i<16; i++)
{
context.drawImage(pictureToBlit,
0, i, 16, 1,
0,destY,512,i*3);
destY+=i*3;
}


This code produces the expected bilinear interpolation looking on all browsers when pictureToBlit is an image coming from the DOM.


See this jsfiddle


But when pictureToBlit is an offscreen context (a CanvasRenderingContext2D) then the result becomes different on latest version of Chrome 40.0.2214.94 m :


See the same jsfiddle and replace if (true) by if (false)


Why is the image drawing behaving differently when source is an image or a offscreen canvas containing the same image?





Aucun commentaire:

Enregistrer un commentaire