drawCautionTape method

void drawCautionTape(
  1. Rect rect,
  2. int offsetX,
  3. int offsetY
)

Draws a patterned caution tape in the specified rectangular bounds.

Implementation

void drawCautionTape(Rect rect, int offsetX, int offsetY) {
  final clipped = _clipStack.isEmpty ? rect : activeClip.intersect(rect);
  if (clipped.width <= 0 || clipped.height <= 0) return;

  final startX = max(0, clipped.left);
  final startY = max(0, clipped.top);
  final endX = min(width, clipped.right);
  final endY = min(height, clipped.bottom);
  if (startX >= endX || startY >= endY) return;

  const yellow = 0xFFFCD116;
  const charcoal = 0xFF36454F;

  for (var y = startY; y < endY; y++) {
    final ly = y - offsetY;
    final rowOffset = y * width;
    for (var x = startX; x < endX; x++) {
      final idx = rowOffset + x;
      characters[idx] = _cautionChar(x - offsetX, ly);
      final attrIdx = idx * 3;
      attributes[attrIdx + 0] = yellow;
      attributes[attrIdx + 1] = charcoal;
      attributes[attrIdx + 2] = Modifier.none;
      _setUnderlineColorAt(idx, 0);
      _setUriAt(idx, null);
    }
  }
}