getColor method
get the Color at Offset(x
, y
)
Implementation
@override
Color getColor(int x, int y) {
assert(x >= 0 && x < width, 'x($x) out of with boundary(0 - $width)');
assert(y >= 0 && y < height, 'y($y) out of height boundary(0 - $height)');
final offset = y * _width * bytePerPixel + x * bytePerPixel;
return Color.fromARGB(
_buffer.getUint8(offset + 3),
_buffer.getUint8(offset),
_buffer.getUint8(offset + 1),
_buffer.getUint8(offset + 2),
);
}