Canvas snippets: Difference between revisions

Jump to navigation Jump to search
m
http://wiki.flightgear.org/Canvas_MapStructure#The_SymbolCache
m (→‎Adding OpenVG Paths: http://forum.flightgear.org/viewtopic.php?f=4&t=25747&p=238677&hilit=curves#p238677)
m (http://wiki.flightgear.org/Canvas_MapStructure#The_SymbolCache)
Line 221: Line 221:
|-
|-
|}
|}
== Using the SymbolCache ==
Whenever a symbol may need to be instanced multiple times, it makes sense to use caching - otherwise, identical symbols would be treated as separate OpenVG groups, all of which would need to be rasterized/rendedered separately. Typically, a map may display multiple instances of an otherwise identical symbol (think VOR, NDB, DME etc) - equally, a multiplayer map may showing multiple aircraft symbols at the same time. In these cases, it makes sense to use the SymbolCache framework, which will render symbols into a separate Canvas texture and provide a texture map that can be treated as a lookup map, which even supports styling for otherwise identical symbols. To learn more, please refer to [[Canvas MapStructure#The_SymbolCache|SymbolCache]]
...
{| class="wikitable"
|-
! Screenshot !! Code
|-
| [[File:Canvas-svg-support.png|thumb|screen shot demonstrating how the scripted Nasal-based SVG parser can be used to dynamically turn SVG files into OpenVG instructions understood by Canvas]]
| {{Caution|This is currently untested code}}
<syntaxhighlight lang="nasal" enclose="div">
# ...
</syntaxhighlight>
|-
|}


== Adding Text Elements ==
== Adding Text Elements ==
Line 346: Line 362:
== Adding a 2D Panel ==
== Adding a 2D Panel ==
== Adding a PFD ==
== Adding a PFD ==
== Using the SymbolCache ==


== Adding a Failure Mgmt Widget ==
== Adding a Failure Mgmt Widget ==

Navigation menu