Search code examples
iphonecore-graphicscgpath

CGPath masked off CGPoints


I'm trying to build this: enter image description here

Where the white background is in fact transparent. I know how to clip a CGPath to a set region, but this seems to be to other way around, since I need to substract regions from a filled CGPath.

I guess the right way to go would be to substract the whole outer-circles from the CGPath and then to draw smaller circles at my CGPoints, but I'm not sure how to execute the former. Can anyone point me in the right direction?


Solution

  • That's what I would do :

    1) Draw your general line

    2) CGContextSetBlendMode(context, kCGBlendModeClear) to "clear the context" when you draw.

    3) Draw you bigger circles

    4) CGContextSetBlendMode(context, kCGBlendModeNormal) to return to normal drawing

    5) Draw your little circles.