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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.