setPixelColor function

void setPixelColor({
  1. required int x,
  2. required int y,
  3. required ByteData bytes,
  4. required int imageWidth,
  5. required Color newColor,
})

Implementation

void setPixelColor({
  required int x,
  required int y,
  required ByteData bytes,

  // for correct representation of color bytes' coordinates
  // in an array of image bytes
  required int imageWidth,
  required ui.Color newColor,
}) {
  bytes.setUint32(
    (x + y * imageWidth) * 4, // offset
    colorToIntRGBA(newColor), // value
  );
}