clear method

  1. @override
void clear([
  1. Rect? target
])
inherited

Clears the buffer to the PixelFormat.zero value.

This is equivalent to calling fill with the zero value of the format.

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

Example

final pixels = IntPixels(2, 2);
pixels.clear();
pixels.clear(Rect.fromLTWH(1, 0, 1, 2));

Implementation

@override
void clear([Rect? target]) {
  target = target?.intersect(bounds);
  lodim.fillRectLinear(data, format.zero, width: width, bounds: target);
}