SvgPath.fromEllipseXml constructor

SvgPath.fromEllipseXml(
  1. XmlElement element,
  2. SvgPainter painter,
  3. SvgBrush brush
)

Implementation

factory SvgPath.fromEllipseXml(
  XmlElement element,
  SvgPainter painter,
  SvgBrush brush,
) {
  final _brush = SvgBrush.fromXml(element, brush, painter);

  final cx = SvgParser.getNumeric(element, 'cx', _brush)!.sizeValue;
  final cy = SvgParser.getNumeric(element, 'cy', _brush)!.sizeValue;
  final rx = SvgParser.getNumeric(element, 'rx', _brush)!.sizeValue;
  final ry = SvgParser.getNumeric(element, 'ry', _brush)!.sizeValue;
  final d =
      'M${cx - rx},${cy}A$rx,$ry 0,0,0 ${cx + rx},${cy}A$rx,$ry 0,0,0 ${cx - rx},${cy}z';

  return SvgPath(
    d,
    _brush,
    SvgClipPath.fromXml(element, painter, _brush),
    SvgTransform.fromXml(element),
    painter,
  );
}