What the Heck?
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: What the Heck?
Hi,
All is working as expected.
Check your canvas and draw parameters. Remember that the _stroke() is <CENTER ALIGNED>. So a _rect(100, 100) with a stroke 6 would be (106,106). If that is on a 100,100 canvas, 6 pix would be lost.
You moved the green _rect() that has a stroke of 1 pix, 1 pix to the right. You should only have moved it 0.5 pix to the right.
With regards to color use hex codes from here to get a desired color
https://www.colorhexa.com/c81f1f
Keith
All is working as expected.
Check your canvas and draw parameters. Remember that the _stroke() is <CENTER ALIGNED>. So a _rect(100, 100) with a stroke 6 would be (106,106). If that is on a 100,100 canvas, 6 pix would be lost.
You moved the green _rect() that has a stroke of 1 pix, 1 pix to the right. You should only have moved it 0.5 pix to the right.
With regards to color use hex codes from here to get a desired color
https://www.colorhexa.com/c81f1f
Keith
Last edited by Keith Baxter on Fri Jan 13, 2023 8:00 pm, edited 1 time in total.
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
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: What the Heck?
Hi Sparky, the lines are too thin, this is what is producing washed colors on white
for other parts Keith already answered
Try this :
for other parts Keith already answered
Try this :
Code: Select all
PaneCanvas = canvas_add(0, 0, 200, 200)
IALDCanvas = canvas_add(50, 50, 100, 100)
--
canvas_draw(PaneCanvas, function()
_rect(1, 1, 198, 198)
_stroke("red", 2)
end)
--
canvas_draw(IALDCanvas, function()
_rect(1, 1, 99, 99)
_fill("green")
_stroke("green", 1)
--
_move_to(10, 10)
_line_to(25, 10)
_stroke("blue", 5)
end)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: What the Heck?
Gilles,SimPassion wrote: ↑Fri Jan 13, 2023 7:59 pm Hi Sparky, the lines are too thin, this is what is producing washed colors on white
for other parts Keith already answered
Try this :
Code: Select all
PaneCanvas = canvas_add(0, 0, 200, 200) IALDCanvas = canvas_add(50, 50, 100, 100) -- canvas_draw(PaneCanvas, function() _rect(1, 1, 198, 198) _stroke("red", 2) end) -- canvas_draw(IALDCanvas, function() _rect(1, 1, 99, 99) _fill("green") _stroke("green", 1) -- _move_to(10, 10) _line_to(25, 10) _stroke("blue", 5) end)
Should be
Code: Select all
PaneCanvas = canvas_add(0, 0, 200, 200)
IALDCanvas = canvas_add(50, 50, 100, 100)
--
canvas_draw(PaneCanvas, function()
_rect(1, 1, 198, 198)
_stroke("red", 2)
end)
--
canvas_draw(IALDCanvas, function()
_rect(0.5, 0.5, 99, 99)
_stroke("green", 1)
--
_move_to(10, 10)
_line_to(25, 10)
_stroke("blue", 5)
end)
Code: Select all
PaneCanvas = canvas_add(0, 0, 200, 200)
IALDCanvas = canvas_add(0, 0, 200, 200)
--
canvas_draw(PaneCanvas, function()
_rect(1,1, 198, 198)
_stroke("red", 2)
end)
--
canvas_draw(IALDCanvas, function()
_rect(51,51, 98, 98)
_stroke("green", 1)
--
_move_to(10, 10)
_line_to(25, 10)
_stroke("blue", 5)
end)
Keith
Last edited by Keith Baxter on Fri Jan 13, 2023 8:34 pm, edited 1 time in total.
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
-
- Posts: 204
- Joined: Sat Jul 09, 2022 3:20 pm
Re: What the Heck?
Hi, guys:
But I know how to position lines; the resultant color is NOT what I put in the lua statement, and I asked for a 1 pixel line. My problem is if I need a line 1 pixel wide, I need a line 1 pixel wide. And if I need it to be a certain colour, it should be that colour. It's not doing that.
I guess I need to record it as a bug because it's not doing what the spec says it should be doing.
Thanks for trying though, and I mean that!
Sparky
But I know how to position lines; the resultant color is NOT what I put in the lua statement, and I asked for a 1 pixel line. My problem is if I need a line 1 pixel wide, I need a line 1 pixel wide. And if I need it to be a certain colour, it should be that colour. It's not doing that.
I guess I need to record it as a bug because it's not doing what the spec says it should be doing.
Thanks for trying though, and I mean that!
Sparky
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: What the Heck?
Sparky it is working perfect. There is nothing wrong.The Artful Dodger wrote: ↑Fri Jan 13, 2023 8:33 pm Hi, guys:
But I know how to position lines; the resultant color is NOT what I put in the lua statement, and I asked for a 1 pixel line. My problem is if I need a line 1 pixel wide, I need a line 1 pixel wide. And if I need it to be a certain colour, it should be that colour. It's not doing that.
I guess I need to record it as a bug because it's not doing what the spec says it should be doing.
Thanks for trying though, and I mean that!
Sparky
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
-
- Posts: 204
- Joined: Sat Jul 09, 2022 3:20 pm
Re: What the Heck?
Keith, I appreciate your help but if I have these Lua statements:
I expect to get a horizontal line, in the color selected, that is exactly 1 pixel wide; otherwise there is something wrong! I got a horizontal line but it was 2 pixels wide, and a washed-out color. I see no other explanation. And, you can't draw anything if the instructions do something other than what they are supposed to do. At least I can't!
That's what I've relied on ever since you urged me to use the canvas, a decision I have been very happy with.
Code: Select all
_move_to(10, 10)
_line_to(20, 10)
_stroke(color, 1)
That's what I've relied on ever since you urged me to use the canvas, a decision I have been very happy with.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: What the Heck?
Sparky you get exactly the color and Px with.The Artful Dodger wrote: ↑Fri Jan 13, 2023 10:21 pm Keith, I appreciate your help but if I have these Lua statements:I expect to get a horizontal line, in the color selected, that is exactly 1 pixel wide; otherwise there is something wrong! I got a horizontal line but it was 2 pixels wide, and a washed-out color. I see no other explanation. And, you can't draw anything if the instructions do something other than what they are supposed to do. At least I can't!Code: Select all
_move_to(10, 10) _line_to(20, 10) _stroke(color, 1)
That's what I've relied on ever since you urged me to use the canvas, a decision I have been very happy with.
You must rem that the background gives perception of the line color change.
Play around with this .
Code: Select all
PaneCanvas = canvas_add(0, 0, 300, 300)
IALDCanvas = canvas_add(0, 0, 300, 300)
--
canvas_draw(PaneCanvas, function()
_rect(0,0, 300, 100)
_fill("black")
_rect(0,100, 300, 100)
_fill("pink")
_rect(0,200, 300, 100)
_fill("yellow")
end)
--
canvas_draw(IALDCanvas, function()
_move_to(10, 10)
_line_to(50, 10)
_stroke("blue",1)
_move_to(10, 110)
_line_to(50, 110)
_stroke("blue",1)
_move_to(10, 210)
_line_to(50, 210)
_stroke("blue",1)
_move_to(10, 30)
_line_to(50, 30)
_stroke("blue",2)
_move_to(10, 130)
_line_to(50, 130)
_stroke("blue",2)
_move_to(10, 230)
_line_to(50, 230)
_stroke("blue",2)
--Lets give the same strokes a different color
_move_to(110, 10)
_line_to(150, 10)
_stroke("#000062",1)
_move_to(110, 110)
_line_to(150, 110)
_stroke("#000062",1)
_move_to(110, 210)
_line_to(150, 210)
_stroke("#000062",1)
_move_to(110, 30)
_line_to(150, 30)
_stroke("#000062",2)
_move_to(110, 130)
_line_to(150, 130)
_stroke("#000062",2)
_move_to(110, 230)
_line_to(150, 230)
_stroke("#000062",2)
--Lets give the same strokes a different color
_move_to(210, 10)
_line_to(250, 10)
_stroke("#6262ff",1)
_move_to(210, 110)
_line_to(250, 110)
_stroke("#6262ff",1)
_move_to(210, 210)
_line_to(250, 210)
_stroke("#6262ff",1)
_move_to(210, 30)
_line_to(250, 30)
_stroke("#6262ff",2)
_move_to(210, 130)
_line_to(250, 130)
_stroke("#6262ff",2)
_move_to(210, 230)
_line_to(250, 230)
_stroke("#6262ff",2)
end)
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
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: What the Heck?
Hi Keith, sure right, you've already read the script I posted wasn't meant to correct other things than the color issue, outside the color issue, you've already handled the explanation and correction which was complementary to what I posted. No intend to publish a whole correction in any case. Good spot for other parts Keith !Keith Baxter wrote: ↑Fri Jan 13, 2023 8:23 pmGilles,SimPassion wrote: ↑Fri Jan 13, 2023 7:59 pm Hi Sparky, the lines are too thin, this is what is producing washed colors on white
for other parts Keith already answered
Try this :
Code: Select all
PaneCanvas = canvas_add(0, 0, 200, 200) IALDCanvas = canvas_add(50, 50, 100, 100) -- canvas_draw(PaneCanvas, function() _rect(1, 1, 198, 198) _stroke("red", 2) end) -- canvas_draw(IALDCanvas, function() _rect(1, 1, 99, 99) _fill("green") _stroke("green", 1) -- _move_to(10, 10) _line_to(25, 10) _stroke("blue", 5) end)
Should be
orCode: Select all
PaneCanvas = canvas_add(0, 0, 200, 200) IALDCanvas = canvas_add(50, 50, 100, 100) -- canvas_draw(PaneCanvas, function() _rect(1, 1, 198, 198) _stroke("red", 2) end) -- canvas_draw(IALDCanvas, function() _rect(0.5, 0.5, 99, 99) _stroke("green", 1) -- _move_to(10, 10) _line_to(25, 10) _stroke("blue", 5) end)
The second option will give you a 0.5 Px space all around. The first option will fill the canvas.Code: Select all
PaneCanvas = canvas_add(0, 0, 200, 200) IALDCanvas = canvas_add(0, 0, 200, 200) -- canvas_draw(PaneCanvas, function() _rect(1,1, 198, 198) _stroke("red", 2) end) -- canvas_draw(IALDCanvas, function() _rect(51,51, 98, 98) _stroke("green", 1) -- _move_to(10, 10) _line_to(25, 10) _stroke("blue", 5) end)
Keith
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: What the Heck?
Hi,
Running the above code produces this strange color affect.
Keith
Running the above code produces this strange color affect.
Keith
Last edited by Keith Baxter on Fri Jan 13, 2023 11:27 pm, edited 1 time in total.
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
-
- Posts: 204
- Joined: Sat Jul 09, 2022 3:20 pm
Re: What the Heck?
Keith: This is new - I have been using lines 1 pixel wide for months! The lines haven't changed the color nor have they changed the width. They are all over my HUD and I need them for the MCP as well.
I didn't see that you had referred it to Corjan! Thanks.
I didn't see that you had referred it to Corjan! Thanks.
Last edited by The Artful Dodger on Fri Jan 13, 2023 11:26 pm, edited 1 time in total.