How to draw ugly lines really fast
added on 2022/12/19 @ 12:15:06 | 1379 views| category: gamedev

Every now and then (don't ask) I have to yet again write a subpixel-accurate but NOT antialiased line drawer. In many ways AA lines are much simpler - because every pixel is a different shade, you can't really do anything much cleverer than simple Bresenham and use the distance as an AA coverage/shade index (which is then called Wu's Algorithm: But today let's talk about non-AA lines - ones where the pixel is either set to the colour, or not.

The other thing I need to do is subpixel-correct lines, because they're so much more nicer in motion than non-subpixel-correct lines. Don't confuse this with AA lines - you can have chunky non-AA single-colour pixel lines that are ALSO subpixel-correct.

Why this is important is hard to convery in a static picture, but in motion the quality difference is very obvious. And it turns out the speed difference is not actually significant, so why not go for the extra quality?