[html5] Exporting a large Canvas to SVG

Shaun Morris shaunwithanau at gmail.com
Mon Mar 8 12:02:32 PST 2010


Currently I am drawing a very large picture to the canvas (think an entire
building measured in inches) which is composed of numerous lines (approx
20000). Obviously this picture is having to be scaled down considerably to
fit on a canvas. However the user has the option to zoom in on this picture.
What this in turn does is set a scaling factor to the canvas causing parts
of the drawing to be outside of the canvas's dimensions.

What I want to do is use SVG (which can be much larger but cannot be used to
draw the picture as it consists of too many lines) to replicate what is
being drawn to the canvas (including the parts that spill over). This is
because I can place the large SVG inside of a limited sized <div> and the
user will be able to use the scroll bars to see the entire building.

The idea is that I let canvas handle the data and scaling. Then once I have
it the size that I want,  then display it in SVG.

My question is will this work with toDataURL? I am guessing that it wont, as
it will just send what is actually visible on the canvas to the SVG.

Is there any other way to do this or something similar?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/help-whatwg.org/attachments/20100308/3e746f0b/attachment-0002.htm>


More information about the Help mailing list