getImageData is very bad for performance. I do not have a png or jpg file. So I make an image while my program is loading. I am developing an Application using the iPhone retina display. And I need your help with this :(
I need to make an Image at run time, in which I can re-use with a variable of some sort.
On the retina display, using a cache canvas will make the image either too pixelated or too large. Unless you know how to fix?
var x = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); //width of screen
var y = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); // height of screen
if (x === 414 && y === 736) {
imgData = ctx.getImageData(0,0,3*x,3*365*Yf);
} else {
imgData = ctx.getImageData(0,0,2*x,2*365*Yf);
}
ctx.clearRect(0, 0, x, 365 * Yf); // size of Image, retina display quality
ctx.putImageData(imgData, 0, 0);