Jump to: navigation, search

Canvas SVG Parser

20 bytes added, 19:16, 10 April 2015
layout; moving up a suitable first section
{{Infobox subsystem
|name = Scripted SVG parser for Canvas
{{Template:Canvas Navigation}}
=== Vector Image Support ===
The '''scripted SVG parser ''' basically just maps the SVG xml structure to the property tree. It is implemented in Nasal on top of the XML parsing facilities already provided by FlightGear.  == Vector Image Support ==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. For SVG, already existing tools (Inkscape) can be used to create images and then just load them via Nasal and add some dynamic features to them.
If you find some SVG feature not working, please check the console for errors - our SVG parser is hand-written and only supports a limited subset of SVG instructions, so may need to be extended, or simply use supported inkscape primitives instead (see svg.nas). $FG_ROOT/Nasal/canvas/svg.nas is our existing example on populating a canvas procedurally by parsing an XML file.

Navigation menu