Hello,
Can we have an option or fix to be able to draw straight lines as intended to be.
The current issues I see are...
- roundings due to anti aliasing
- alpha changes due to anti aliasing causing color changes on overlapping
- a 1 pixel line is always 2 pixels due to the anti aliasing
- you need to make your canvas 2 pixels bigger in width in height or you'll get thinner lines at the edges due to the 2 pixel lining (that why you get these 1+ in the code lines below)
anti aliasing should not be active for rectangle and straight non-angled lines.
code used for this is:
Can we have an option or fix to be able to draw straight lines as intended to be.
The current issues I see are...
- roundings due to anti aliasing
- alpha changes due to anti aliasing causing color changes on overlapping
- a 1 pixel line is always 2 pixels due to the anti aliasing
- you need to make your canvas 2 pixels bigger in width in height or you'll get thinner lines at the edges due to the 2 pixel lining (that why you get these 1+ in the code lines below)
anti aliasing should not be active for rectangle and straight non-angled lines.
code used for this is:
B4X:
Dim c As B4XCanvas
Dim p As Pane=xui.CreatePanel("grid")
spRoot.AddView(p,0,0,gridSize*cellsize+2,gridSize*cellsize+2)
c.Initialize(p)
For x=0 To gridSize-1
c.Drawline(1+x*cellsize,1,1+x*cellsize,1+gridSize*cellsize,col,1)
Next
For y=0 To gridSize-1
c.Drawline(1,1+y*cellsize,1+gridSize*cellsize,1+y*cellsize,col,1)
Next
Dim r As B4XRect
r.Initialize(1,1,gridSize*cellsize+1,gridSize*cellsize+1)
c.DrawRect(r,col,False,1)
Last edited: