fromCircle static method

XmlElement fromCircle(
  1. XmlElement circleTag
)

Converts a circle element into a path element.

Implementation

static XmlElement fromCircle(XmlElement circleTag) {
  final filterAttributes = [
    AttributeName.cx,
    AttributeName.cy,
    AttributeName.r,
  ];

  final cx = _getAttribute(circleTag, AttributeName.cx);
  final cy = _getAttribute(circleTag, AttributeName.cy);
  final r = _getAttribute(circleTag, AttributeName.r);
  final cd = r * _kappa;

  return _buildPath(
    'M $cx ${_c(cy - r)} '
    'C ${_c(cx + cd)} ${_c(cy - r)} ${_c(cx + r)} ${_c(cy - cd)} ${_c(cx + r)} $cy '
    'C ${_c(cx + r)} ${_c(cy + cd)} ${_c(cx + cd)} ${_c(cy + r)} $cx ${_c(cy + r)} '
    'C ${_c(cx - cd)} ${_c(cy + r)} ${_c(cx - r)} ${_c(cy + cd)} ${_c(cx - r)} $cy '
    'C ${_c(cx - r)} ${_c(cy - cd)} ${_c(cx - cd)} ${_c(cy - r)} $cx ${_c(cy - r)} '
    'Z',
    circleTag,
    filterAttributes,
  );
}