iOS Core Graphics fill inverse of path?
I am drawing a custom shape using CGPathCreateMutable() and CGPathAddArcToPoint. As expected, when I close and fill my path I get the shape which I just drew. However, what I am looking to do is fill the inverse of the path that I have just drawn. That is, if I have drawn a circular path, I want to fill everything except for this circle that I have just drawn.
Is there any way to do an inverse fill? Or another solution would be if I could fill between 2 paths if that is possible? That way I can create a rect path of my bounding frame and then fill between that and my custom path.
If you draw to paths and fill them using Even Odd (EO) fill, that should get you what you want (fill the inner part).
Default fill on OSX (and iPhone) is non zero winding (NZW) fill You could probably get the same effect using non zero winding too, by changing the winding of the different parts accordingly (the 'clockwise' parameter), but using even odd will be much simpler.