intersect method

PdfBox? intersect(
  1. PdfBox other
)

Intersection with other, or null when there is no overlap with area.

This is the operation used to apply the specification rule that the effective /CropBox is its intersection with the /MediaBox.

Implementation

PdfBox? intersect(PdfBox other) {
  final l = math.max(left, other.left);
  final b = math.max(bottom, other.bottom);
  final r = math.min(right, other.right);
  final t = math.min(top, other.top);
  if (l >= r || b >= t) return null;
  return PdfBox(l, b, r, t);
}