set method

void set({
  1. required int x,
  2. required int y,
  3. required Color color,
})

Implementation

void set({
  required int x,
  required int y,
  required Color color,
}) {
  if (pixels == null) {
    throw Exception('Must call loadPixels() before calling updatePixels()');
  }

  final pixelIndex = _getBitmapPixelOffset(
    imageWidth: _paintingContext.size.width.round(),
    x: x,
    y: y,
  );

  final argbColorInt = color.value;
  final rgbaColorInt = ((argbColorInt & 0xFF000000) >> 24) | ((argbColorInt & 0x00FFFFFF) << 8);
  pixels!.setUint32(pixelIndex, rgbaColorInt);
}