DmitryBaranovskiy / raphael

JavaScript Vector Library
https://dmitrybaranovskiy.github.io/raphael/
MIT License
11.27k stars 1.67k forks source link

[Feature request] Import SVG file #285

Open caminante opened 13 years ago

caminante commented 13 years ago

Hi, it would be great if Raphael could import SVG files. It would make me use it for my projects designed in SVG format. Something like:

var paper = Raphael(0, 0, 760, 600);
paper.importSVG('file.svg');

That would be really nice. The conversion tools I've tried didn't worked ok. Thanks.

petermlm commented 11 years ago

There might be a problem with an import. Assume that you have an SVG file. You can make a script that translates the SVG code to the Javascript code that would generate the same image using Raphaël. I've done that once using Python. Anyway, the problem is that Raphaël doesn't have groups, the equivalent to the tag in SVG. It does have Sets, but that is a different concept. And I think transformations are applied differently, but I am not sure about that.

mhemesath commented 11 years ago

Yeah, when I built R2D3, groups and transforms were a challenging problem to solve. There are other tags that are missing as well: