paint method

void paint(
  1. Context context,
  2. PdfRect box
)

Implementation

void paint(Context context, PdfRect box) {
  // Ellipse 4-spline magic number
  const _m4 = 0.551784;

  context.canvas
    // Start
    ..moveTo(box.left, box.bottom + bottomLeft.y)
    // bottomLeft
    ..curveTo(
      box.left,
      box.bottom - _m4 * bottomLeft.y + bottomLeft.y,
      box.left - _m4 * bottomLeft.x + bottomLeft.x,
      box.bottom,
      box.left + bottomLeft.x,
      box.bottom,
    )
    // bottom
    ..lineTo(box.left + box.width - bottomRight.x, box.bottom)
    // bottomRight
    ..curveTo(
      box.left + _m4 * bottomRight.x + box.width - bottomRight.x,
      box.bottom,
      box.left + box.width,
      box.bottom - _m4 * bottomRight.y + bottomRight.y,
      box.left + box.width,
      box.bottom + bottomRight.y,
    )
    // right
    ..lineTo(box.left + box.width, box.bottom + box.height - topRight.y)
    // topRight
    ..curveTo(
      box.left + box.width,
      box.bottom + _m4 * topRight.y + box.height - topRight.y,
      box.left + _m4 * topRight.x + box.width - topRight.x,
      box.bottom + box.height,
      box.left + box.width - topRight.x,
      box.bottom + box.height,
    )
    // top
    ..lineTo(box.left + topLeft.x, box.bottom + box.height)
    // topLeft
    ..curveTo(
      box.left - _m4 * topLeft.x + topLeft.x,
      box.bottom + box.height,
      box.left,
      box.bottom + _m4 * topLeft.y + box.height - topLeft.y,
      box.left,
      box.bottom + box.height - topLeft.y,
    )
    // left
    ..lineTo(box.left, box.bottom + bottomLeft.y);
}