146
rated 0 times
[
150]
[
4]
/ answers: 1 / hits: 58888
/ 11 Years ago, sat, february 22, 2014, 12:00:00
I'm drawing images on a canvas like this:
ctx.drawImage(data[i].image, data[i].pos.x, data[i].pos.y, data[i].pos.w, data[i].pos.h);
The picture is getting stretched and I don't want this. How can I simulate the CSS property?
background-size: cover
when drawing images on the canvas?
http://www.w3schools.com/cssref/playit.asp?filename=playcss_background-size&preval=cover
see the difference between 100% 100%
(what I currently have) and cover
(my goal).
More From » css