DrawLine without antialiasing HTML5

Javi400

New member
Joined
Jan 21, 2023
Messages
14
Is it possible to draw a line without antialiasing using the mojo module? I want to make a grid with one-pixel lines, but when I draw a line it occupies 2 pixels and is transparent (filtered).
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
737
Did you use #MOJO_IMAGE_FILTERING_ENABLED=False ? This should work on all targets except html5 in the current version. I did a fix for it but it hasn't been released yet.
Here is the related forum thread.
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
737
You can try the fix by replacing the file mentioned in the link above. It would be great if you could verify that it is working and it is what you were asking for.
 

Javi400

New member
Joined
Jan 21, 2023
Messages
14
Ops, it doesn't seem to work...

1678253085109.png


1678253440408.png
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
737
Thanks for testing! I will have a look this evening or by tomorrow at the latest.
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
737
There is a short hand solution. You could use DrawRect() with a hight/width of 1 instead of DrawLine(). I think I read something about a general Issue with drawing lines in the browser where you have to fiddle with exact floating point position values to get crisp lines and adding to that the thickness of a line is not working with scaling but with rectangles it is.
 
Top Bottom