Board index FlightGear Development Canvas

Drawing a circle

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Drawing a circle

Postby Thorsten » Sun Mar 20, 2016 7:04 am

Given that the <circle> SVG structure isn't parsed for some reason, is there a more elegant way to get a circle on screen than to define its segments as paths or is that how it's supposed to be done?
Posts: 12017
Joined: Mon Nov 02, 2009 8:33 am

Re: Drawing a circle

Postby Necolatis » Sun Mar 20, 2016 7:16 am

I always use segments, if there is another way, I don't know about it.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Posts: 2115
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Drawing a circle

Postby Hooray » Sun Mar 20, 2016 1:48 pm

path drawing is the correct method, for the supported commands, refer to $FG_ROOT/Nasal/canvas/api.nas and the segments listed in the canvas.Path hash (OpenVG should support arc/circle paths, not sure if those are currently made available or not)

For reference, you can look up the corresponding ShivaVG/OpenVG examples on the web, all primitives listed in api.nas should also be supported by the Canvas/ShivaVG implementation.

BTW: Once you know how to draw a circle using OpenVG paths, you can also extend svg.nas to parse the <circle> tag you mentioned.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Posts: 12190
Joined: Tue Mar 25, 2008 8:40 am

Return to Canvas

Who is online

Users browsing this forum: No registered users and 2 guests