Put width/height in local variables, get rid of numPixels
Need only one cast here
Added getScanline() to image classes
Converted distance calculation to use scanline