简体   繁体   中英

CGPath masked off CGPoints

I'm trying to build this: 在此输入图像描述

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?

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.

You could instead start a transparency layer, draw the lines, then draw the larger transparent circles using the clear color, then draw the smaller black circles. Then when you finish the transparency layer, it will composite exactly what you want back onto the context.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM