Styles for _stroke
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Styles for _stroke
In canvas_add Is it possible to have different styles of strokes.
_stroke(color, style,stroke_width)
Stiles could be...
single : for a single line
double : for a double line
dot: for a dotted line "..........................................
double dot: for a double dotted line" ::::::::::::::::::::::::::::::::::::::
dash: for a dashed line" -------------------------------------------------
double dash: for a doubled dashed line" ==================================
dot dash: for a dot dashed line" .._._._._._._._._._._._
Keith
_stroke(color, style,stroke_width)
Stiles could be...
single : for a single line
double : for a double line
dot: for a dotted line "..........................................
double dot: for a double dotted line" ::::::::::::::::::::::::::::::::::::::
dash: for a dashed line" -------------------------------------------------
double dash: for a doubled dashed line" ==================================
dot dash: for a dot dashed line" .._._._._._._._._._._._
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: Styles for _stroke
Keith,
If you just wanted a generic line of a certain type then that would be a nice solution. However if you want to match a dashed line exactly to a real world unit then you would probably have do it in code to get the exact lengths and spacing correct.
I remember writing a function that takes length and space arguments and draws a dashed line for you. I'll have to dig it out. It may even be in the canvas video tutorial but I'm not certain because I did that a while ago now.
Derk posted about this a while back and we helped him get a dashed line for canvas working for his ND. Search the forum if that's of any interest.
Tony
If you just wanted a generic line of a certain type then that would be a nice solution. However if you want to match a dashed line exactly to a real world unit then you would probably have do it in code to get the exact lengths and spacing correct.
I remember writing a function that takes length and space arguments and draws a dashed line for you. I'll have to dig it out. It may even be in the canvas video tutorial but I'm not certain because I did that a while ago now.
Derk posted about this a while back and we helped him get a dashed line for canvas working for his ND. Search the forum if that's of any interest.
Tony
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Styles for _stroke
Hi,
We could probably come up with some sort of library that creates all the individual _stroke functions.
I could embed that into AM lua folder, so it will be available for all instruments.
Corjan
We could probably come up with some sort of library that creates all the individual _stroke functions.
I could embed that into AM lua folder, so it will be available for all instruments.
Corjan
Re: Styles for _stroke
Hi Keith,
Maybe you can use it to.
Some standard stroke functions would be fine as Corjan suggested.
After all one can adapt and alter those functions for personal usage.
In my ND I also use dashed and dotted circles and lines, which has to be different for each range/zoom level.
Have fun
Derk
This is from Corjan:Derk posted about this a while back and we helped him get a dashed line for canvas working for his ND
Code: Select all
fix_radial = canvas_add(0,0,900,900)
canvas_draw(fix_radial, function()
local dash_len = 20
local line_len = 300
a = 100
while (a + dash_len <= line_len) do
_move_to(a + 5, 300)
_line_to(a + 15, 300)
_stroke("lime",3)
a = a + dash_len
end
end)
Some standard stroke functions would be fine as Corjan suggested.
After all one can adapt and alter those functions for personal usage.
In my ND I also use dashed and dotted circles and lines, which has to be different for each range/zoom level.
Have fun
Derk
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Styles for _stroke
Thank you Derk.jedeen wrote: ↑Sun Nov 11, 2018 11:10 am Hi Keith,
This is from Corjan:Derk posted about this a while back and we helped him get a dashed line for canvas working for his NDMaybe you can use it to.Code: Select all
fix_radial = canvas_add(0,0,900,900) canvas_draw(fix_radial, function() local dash_len = 20 local line_len = 300 a = 100 while (a + dash_len <= line_len) do _move_to(a + 5, 300) _line_to(a + 15, 300) _stroke("lime",3) a = a + dash_len end end)
Some standard stroke functions would be fine as Corjan suggested.
After all one can adapt and alter those functions for personal usage.
In my ND I also use dashed and dotted circles and lines, which has to be different for each range/zoom level.
Have fun
Derk
If Corjan can come up with a library it would be great.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Styles for _stroke
Corjan,
Just a reminder when you find some time in the next beta Please. I am redoing my fences and menus using canvas_draw and line styles would be great.
Thank you
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: Styles for _stroke
+ 1 for that. It would be a nice addition to have a few different styles. customizable would be even better.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
-
- Posts: 5336
- Joined: Thu Jul 27, 2017 12:22 am
Re: Styles for _stroke
If able, it would be cool to get additional custom end of line like arrow, point aso ...
Gilles
Gilles
Re: Styles for _stroke
Added to the TODO list. Dashed lines are a good idea, I'm not sure yet about adding arrows though.
Corjan
Corjan
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Styles for _stroke
Thank you Corjan.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card