It's easier than I thought:
var canvasElement = cc.$("canvas");
var image = new Image();
image.src = canvasElement.toDataURL("image/png");
Note that the conversion proccess (the
toDataURL) takes a little while, so you should implement some sort of waiting dialog and a callback for when it's finished. You can test that this works easily by "opening" the generated image in the browser like this:
Does anyone know if there's a better way for getting the canvas element?