bufferFillRect method

void bufferFillRect(
  1. OptimizedBufferHandle buffer,
  2. int x,
  3. int y,
  4. int width,
  5. int height,
  6. Color background,
)

Fills a rectangular region.

Implementation

void bufferFillRect(
  OptimizedBufferHandle buffer,
  int x,
  int y,
  int width,
  int height,
  Color background,
) {
  _checkUnsignedAbi(x, 0xFFFFFFFF, 'x');
  _checkUnsignedAbi(y, 0xFFFFFFFF, 'y');
  _checkUnsignedAbi(width, 0xFFFFFFFF, 'width');
  _checkUnsignedAbi(height, 0xFFFFFFFF, 'height');
  validateColorChannels(background, name: 'background');
  _guardAlloc('Failed to fill rectangle', (allocator) {
    _native.bufferFillRect(
      buffer.value,
      x,
      y,
      width,
      height,
      _colorToNative(background, allocator),
    );
  });
}