There is no API to create an intersection between two CGPath
s, however CoreGraphics knows how to do it behind the scenes. When calling CGContextClip
(link) it will intersect current and clipping paths and store it in the clipping path.
I was thinking to utilize this to perform intersections between paths I have. The problem is I can not find a way to retrieve back the clipping path from CGContext
.
Am I correct that such API does not exist or did I miss something?
It looks like what I need was added in iOS 16 beta https://developer.apple.com/documentation/coregraphics/cgpath/3994964-intersection?changes=latest_minor&language=_5 So I guess I was right and currently it is not available.
However for my particular case, I did not need the intersection path itself, only to stroke it so a colleague suggested to clip one path by the other and stroke the result and then switch roles and stroke the other part. Together the intersection path is approximately stroked (with some visual artifacts at intersection points)