Bresenham line algorithm (thickness)

Jon Trausti Arason picture Jon Trausti Arason · Sep 15, 2009 · Viewed 9.5k times · Source

I was wondering if anyone knew of any algorithm to draw a line with specific thickness, based on Bresenham's line algorithm or any similar.

On a second thought, I've been wondering about for each setPixel(x,y) I'd just draw a circle, e.g.:

filledCircle(x,y,thickness); for every x,y but that would of course be very slow. I also tried to use dictionary but that would fill the memory in no time. Check the pixels I'm about to draw on if they have the same color, but that's also not efficient enough for large brushes.

Perhaps I could somehow draw half circles depending on the angle?

Any input would be appreciated.

Thanks.

duplicate: how do I create a line of arbitrary thickness using Bresenham?

Answer

alex picture alex · Sep 15, 2009

You cannot actually draw circles along the line. This approach is patented. :) You can still read patent for inspiration.