setPixels method
Sets the canvas pixels.
Implementation
@override
void setPixels(PCanvasPixels pixels,
{int x = 0, int y = 0, int? width, int? height}) {
pixels = pixels.toPCanvasPixelsABGR();
var pixelsData = pixels.pixels;
var pixelsDataBuffer = pixelsData.buffer;
var bytes = pixelsDataBuffer.asUint8ClampedList(
pixelsData.offsetInBytes, pixelsData.lengthInBytes);
var imageData = ImageData(bytes, pixels.width, pixels.height);
_ctx.putImageData(imageData, x, y, 0, 0, pixels.width, pixels.height);
}