Let's assume we have a CGPath and we're drawing it with a nonzero filling rule. It may have self intersections, but it uses a Nonzero fill.
Now, for some reason, we have to switch to the even-odd filling rule. There is no other way. But we still want the path to look exactly the same as before. Therefore we have to do some modifications, like removing self intersections.
For example, this is what we have:
But this is what we want:
I added a gradient stroke to show the path, but i only care about the fill.
The result of this should be that we get a path without self intersections that looks the same when filled no matter what fill rule is used. Note that the path may contain curve segments (not shown in the example)
So, my question is: How do i do this? :)