Thick Line Algorithm
-
Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.
-
Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.
-
Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.
Some years ago (nearly ten) I adopted Xiaolin Wu's line algorithm for that. It's an antialiasing algorithm, but with little changes you can use it. You can even do it on your own. When you draw, you got a virtual direction corresponding to an angle. You can turn 90° and paint the neighbor points.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
You did read, that he has to build it on his own with setpixel? So the problem is he can't draw a rectangle.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.
Sounds like a school assignment to me... Its been a few years (20+) since I had to do this, but I seem to remember the best way to acheive this was to use the standard Bresenham algorithm, but to just set more than one pixel at each point. Basically for a three pixel wide line, set the 8 pixels around each point as well as the point itself... Some optimisation is possible.
-
Hi all. I need to draw a thick line with SetPixel API. I search very, but can't find any open source algorithm (Bresenham algorithm is one pixel, murphy algorithm is for line with more than 3 pixel thick, ... ). If you can please help me. Notice that I can not use CPen and other facilities in windows. I should use SetPixel. Excuse me for bad English. Thanks.