clear method

void clear([
  1. double? r,
  2. double? g,
  3. double? b,
  4. double? a,
])

Clears the drawing canvas with the specified color.

If no color components are provided, it uses the current color set by setColor or setColorFrom.

  • r: Red component (0.0 to 1.0).
  • g: Green component (0.0 to 1.0).
  • b: Blue component (0.0 to 1.0).
  • a: Alpha component (0.0 to 1.0).

Implementation

void clear([double? r, double? g, double? b, double? a]) {
  flush();
  gl
    ..clearColor(r ?? _currentColor.r, g ?? _currentColor.g, b ?? _currentColor.b, a ?? _currentColor.a)
    ..clear(GL.COLOR_BUFFER_BIT);
}