views:

118

answers:

3

I am trying to draw a thick line using c++, and add a border to this line from all side. I am using moveto, lineto functions, but not sure how to track the line width to draw borders. this is require for generic line.

A: 

The easiest way is to use an existing library to do this. The most popular libraries for C and C++ development are OpenGL, DirectX, SDL, and ALLEGRO. I'd recommend any of them other than DirectX for the purpose of keeping your code portable.

Hope this helps, good luck!

Rob S.
thx all for the comment, i am sorry i missed adding details for the question!! I am using c++ and it should cover all horizontal, vertical and diagonal lines. Seems the question was closed i will open new question with more details.
ken
@Ken: No, don't do this. put the missing info into __this__ question.
sbi
@Rob S.: i am using win32 api only.
ken
+1  A: 

You may have to use MoveTo and LineTo functions. As you didn't describe much about your need, not sure what exactly you want.

bjskishore123
A: 

If you only have MoveTo and LineTo, a simple way to draw what you describe is to draw a thick line from point A to point B, then a slightly narrower line from A to B again. It will look like the second line has a border around it in the colour of the first line.

Douglas
this good suggestion, but sometimes i need to draw the thick street then draw a one pixel width border to give some effect like antilias
ken