SVG

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

SVG files are XML This is a link to a Wikipedia article files containing vector graphics This is a link to a Wikipedia article. SVG files are typically created and edited using a vector graphics editor like Inkscape This is a link to a Wikipedia article (free). In addition to Inkscape, there are many other vector graphics editors, e.g. see Comparison of vector graphics editors This is a link to a Wikipedia article.

Liveries

Some people also use Inkscape for creating SVG based liveries and recommend a SVG tool like Inkscape for liveries, rather than a bitmap tool like Gimp. Both have layers, but Inkscape makes it easier to scale, copy and adjust elements of the paintwork. The main benefit of editing SVG is the "S", which stands for scalable: It's easy to adjust sies without losing quality. To make the livery, you export an image file and save your SVG separately. So the SVG file is your "source" and the image is built from it. As such, you can keep the SVG where you like and export the image direct into the aircraft folder (having created the XML file to go with it).[1]


  1. sanhozay (Mar 11th, 2015). Re: inherit existing craft for new livery?.

Avionics (MFDs)

Note  you can have SVG/XML files validated online, which only takes a second: https://validator.w3.org/#validate_by_input

In FlightGear, SVG files are typically used for creating MFDs commonly found on modern airliners/biz jet (or spacecraft like the shuttle). So, gauges will typically be SVG files (created via Inkscape) and animated via Nasal timers/listeners. In addition, SVG images can be used to create GUI widgets.

However, SVG files are not directly supported by FlightGear.

Instead, there is a dedicated Nasal module (svg.nas) for converting SVG/XML markup into OpenVG paths using the FlightGear Canvas system. This parser only supports a tiny subset of SVG/XML, so that SVG images created by Inkscape will often need to be simplified before being usable in FlightGear, or saved as plain SVG.

Note that complex SVG images may be created more easily in a procedural way, e.g. using Inkscape scripting (via Python), but also by using Nasal to create OpenVG paths directly via Canvas.Path. Sometimes, it may make sense to treat the SVG image as a container with embedded sections that may contain procedurally created Canvas paths in addition to the statically-defined elements added by Inkscape.

<svg xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect id="myrect" x="10" y="10" height="130" width="500" style="fill: #000000"/>
</svg>