Question

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

How can I use Bresenham algorithm to draw lines of more than a pixel thick? Do i have to run the algorithm many times with an offset from x and y?

Was it helpful?

Solution

One thing you can do is to calculate using the slope of the line, a unit offset in both orthogonal directions. Multiply this by your thickness, and take the offsets at both endpoints. You now have effectively the bounds of a rotated rectangle. Then, rather than using Bresenham to draw the line, use a fast polygon fill.

OTHER TIPS

No, the simple way is just plot a stencil at every (x, y) location produced by the algorithm that is larger than one pixel, e.g. a disc.

But that's of course inefficient in the sense that you plot the same pixel many times. It's however easy to implement and works robustly with even odd-shaped or multicolored stencils.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top