transformedBBox property
PdfBox
get
transformedBBox
The /BBox after being transformed by the /Matrix.
It is the rectangle the reader actually paints, and it is over it — not
over the raw /BBox — that the scale up to the widget /Rect is
computed.
Implementation
PdfBox get transformedBBox {
final a = matrix[0];
final b = matrix[1];
final c = matrix[2];
final d = matrix[3];
final e = matrix[4];
final f = matrix[5];
final xs = <double>[];
final ys = <double>[];
for (final corner in <List<double>>[
<double>[bbox.left, bbox.bottom],
<double>[bbox.right, bbox.bottom],
<double>[bbox.right, bbox.top],
<double>[bbox.left, bbox.top],
]) {
xs.add(a * corner[0] + c * corner[1] + e);
ys.add(b * corner[0] + d * corner[1] + f);
}
return PdfBox(
xs.reduce((p, e) => p < e ? p : e),
ys.reduce((p, e) => p < e ? p : e),
xs.reduce((p, e) => p > e ? p : e),
ys.reduce((p, e) => p > e ? p : e),
);
}