On my canvas I have an object that is partly outside of the canvas, and I think it looks great, but as soon as I run toDataURL() on the canvas in order to export it as a PNG it includes the entire object in the resulting image. I am wondering if there is a way to "cut off" all objects that are outside or partly outside of the canvas.
This is what I see on the canvas, I have taken the moon and put it on the upper left corner, only 1/4 of the original object is visible.
And this is what I get out when I run toDataURL(), the whole moon object is visible here (ignore the wooden frame)