Small optimization for filling a triangle (only iterate in a box bounded by triangle's vertices).
Split main.c into library header and library implementation.