ios - Draw image on canvas with the Retina display -


it web app in phonegap have used 320 480 image draw fuzzy.

html

<canvas id="canvas" height=480 width=320> browser not support html5 canvas tag.</canvas> 

javascript

var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); ctx.drawimage(images[index],0,0,320,480); 

how draw on retina display?

if have access larger versions of images, can double visible resolution.

the source images need 640x960:

this code "pixel double" resolution of image.

canvas.width = 640; canvas.height = 960; canvas.style.width = "320px"; canvas.style.height = "480px"; 

if not, use same "pixel doubling" effect , present smaller clearer version using existing images:

canvas.width = 320; canvas.height = 480; canvas.style.width = "160px"; canvas.style.height = "240px"; 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -