Jump to: navigation, search

Canvas SVG Parser

1,968 bytes added, 21:50, 30 July 2012
Basic example
{{Template:Canvas Navigation}}
=== Background: Vector Image Support (Status 07/2012:SVG parser implemented and available) ===
'''TheTom''': I already have some experimental code for an old version of the canvas. But basically it is just mapping the xml structure to the property tree. I though have no plans to support the full SVG standard, but only a subset. Maybe we should implement this in Nasal so its easier to add suport for new SVG features if someone needs it. As there is already support for parsing xml in Nasal parsing SVG should be pretty straight forward. Just a boring programming exercise :-) But using separate canvas elements instead of a single image will always be slower as every little piece of the canvas hat to be triangulated and afterwards rendered every time the canvas gets updated instead of just copying an image. On the other hand you if you use the canvas you can dynamically update the contents of the image and also get (theoretically) unlimited resolution, even changeable at runtime.
'''TheTom''': Currently I use [ svgconv] for converting SVG files to OpenVG compatible path syntax.
Regarding SVG, the advantage would be that people could use existing tools (GIMP, Inkscape) to create their images and then just "load" them via Nasal and add some dynamic features to them. Specifying all these things in Nasal would be very tedious, and this is something that most of us coders are really not too good at (i.e. artwork).
This is not to say that all of SVG would need to be supported, but there's already code in OSG to support such image formats - and if we could find a way to leverage native OSG code to handle such things, we would gain lots of flexibility: We have LOTS of users here who are really good at using tools like GIMP or Inkscape, so if they have a way to reuse such artwork, it would be great.
Integration-wise, there are some lessons to be learnt from the way SMIL works via SVG and ECMAScript (JavaScript).
== Basic example ==

Navigation menu