fill method

void fill(
  1. int x,
  2. int y,
  3. int width,
  4. int height, [
  5. Color? color,
])

Clears and fills the given rectangle with color.

Implementation

void fill(int x, int y, int width, int height, [Color? color]) {
  color ??= backColor;

  var glyph = Glyph.fromCharCode(CharCode.space, foreColor, color);

  for (var py = y; py < y + height; py++) {
    for (var px = x; px < x + width; px++) {
      drawGlyph(px, py, glyph);
    }
  }
}