HTML5 Canvas ability to zoom in/out after drawing images?

canvas, html, javascript, jquery, zooming

Solution

So this is what you are thinking of: `scale()`.

ctx.save();
ctx.scale(2,2);    //zoom-in
doMyComplexShape();
ctx.restore();

Problem

My app is based on users placing images on a canvas (via functions I created that use lineTo(), and arc() to create complicated shapes) and then letting them zoom out so get a higher-level picture of what they've done. Similarly they can load somebody else's creation and zoom-in to see at a lower level what all these objects looks like in more detail. Is this possible? When I think zoom, I'm thinking google-maps type zoom. If it's not possible, are there other solutions, like using regular images and re-sizing part of the page? Thank you for any help.

Original source