setPixelRgba method Null safety

void setPixelRgba(
  1. int x,
  2. int y,
  3. int r,
  4. int g,
  5. int b,
  6. [int a = 0xff]
)

Set the pixel at the given x, y coordinate to the color r, g, b, a.

This simply replaces the existing color, it does not do any alpha blending. Use drawPixel for that. No range checking is done.

Implementation

void setPixelRgba(int x, int y, int r, int g, int b, [int a = 0xff]) {
  data[y * width + x] = getColor(r, g, b, a);
}