Canvas properties: Difference between revisions

Jump to navigation Jump to search
Some more Canvas & GUI informations
(→‎Gallery: Canvas GUI demo)
(Some more Canvas & GUI informations)
Line 4: Line 4:
Proposal for a property-driven 2D drawing API for [[FlightGear]].
Proposal for a property-driven 2D drawing API for [[FlightGear]].


== Status 06/2012 ==
== Status 07/2012 ==


* FlightGear core: A basic canvas for drawing texts and paths (polygons and curves) has been merged. (see  merge requests [https://gitorious.org/fg/flightgear/merge_requests/26 26] and [https://gitorious.org/fg/flightgear/merge_requests/30 30])
* FlightGear core
* Nasal API: The API is not included in the main fgdata repository but available for testing in [https://gitorious.org/fg/fgdata/merge_requests/150 fgdata/merge request 150: Basic Nasal API and demonstration]
** A basic canvas for drawing texts and paths (polygons and curves) has been merged. (see  merge requests [https://gitorious.org/fg/flightgear/merge_requests/26 26] and [https://gitorious.org/fg/flightgear/merge_requests/30 30])
** In my branch (https://gitorious.org/~tomprogs/fg/toms-flightgear/commits/canvas) there is now also support for placing a Canvas onto a GUI widget.
* Nasal API
** The API is not included in the main fgdata repository but available for testing in [https://gitorious.org/fg/fgdata/merge_requests/150 fgdata/merge request 150: Basic Nasal API and demonstration]
** An updated API and an example dialog (Debug > Canvas Demo) demonstrating the use of the Canvas for GUI widgets is included in my fgdata branch (https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas)


Tom is currently working on a 2D drawing API. The basic idea is to draw arbitrary 2D shapes and text to a texture and place this texture on some model in the scene (eg. display, HUD,...). This so called canvas should be controlled only by using the property tree.
Tom is currently working on a 2D drawing API. The basic idea is to draw arbitrary 2D shapes and text to a texture and place this texture on some model in the scene (eg. display, HUD,...). This so called canvas should be controlled only by using the property tree.
Line 90: Line 94:
=== Vector Images ===
=== Vector Images ===
'''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''': 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 [http://svgconv.sourceforge.net/ svgconv] for converting SVG files to OpenVG compatible path syntax.


=== Feature Requests & Feedback ===
=== Feature Requests & Feedback ===
Line 108: Line 114:
In my branch there is now also support for using the canvas in a gui widget:
In my branch there is now also support for using the canvas in a gui widget:


[[File:Canvas GUI Demo.png|thumb|left|400px|Using the Canvas as a GUI widget]]
[[File:Canvas GUI Demo.png|thumb|none|400px|Using the Canvas as a GUI widget]]
 


== Development Discussions ==
== Development Discussions ==
166

edits

Navigation menu