fillFrom method

  1. @override
void fillFrom(
  1. Iterable<int> pixels, [
  2. Rect? target
])
inherited

Fill the buffer with the given pixels.

If a target rectangle is provided, only the pixels within that rectangle are filled, and the rectangle will be clipped to the bounds of the buffer.

If the number of pixels in the iterable is less than the number of pixels in the target rectangle, the remaining pixels will be filled with the zero value of the format. If the number of pixels is greater, the extra pixels will be ignored.

Example

final pixels = IntPixels(2, 2);
pixels.fillWith([0xFFFFFFFF, 0x00000000]);
pixels.fillWith([0x00000000, 0xFFFFFFFF], Rect.fromLTWH(1, 0, 1, 2));

Implementation

@override
void fillFrom(Iterable<T> pixels, [Rect? target]) {
  if (target == null) {
    target = bounds;
  } else {
    target = target.intersect(bounds);
  }
  lodim.fillRectFromLinear(data, pixels, width: width, bounds: target);
}