Up-to-date algorithms but several problems when using setPixel (i.e. out of range)