2d rasterization algorithms implemented in JavaScript