localToGlobal method

PdfRect localToGlobal(
  1. PdfRect box
)

Implementation

PdfRect localToGlobal(PdfRect box) {
  final mat = canvas.getTransform();
  final lt = mat.transform3(Vector3(box.left, box.bottom, 0));
  final lb = mat.transform3(Vector3(box.left, box.top, 0));
  final rt = mat.transform3(Vector3(box.right, box.bottom, 0));
  final rb = mat.transform3(Vector3(box.right, box.top, 0));
  final x = <double>[lt.x, lb.x, rt.x, rb.x];
  final y = <double>[lt.y, lb.y, rt.y, rb.y];
  return PdfRect.fromLTRB(
    x.reduce(math.min),
    y.reduce(math.min),
    x.reduce(math.max),
    y.reduce(math.max),
  );
}