getBounds method

  1. @override
GRect getBounds(
  1. GDisplayObject? targetSpace, [
  2. GRect? out
])
override

Returns the bounds of this bitmap in the local coordinate system of the specified targetSpace.

Implementation

@override
GRect getBounds(GDisplayObject? targetSpace, [GRect? out]) {
  out ??= GRect();
  final matrix = _sHelperMatrix;
  matrix.identity();
  getTransformationMatrix(targetSpace, matrix);
  if (texture != null) {
    var rect = texture!.getBounds()!;
    out = MatrixUtils.getTransformedBoundsRect(
      matrix,
      rect,
      out,
    );
  } else {
    matrix.transformCoords(0, 0, _sHelperPoint);
    out.setTo(_sHelperPoint.x, _sHelperPoint.y, 0, 0);
  }
  return out;
}