noob question: an easy way to resize canvas while scaling everything inside?
i'm continuing to learn HTML5, and it seems to me i don't really get the logic of it so far.
let's say, we have a canvas element which is 800*600. i put an image into it (document.getElementById(canvas_ID).getContext("2d").drawImage(img, 0, 0, imgWidth, imgHeight);) and then do something to it (basic things like invert and so on).
Then i want to resize it to, say, 400*300 and i want the nice picture i have to scale accordingly.
If i just go document.getElementById(canvas_ID).width = newWidth;
document.getElementById(canvas_ID).height = newHeight;
i am left with blank canvas.
i apologize in advance if there is just a simple canvas method for that, but i... kinda... tried to google it already...
Bookmarks