getPixel method

  1. @override
Pixel getPixel(
  1. int x,
  2. int y, [
  3. Pixel? pixel
])
override

Return the Pixel at the given coordinates. If pixel is provided, it will be updated and returned rather than allocating a new Pixel.

Implementation

@override
Pixel getPixel(int x, int y, [Pixel? pixel]) {
  if (pixel == null || pixel is! PixelUint1 || pixel.image != this) {
    pixel = PixelUint1.imageData(this);
  }
  pixel.setPosition(x, y);
  return pixel;
}