C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-11-2006, 02:44 AM   #1
Registered User
 
Join Date: Jan 2006
Posts: 14
Draw dot by dot?

Hi folks,

I'm trying to implement Brasenham's algorithm, I need to draw a line on a given coordinates (x1,y1,x2,y2). The problem is that when I try to do this in C# (GDI+) I have this function drawLine, but this draws the line itself.

I need to construct the line myself, point by point (pixel by pixel), can anyone show me on how to draw only one pixel at the time, not connect two point. I will need to draw the line recursively, one pixel at the time so in the end I end up with the complete line.

advice is welcomed in any language C#, Java, C++ ?

Thanx in prior
fiska is offline   Reply With Quote
Old 10-11-2006, 05:51 AM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
There are a huge number of sites which detail the algorithm - just read a few of them.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 10-11-2006, 06:13 AM   #3
Registered User
 
Join Date: Jan 2006
Posts: 14
I know the algorithms perfectly well, I just have problems implementing it.
I dont know how to draw a single point so then I can then construct the whole line dot by dot, it is perfectly well described in my thread above.

Quote:
can anyone show me on how to draw only one pixel at the time
I did not ask about algorithms itself, it is rather a simple question.

Last edited by fiska; 10-11-2006 at 06:39 AM.
fiska is offline   Reply With Quote
Old 10-11-2006, 09:38 AM   #4
and the Hat of Clumsiness
 
GanglyLamb's Avatar
 
Join Date: Oct 2002
Posts: 1,101
Since this is obviously for learning purposes only , why not just use DrawRectangle ( or something like that ) with a width and height of 1 pixel.

I know it's not the best solution , but I've looked at msdn Graphics documentation at a glance and didn't see any method to just draw a pixel.

C#, Java, C++
>>
Java: http://forums.java.net/jive/thread.j...ssageID=111831

Using the windows GDI: http://www.toymaker.info/Games/html/gdi.html

Last edited by GanglyLamb; 10-11-2006 at 09:43 AM.
GanglyLamb is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which is the better way to draw? g4j31a5 Game Programming 16 01-22-2007 11:56 PM
need help making a dot bounce up and down y axis in this prog redwing26 Game Programming 10 08-05-2006 12:48 PM
draw function HELP!!! sunoflight77 C++ Programming 1 05-10-2005 11:28 PM
Simple program i cant get (dot moving) Lupusk9 C++ Programming 4 09-14-2004 08:04 PM
ray casting lambs4 Game Programming 62 01-09-2003 06:57 PM


All times are GMT -6. The time now is 02:17 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22