getAllBounds method

List<GRect> getAllBounds([
  1. List<GRect>? out
])

Returns a list of all bounding boxes of the drawn shapes.

If out is provided, it appends the bounding boxes to the given list and returns it. Otherwise, it creates a new list.

Getting all paths bounds is more "accurate" when the object is rotated. cause it calculates each transformed matrix individually. But it has a bigger CPU hit.

In Graphics "paths" are separated by Paint drawing commands: beginFill and lineStyle

Implementation

List<GRect> getAllBounds([List<GRect>? out]) {
  out ??= <GRect>[];
  for (var e in _drawingQueue) {
    final pathRect = e?.path?.getBounds();
    if (pathRect == null) {
      break;
    }
    out.add(GRect.fromNative(pathRect));
  }
  return out;
}