setPixel method

void setPixel(
  1. int x,
  2. int y,
  3. Color c
)

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);
}