252
edits
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{tip|The basic canvas.draw library was merged into FGDATA in 03/2020 so it available by default now. }} | |||
{{tip| | |||
{{Canvas Navigation}} | {{Canvas Navigation}} | ||
= | = Introduction = | ||
There are basically two ways to populate a canvas, loading an SVG file which | There are basically two ways to populate a canvas, loading an SVG file which | ||
has been created with some tool like inkscape, or by writing a nasal program | has been created with some tool like inkscape, or by writing a nasal program | ||
Line 17: | Line 9: | ||
Both ways are valid and have their pros and cons. | Both ways are valid and have their pros and cons. | ||
The canvas API | The canvas API was quite limited, only a few basic commands were available, so canvas.draw library was created | ||
commands | to provide more drawing commands. | ||
{{Note|Development of this library started in 12/2018 as a separate [[Addons|CanvasDrawDev add-on]] and is largely based on GPL'ed [[How to manipulate Canvas elements|plot2D code]] written originally by {{Usr|Rodolfo}} | |||
(rleibner on the forums) as part of the [[Spoken GCA]], [[PAR instrument]] and [[Oscilloscope addon|Oscilloscope]] add-ons.}} | |||
== Goals == | == Goals == | ||
Line 25: | Line 19: | ||
* Provide complex drawing commands needed for e.g. compass rose or speed tapes | * Provide complex drawing commands needed for e.g. compass rose or speed tapes | ||
* Provide easy to use styles | * Provide easy to use styles | ||
= canvas.draw API = | = canvas.draw API = | ||
== draw module == | == draw module == | ||
All draw methods expect a canvas group element 'cgroup' as first parameter to draw on. | {{note|All draw methods expect a canvas group element 'cgroup' as first parameter to draw on.}} | ||
=== draw.colors === | === draw.colors === | ||
Line 282: | Line 273: | ||
Set length of subdivision marker in %marker_length | Set length of subdivision marker in %marker_length | ||
= | = References = | ||
[[CompassRose]] | [[CompassRose]] is based on canvas draw. | ||
{{Note|You can test, improve and play around with canvas.draw by downloading the [[Addons|CanvasDrawDev add-on]]. }} |
edits