getColor method

  1. @override
Color getColor(
  1. int x,
  2. int y
)
override

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),
  );
}