Fixed masking issue in CanvasRenderer.

Also added an optional feature for spritesheets, to be able to render
them to a canvas and discard the loaded image if desired.