I'm revising a web application (
http://simile-widgets.org/exhibit) to generate relatively complex marker icons using canvas. In particular, I need to be able to specify an image (via a url), but also to crop that image to a shape that I draw. For reasons detailed below, it would be very useful if I could specify those markers to gmaps by passing the canvas itself instead of passing a (data) url.
Since gmaps requires marker icons to be specified as urls, I'm using the canvas.toDataURL method to create one. This has always seemed rather hacky, since gmaps turns around and paints that dataurl onto its canvas. But now I've run into a more serious flaw. Some of my markers embed images drawn from other sites (I draw those images onto my canvas). Such cross-site image rendering is permitted. But, the canvas to which the image is rendered becomes "tainted"---out of fear that I could improperly access images from another site, I am no longer permitted to look at the canvas. In particular, it becomes forbidden to generate a data url from the canvas. So I can't hand it off to gmaps. If I could pass the canvas instead, gmaps could render it for me---it wouldn't matter that the map itself becomes tainted.
alternatively, I could also accomplish this if it were possible to give gmaps _both_ a marker shape _and_ and image url, with the understanding that the image should be painted into the marker shape.
Given that direct handoff of a canvas is more natural than the transform to/from a data url, I hope such a feature might be considered.