Hello all... is there a way to close a contour if you have found say two points on each side top "extension"? see image attached. So in end desire a trapezoid type shape. Code example would be very appreciated. thank you :) Think I have it as a CGPath. So a way to edit a CGPath, or close the top from a top left to a top right point?
Desire to close contour from left & right two top points
looks like I got a line added across the top, but that top section did not .fill in. here is the func:
func updateContourPath(contourPath: Path, topLeft: CGPoint, topRight: CGPoint) -> Path {
var newPath = Path()
// Copy the original path
newPath.addPath(contourPath)
// Move to the starting point and add a line to the ending point
newPath.move(to: topLeft)
newPath.addLine(to: topRight)
return newPath
}
update: I added // Close the path to ensure it can be filled newPath.closeSubpath()
but Path still not closed or .fill fillable.