Are there any "standard" algorithms for drawing thick antialiased lines? I have found Xiaolin Wu's algorithm for drawing 1px width lines, but have yet to find any extension for thicker lines.
Line drawing algorithms such as Bresenham's or Wu's are preferred instead.
Thick primitives are defined by OpenGL and other graphics interface specifications as primitives that are greater than 1 pixel in thickness. A thick line, accordingly, is a represented as a composite of two or more parallel and adjacent single pixel lines.
An inneficient, crude, quick way would be to draw the lines larger (say, 4x) and then scaling them down using weight averaging. Details here:
Algorithms for downscaling bitmapped fonts
Look at the accepted answer.
If your lines will always be straight and you aren't looking to anti-alias curves, you can do a three-pass approach.
I'm not sure how efficient this would be in your environment, but you can draw the aliased version of the line with thickness - 2
and then use Xiaolin Wu's approach twice to anti-alias the edges. @Francisco P.'s approach would work, too, and might actually be preferable.
One way or another, the aliasing needs to be smoothed out along the outer edges. If you're dealing with lines of thickness greater than one, you can achieve this by just drawing the two edges anti-aliased and then filling in the middle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With