added scanline solution, have not tested yet.