Change setPixels algorithm to bitmap