setPixel method
Set the color of the pixel at the given coordinates to the color of the
given Color c.
Implementation
void setPixel(int x, int y, Color c) {
  if (c is Pixel) {
    if (c.image.hasPalette) {
      if (hasPalette) {
        data?.setPixelRgb(x, y, c.index, 0, 0);
        return;
      }
    }
  }
  data?.setPixelRgba(x, y, c.r, c.g, c.b, c.a);
}