/// <summary>
 /// Creates a Squircle geometry with the specified extents.
 /// </summary>
 /// <param name="resourceCreator"></param>
 /// <param name="x">X offset of the TopLeft corner of the Squircle</param>
 /// <param name="y">Y offset of the TopLeft corner of the Squircle</param>
 /// <param name="width">Width of the Squircle</param>
 /// <param name="height">Height of the Squircle</param>
 /// <param name="radiusX">Corner Radius on the x-axis</param>
 /// <param name="radiusY">Corner Radius on the y-axis</param>
 /// <returns>CanvasGeometry</returns>
 public static CanvasGeometry CreateSquircle(ICanvasResourceCreator resourceCreator, float x, float y,
                                             float width, float height, float radiusX, float radiusY)
 {
     using (var pathBuilder = new CanvasPathBuilder(resourceCreator))
     {
         pathBuilder.AddSquircleFigure(x, y, width, height, radiusX, radiusY);
         return(CanvasGeometry.CreatePath(pathBuilder));
     }
 }
        /// <summary>
        /// Adds a Squircle to the Path.
        /// </summary>
        /// <param name="pathBuilder">CanvasPathBuilder</param>
        /// <param name="x">X offset of the TopLeft corner of the Squircle</param>
        /// <param name="y">Y offset of the TopLeft corner of the Squircle</param>
        /// <param name="width">Width of the Squircle</param>
        /// <param name="height">Height of the Squircle</param>
        /// <param name="radiusX">Corner Radius on the x-axis</param>
        /// <param name="radiusY">Corner Radius on the y-axis</param>
        public static void AddSquircleFigure(this CanvasPathBuilder pathBuilder, float x, float y, float width,
                                             float height, float radiusX, float radiusY)
        {
            // Sanitize the width by taking the absolute value
            width = Math.Abs(width);
            // Sanitize the height by taking the absolute value
            height = Math.Abs(height);

            var rect = new CanvasRoundRect(x, y, width, height, radiusX * SquircleFactor, radiusY * SquircleFactor);

            pathBuilder.AddSquircleFigure(rect, true);
        }