2

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.

KTas
  • 409
  • 1
  • 6
  • 17
  • 1
    Looks like a dupe of [UIBezierPath Subtract Path](http://stackoverflow.com/questions/8859285/uibezierpath-subtract-path) – user1118321 Jun 14 '12 at 04:45

1 Answers1

1

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.

Pieter
  • 17,435
  • 8
  • 50
  • 89