/// <summary> /// Gets the path representing this element. /// </summary> public override VectorPath GetPath(SVGElement context, RenderContext renderer) { Css.RenderableData rd = context.RenderData; // Don't build the path if there's no radius: float radius = Radius.GetDecimal(rd, ViewportAxis.None); if (radius <= 0) { return(null); } if (_Path == null) { // Don't need to consider stroke width. _Path = new VectorPath(); float centerX = CenterX.GetDecimal(rd, ViewportAxis.X); float centerY = CenterX.GetDecimal(rd, ViewportAxis.Y); // Get the C values: float cX = BezierC * radius; float cY = cX; // Offset to match the center: cX += centerX; cY += centerY; float radiusX = centerX + radius; float radiusY = centerY + radius; float nRadiusX = centerX - radius; float nRadiusY = centerY - radius; _Path.MoveTo(centerX, radiusY); // First quadrant (top right, going clockwise): _Path.CurveTo(cX, radiusY, radiusX, cY, radiusX, centerY); // Bottom right: _Path.CurveTo(radiusX, -cY, cX, nRadiusY, centerX, nRadiusY); // Bottom left: _Path.CurveTo(-cX, nRadiusY, nRadiusX, -cY, nRadiusX, centerY); // Top left: _Path.CurveTo(nRadiusX, cY, -cX, radiusY, centerX, radiusY); // Mark as closed: _Path.LatestPathNode.IsClose = true; } return(_Path); }