Small Feature Errors

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: russ, Ralph

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

Re: Small Feature Errors

#11 Post by Keith Baxter »

Hi,

Sparky.
Are you telling us all that this code you posted in post #1 is now fixed by changing the graphics options in settings? I think that is an oversight on your part.

Code: Select all

PaneCanvas = canvas_add(0, 0, 200, 100)
BoxCanvas = canvas_add(15, 15, 150, 40)
--
	canvas_draw(PaneCanvas, function() 
		_rect(1, 1, 198, 98)
		_stroke("#FFD700", 2)
--
		_move_to(25, 60)
		_line_to(150, 60)
		_stroke("#FFD700", 1)
--
		_move_to(100, 50)
		_line_to(100, 90)
		_stroke("#FF0084", 1)
--
	end)
--
	canvas_draw(BoxCanvas, function()
		_rect(2, 2, 148, 23)
		_stroke("#008000", 1)
--
		_move_to(10, 10)
		_line_to(125, 10)
		_stroke("#9932CC", 1)
--
	end)
--
I suggest that you recheck your fixed code and compare to the code you first posted. It is impossible to have fixed the green box right side line stroke thickness. Reason being is that some of the green ("#008000") box draw parameters are outside of the canvas (BoxCanvas) parameters.

I press this point so that others should not get the impression, playing with the graphics settings will fix draws that fall outside the canvas parameters.

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
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Small Feature Errors

#12 Post by jph »

Keith Baxter wrote: Sun Jan 15, 2023 4:03 pm Hi,

Sparky.
Are you telling us all that this code you posted in post #1 is now fixed by changing the graphics options in settings? I think that is an oversight on your part.

Code: Select all

PaneCanvas = canvas_add(0, 0, 200, 100)
BoxCanvas = canvas_add(15, 15, 150, 40)
--
	canvas_draw(PaneCanvas, function() 
		_rect(1, 1, 198, 98)
		_stroke("#FFD700", 2)
--
		_move_to(25, 60)
		_line_to(150, 60)
		_stroke("#FFD700", 1)
--
		_move_to(100, 50)
		_line_to(100, 90)
		_stroke("#FF0084", 1)
--
	end)
--
	canvas_draw(BoxCanvas, function()
		_rect(2, 2, 148, 23)
		_stroke("#008000", 1)
--
		_move_to(10, 10)
		_line_to(125, 10)
		_stroke("#9932CC", 1)
--
	end)
--
I suggest that you recheck your fixed code and compare to the code you first posted. It is impossible to have fixed the green box right side line stroke thickness. Reason being is that some of the green ("#008000") box draw parameters are outside of the canvas (BoxCanvas) parameters.

I press this point so that others should not get the impression, playing with the graphics settings will fix draws that fall outside the canvas parameters.

Keith
I am not sure where you are confused here Keith. But you cannot have 'half a pixel' or '0.5 pixel' is a physical item. It all depends on the DPI.
with a higher dpi you CAN have anti aliasing which uses the dpi intensity to give the impression. But not physically possibly to have a half (0.5) of a physical pixel.
Have a look at DPI and the way LCD screens work.
Joe
Joe. CISSP, MSc.

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

Re: Small Feature Errors

#13 Post by Keith Baxter »

@jph

I am definitely not confused. Run this code which has a _stroke() of 0.5 pixels.
You will note that the Left, Top,and Bottom lines have a line_width of 0.5. The right line_width is 0.25 because half of the 0.5 line_width is outside of the canvas width parameter of 150.

So nothing to do with DPI or anything else. Simply that the OP original post talked of the right side of the green rectangle being half the size of the other three and that is because the _rect() width is to wide or the canvas width is to small.

Code: Select all

BoxCanvas = canvas_add(15, 15, 150, 40)
	canvas_draw(BoxCanvas, function()
		_rect(2, 2, 148, 23)
		_stroke("#008000", 0.5)
	end)
Lets take a look at two identical vertical strokes of 6 pixels. The center line is 6 pixels wide and the right line is 3 pixels. Reason is because the half the 6 pixels are outside the canvas parameter of 150

Code: Select all

Box2Canvas = canvas_add(15, 165, 150, 40)
	canvas_draw(Box2Canvas, function()
                _move_to(150,0)
                _line_to(150,40)
		_stroke("#008000", 6)
		
                _move_to(75,0)
                _line_to(75,40)
		_stroke("#008000", 6)				
	end)

Keith

EDIT: It might be that the API wording should be different. Because you can definitely draw a line 0.5 line_width.
ice_screenshot_20230116-123032.png
Last edited by Keith Baxter on Mon Jan 16, 2023 10:52 am, 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 

User avatar
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Small Feature Errors

#14 Post by jph »

No worries Keith keep on believing. pixels are NOT lines
Joe
Joe. CISSP, MSc.

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

Re: Small Feature Errors

#15 Post by Keith Baxter »

jph wrote: Mon Jan 16, 2023 10:51 am No worries Keith keep on believing. pixels are NOT lines
Joe
Joe.
This is drawn with canvas_draw() and line widths are from top down ( 0.1 , 0.25, 0.5, 0.75, 1, 1.5, 2, 8)
No matter how wide the line widths are the right side will ALWAYS be half because it falls outside the canvas width parameter.
ice_screenshot_20230116-130302.png
ice_screenshot_20230116-130302.png (10.73 KiB) Viewed 693 times
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
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Small Feature Errors

#16 Post by jph »

Hi Keith, nice,
Now research 'pixel' (not line width) -
Joe
Joe. CISSP, MSc.

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

Re: Small Feature Errors

#17 Post by Keith Baxter »

jph wrote: Mon Jan 16, 2023 11:14 am Hi Keith, nice,
Now research 'pixel'
Joe
I know exactly what a pixel is. No need to research.

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
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Small Feature Errors

#18 Post by jph »

Keith Baxter wrote: Mon Jan 16, 2023 11:17 am
jph wrote: Mon Jan 16, 2023 11:14 am Hi Keith, nice,
Now research 'pixel'
Joe
I know exactly what a pixel is. No need to research.

Keith
so, fine, what is 'half a pixel' ?
Joe. CISSP, MSc.

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

Re: Small Feature Errors

#19 Post by Keith Baxter »

jph wrote: Mon Jan 16, 2023 11:18 am
Keith Baxter wrote: Mon Jan 16, 2023 11:17 am
jph wrote: Mon Jan 16, 2023 11:14 am Hi Keith, nice,
Now research 'pixel'
Joe
I know exactly what a pixel is. No need to research.

Keith
so, fine, what is 'half a pixel' ?
Re-Read post #13. You might have missed my edit as you were posting as I was adding the edit.
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
Corjan
Posts: 2939
Joined: Thu Nov 19, 2015 9:04 am

Re: Small Feature Errors

#20 Post by Corjan »

Hi,


Like Keith said, the fact that the right side of the rect isn't shown is completely logical because it is out of the canvas area.

When it comes to coordinations, things become messy.

Drawing a line from x=0,y=0 to x=0,y=100 doesn't necessarily mean that it will fill up the first row of pixels exactly.

You are asking it to draw a line of which center is exactly on the edge of the instrument (x=0), right between two pixels.
The anti aliasing code will try to center it anyways be interpolating with its neighboring pixels. That is why you get two pixels being drawn, and flushed out a bit.


Corjan

Post Reply