[AD] clipping line algorithm

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


hello,
	I have written a line clipping algorithm for use with Allegro. The current line function does not clip the line segment to the constraints of the current cliping rectangle, but simply clips to see if it should be drawn at all. This is merely an implementation of Cohen-Sutherland line clipping. 

	I pass _putpixel to do_line to finally draw the line becuase the line is gauranteed to be inside the bitmap. Someone on #allegro mentioned that this is not the fastest putpixel, but direct memory access does not work on all bitmap types. Is this true? Or should _putpixel be the best method for fast pixel plotting?

Attachment: clipline.c.gz
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/