fillRect method

void fillRect(
  1. int x,
  2. int y,
  3. int width,
  4. int height,
  5. Color color,
)

Fills a rectangular region with solid background color.

Example:

buffer.fillRect(5, 2, 20, 10, Color.darkGray);
buffer.fillRect(10, 8, 21, 1, Color.green);

x, y, width, and height must fit unsigned 32-bit values; violations throw a pre-invocation RangeError after the lifecycle check.

Implementation

void fillRect(int x, int y, int width, int height, Color color) {
  _checkValid();
  _checkUnsignedAbi(x, 0xFFFFFFFF, 'x');
  _checkUnsignedAbi(y, 0xFFFFFFFF, 'y');
  _checkUnsignedAbi(width, 0xFFFFFFFF, 'width');
  _checkUnsignedAbi(height, 0xFFFFFFFF, 'height');
  _bindings.bufferFillRect(_ptr, x, y, width, height, color);
}