简体   繁体   English

CGPath掩盖了CGPoints

[英]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. 我知道如何将CGPath剪辑到一个设置区域,但这似乎是以其他方式,因为我需要从填充的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. 我想正确的方法是从CGPath中减去整个外圈,然后在我的CGPoints中绘制较小的圆圈,但我不知道如何执行前者。 Can anyone point me in the right direction? 谁能指出我正确的方向?

That's what I would do : 这就是我要做的事情:

1) Draw your general line 1)画出你的总路线

2) CGContextSetBlendMode(context, kCGBlendModeClear) to "clear the context" when you draw. 2) CGContextSetBlendMode(context, kCGBlendModeClear)在绘制时“清除上下文”。

3) Draw you bigger circles 3)画出更大的圆圈

4) CGContextSetBlendMode(context, kCGBlendModeNormal) to return to normal drawing 4) CGContextSetBlendMode(context, kCGBlendModeNormal)返回正常绘图

5) Draw your little circles. 5)画出你的小圆圈。

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. 然后,当您完成透明度图层时,它会将您想要的内容复合到上下文中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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