at method

List<int> at(
  1. int x,
  2. int y
)

The pixel at (x, y) as [r, g, b, a].

Implementation

List<int> at(int x, int y) {
  RangeError.checkValueInInterval(x, 0, width - 1, 'x');
  RangeError.checkValueInInterval(y, 0, height - 1, 'y');
  final o = (y * width + x) * 4;
  return [bytes[o], bytes[o + 1], bytes[o + 2], bytes[o + 3]];
}