getPixelColor method

Color getPixelColor(
  1. double x,
  2. double y
)

Implementation

Color getPixelColor(double x, double y) {
  if (x < 0 || x >= width || y < 0 || y >= height) {
    throw RangeError('Pixel coordinates out of range');
  }
  final index = ((y * width + x) * bytesPerPixel).toInt();
  final b = buffer[index];
  final g = buffer[index + 1];
  final r = buffer[index + 2];
  final a = buffer[index + 3];
  return Color.fromARGB(a, r, g, b);
}