Styles for _stroke

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Message
Author
User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Styles for _stroke

#1 Post by Keith Baxter »

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" .._._._._._._._._._._._





lines.png
:mrgreen: :mrgreen: :mrgreen:


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 

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Styles for _stroke

#2 Post by Sling »

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

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Styles for _stroke

#3 Post by Corjan »

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

jedeen
Posts: 527
Joined: Fri Jan 13, 2017 5:41 pm

Re: Styles for _stroke

#4 Post by jedeen »

Hi Keith,
Derk posted about this a while back and we helped him get a dashed line for canvas working for his ND
This is from Corjan:

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)
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

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Styles for _stroke

#5 Post by Keith Baxter »

jedeen wrote: Sun Nov 11, 2018 11:10 am Hi Keith,
Derk posted about this a while back and we helped him get a dashed line for canvas working for his ND
This is from Corjan:

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)
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
Thank you 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 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Styles for _stroke

#6 Post by Keith Baxter »

Corjan wrote: Sun Nov 11, 2018 9:40 am 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
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 

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Styles for _stroke

#7 Post by Sling »

+ 1 for that. It would be a nice addition to have a few different styles. customizable would be even better.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Styles for _stroke

#8 Post by SimPassion »

If able, it would be cool to get additional custom end of line like arrow, point aso ...

Gilles

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Styles for _stroke

#9 Post by Corjan »

Added to the TODO list. Dashed lines are a good idea, I'm not sure yet about adding arrows though.

Corjan

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Styles for _stroke

#10 Post by Keith Baxter »

Corjan wrote: Sun Feb 24, 2019 3:28 pm Added to the TODO list. Dashed lines are a good idea, I'm not sure yet about adding arrows though.

Corjan
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 

Post Reply