[comp.graphics] Anti-aliased line drawing

gg10@prism.gatech.EDU (Gregory L. Galloway) (02/06/90)

Does anyone have any code or ideas on an anti-aliased line drawing
routine?

Foley & Van Dam, and others, mention treating the line as an area
region.  I was hoping for a simplier, more efficient algorithm which
would extend Bresenham's.  I was thinking that you could treat the
image buffer as an array of 16 bit ints (short on most machines) and
use this as a 4x4 pixel mask.  Bresenham's algorithm would be modified
to draw a line from (x1*4,y1*4) to (x2*4,y2*4). Every time a setpixel
is needed, the (x,y) coord would be converted to (x/4,y/4) and (x mod 4,
y mod 4).  The mod values would be used to index a lookup table with
the correct pixel mask (to be ANDed) to the short at (x/4,y/4). Now
somehow, we must render more than just this single line, so something
based on the slope of the line is needed to know how many pixels on
either side in x or y are needed to widen the line.  Then we set these
pixels all at the same time.

Can anybody help me with the details, or care to get together and work
through this?

Thanks in advance,

Greg

Greg Galloway               *  UUCP: ...!gatech!prism!gg10
Georgia Inst of Technology  *  INet: gg10@prism.gatech.edu
GTRI/EML/EOD Baker Rm 323I  *  Work: (404)894-3357
Atlanta, Georgia  30332     *  "Is it REAL or is it RenderMan?" 

spencer@eecs.umich.edu (Spencer W. Thomas) (02/06/90)

Check out

S. Gupta and R.F. Sproull, "Filtering edges for gray-scale displays",
Computer Graphics, Vol. 15, No. 3 (August 1981), pp 1-5. (Proceedings
of SIGGRAPH '81).

--
=Spencer (spencer@eecs.umich.edu)