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.x, box.y + bottomLeft.y)
    // bottomLeft
    ..curveTo(
        box.x,
        box.y - _m4 * bottomLeft.y + bottomLeft.y,
        box.x - _m4 * bottomLeft.x + bottomLeft.x,
        box.y,
        box.x + bottomLeft.x,
        box.y)
    // bottom
    ..lineTo(box.x + box.width - bottomRight.x, box.y)
    // bottomRight
    ..curveTo(
        box.x + _m4 * bottomRight.x + box.width - bottomRight.x,
        box.y,
        box.x + box.width,
        box.y - _m4 * bottomRight.y + bottomRight.y,
        box.x + box.width,
        box.y + bottomRight.y)
    // right
    ..lineTo(box.x + box.width, box.y + box.height - topRight.y)
    // topRight
    ..curveTo(
        box.x + box.width,
        box.y + _m4 * topRight.y + box.height - topRight.y,
        box.x + _m4 * topRight.x + box.width - topRight.x,
        box.y + box.height,
        box.x + box.width - topRight.x,
        box.y + box.height)
    // top
    ..lineTo(box.x + topLeft.x, box.y + box.height)
    // topLeft
    ..curveTo(
        box.x - _m4 * topLeft.x + topLeft.x,
        box.y + box.height,
        box.x,
        box.y + _m4 * topLeft.y + box.height - topLeft.y,
        box.x,
        box.y + box.height - topLeft.y)
    // left
    ..lineTo(box.x, box.y + bottomLeft.y);
}