When I zoom in on your test image (same method as used above, ie no fancing smoothing) I see antialiasing of what are supposed to be 1-pixel lines:
Is it possible that something in between your screen capture and the forum post has smudged the image?
Snagit smudges screen captures? I wouldn't have thought you'd put up with that for very long.
Then again, I use PicPick, which does captures perfectly, but I have to use a different program (ThumbsPlus) to do the scaling without any "enhancement".
I did actually check later, because Prixel sounded like a plausible word. Like, it could have been a term for pixels aligned to the coordinate system rather than to the display raster grid.
I corrected it now in post #19 to avoid any confusion.
I have the French orthography correction activated in Firefox and when I write any English texts there are lots of words underlined in red.
Now I found that other languages can be added, so I added English.
For now the best option is to use these simple methods for drawing thin lines:
B4X:
Sub DrawHorizontalLine(bc As BitmapCreator, x1 As Int, y As Int, x2 As Int, clr As Int)
If y < 0 Or y >= bc.mHeight Then Return
Dim argb As ARGBColor
bc.ColorToARGB(clr, argb)
For x = Max(0, Min(x1, x2)) To Min(Max(x1, x2), bc.mWidth - 1)
bc.SetARGB(x, y, argb)
Next
End Sub
Sub DrawVerticalLine(bc As BitmapCreator, x As Int, y1 As Int, y2 As Int, clr As Int)
If x < 0 Or x >= bc.mWidth Then Return
Dim argb As ARGBColor
bc.ColorToARGB(clr, argb)
For y = Max(0, Min(y1, y2)) To Min(Max(y1, y2), bc.mHeight - 1)
bc.SetARGB(x, y, argb)
Next
End Sub
We have the options of both ways already, so personally I think the existing anti-aliased routines should continue working the way that they do, rather than veer off for special cases - that's just going to invite a new round of why doesn't this draw the way I think it should questions, but from the other direction.
For most drawing tasks, where the resolution nowadays means that we can think at a level of shapes rather than pixels, it is better that X and Y are continuous coordinates rather than discrete pixel column/row numbers.
The only part of that concept that I was iffy about is the way that Rect borders fall half-a-StrokeWidth outside of the Rect coordinates (and thus often half outside of the drawable/visible area). I rationalised that iffiness away by considering the extreme case case of what should happen if the Rect had Width and/or Height < StrokeWidth.
Small optimization. The int color is converted to an ARGB color and then to a premultiplied color. Calling SetARGB saves one of the conversions.
Note that the built-in BitmapCreator methods are more sophisticated and are faster (horizontal lines are drawn as single array copy calls) however in the case of single pixel lines these methods should be fast enough.