I am looking for an inverse of CGPath (relative to Rect). By this, I mean that I defined a CGPath , and I want to get a CGPath that describes all the other areas in rect.
I experimented differently and for several days I tried to work for several days. I just can't solve it!
Consider the following rectangle with a given CGPath (where green is the specified CGPath filled):

Now, when I want (inverted CGPath ), you will get the following:

In particular, this is for use with SKCropNode and SKPhysicsBody in SpriteKit, however I create a polygon for the node mask using CGPaths (and saving the path in ivar).
Is it possible to change CGPath or some other way? If so, how?
Thanks in advance.
source share