Line width algorithm - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Line width algorithm

I'm making a simple old-fashioned pixmap editor for the UNIX environment, but I'm having problems trying to implementate a DrawLine(X1, Y1, X2, Y2, LineWidth) Function using several line thicknesses, Does anyone of ya have an algorithm for such thing? I'll appreciate any help


Comments

  • Here's a recommendation, and a relatively simple one. Construct a routine DrawLine that does a single pixel width (Bresnham's algorithm work's dandily, and is pretty standard), and then define DrawLineWidth to call DrawLine several times, on alternating sides of the initial line, moving the starting and ending points in the perpendicular direction to the drawn line. This would give 'square edges', more or less, and should be computable entirely in integers.


    it's just a guess, though.


    : I'm making a simple old-fashioned pixmap editor for the UNIX environment, but I'm having problems trying to implementate a DrawLine(X1, Y1, X2, Y2, LineWidth) Function using several line thicknesses, Does anyone of ya have an algorithm for such thing? I'll appreciate any help





Sign In or Register to comment.