/// <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 PolygonFigure</param> /// <param name="lastElement">The previous PathElement in the Path.</param> /// <returns>The latest location in the Path after adding the PolygonFigure</returns> public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, ref ICanvasPathElement lastElement) { // Calculate coordinates var topLeft = new Vector2(_x, _y); if (IsRelative) { topLeft += currentPoint; } // Execute command pathBuilder.AddRectangleFigure(topLeft.X, topLeft.Y, _width, _height); // 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); }