Re: [AD] clipping line algorithm

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


> 	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.

This is interesting. Could you benchmark it against the existing line() 
function?

> 	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?

_putpixel() is a very limited version of putpixel() (see the docs for the 
limitation). If your version is intended to replace the current line() 
function, it must obey the same rules, i.e call bmp->vtable->putpixel in 
order to be used with all types of bitmaps. Note that you should then 
disable the clipping before calling do_line, like the current line() 
function.

-- 
Eric Botcazou




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