Add setPixel method implementation.