43 ms·
For concave shapes like letters the best choice would probably be a scanline-based rasterization algorithm. Sort all polygon edges from top to bottom and walk
by ginko 13y ago
For concave shapes like letters the best choice would probably be a scanline-based rasterization algorithm.
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.
- ginsweater 13y agoI 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.