inscribe method

PdfRect inscribe(
  1. PdfPoint size,
  2. PdfRect rect
)

Returns a rect of the given size, aligned within given rect as specified by this alignment.

Implementation

PdfRect inscribe(PdfPoint size, PdfRect rect) {
  final halfWidthDelta = (rect.width - size.x) / 2.0;
  final halfHeightDelta = (rect.height - size.y) / 2.0;
  return PdfRect(
    rect.x + halfWidthDelta + x * halfWidthDelta,
    rect.y + halfHeightDelta + y * halfHeightDelta,
    size.x,
    size.y,
  );
}