/// <summary> /// Adds the Path Element to the Path. /// </summary> /// <param name="pathBuilder">CanvasPathBuilder object</param> /// <param name="currentPoint">The last active location in the Path before adding /// the EllipseFigure</param> /// <param name="lastElement">The previous PathElement in the Path.</param> /// <returns>The latest location in the Path after adding the EllipseFigure</returns> public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, ref ICanvasPathElement lastElement) { // Calculate coordinates var center = new Vector2(_x, _y); if (IsRelative) { center += currentPoint; } // Execute command pathBuilder.AddEllipseFigure(center.X, center.Y, _radiusX, _radiusY); // No need to update the lastElement or currentPoint here as we are creating // a separate closed figure here. So current point will not change. return(currentPoint); }
/// <summary> /// Adds an ellipse figure to the path. /// </summary> /// <param name="pathBuilder"><see cref="CanvasPathBuilder"/></param> /// <param name="center">Center location of the ellipse.</param> /// <param name="radiusX">Radius of the ellipse on the X-axis.</param> /// <param name="radiusY">Radius of the ellipse on the Y-axis.</param> public static void AddEllipseFigure(this CanvasPathBuilder pathBuilder, Vector2 center, float radiusX, float radiusY) { pathBuilder.AddEllipseFigure(center.X, center.Y, radiusX, radiusY); }
/// <summary> /// Adds a circle figure to the path. /// </summary> /// <param name="pathBuilder"><see cref="CanvasPathBuilder"/></param> /// <param name="x">X coordinate of the center location of the circle.</param> /// <param name="y">Y coordinate of the center location of the circle.</param> /// <param name="radius">Radius of the circle.</param> public static void AddCircleFigure(this CanvasPathBuilder pathBuilder, float x, float y, float radius) { pathBuilder.AddEllipseFigure(x, y, radius, radius); }