Re:The Littlest CPU Rasterizer
by ginsweater on Monday March 10, 2014 @10:16PM
(#7377033)
I wrote one of those once! It was a nightmare morass of one-pixel errors. Maybe there was some clever simplification I missed that would have made it all easy, but these days I use the libraries. :P
I know that's how stb_truetype's renderer works, incidentally. Don't know if Freetype is the same, but I'd be mildly surprised to find it wasn't.
Sort all polygon edges from top to bottom and walk through that list line-by-line, keeping track of all active edges for each scanline. For those you can then find all intersections and fill the ranges in-between. By using an even-odd rule you can make sure that concave polygons and polygons with holes are filled properly.