rotateReverse method

PdfRect rotateReverse(
  1. int rotation,
  2. PdfPage page
)

Rotate the rectangle in reverse direction.

Implementation

PdfRect rotateReverse(int rotation, PdfPage page) {
  final swap = (page.rotation.index & 1) == 1;
  final width = swap ? page.height : page.width;
  final height = swap ? page.width : page.height;
  switch (rotation & 3) {
    case 0:
      return this;
    case 1:
      return PdfRect(width - top, right, width - bottom, left);
    case 2:
      return PdfRect(width - right, height - bottom, width - left, height - top);
    case 3:
      return PdfRect(bottom, height - left, top, height - right);
    default:
      throw ArgumentError.value(rotation, 'rotation');
  }
}