CGPath 屏蔽了 CGPoints

发布于 2024-10-18 03:59:20 字数 260 浏览 8 评论 0原文

我正在尝试构建这个: 在此处输入图像描述

白色背景实际上是透明的。我知道如何将 CGPath 剪辑到设定区域,但这似乎是相反的,因为我需要从填充的 CGPath 中减去区域。

我想正确的方法是从 CGPath 中减去整个外圆,然后在我的 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

坠似风落 2024-10-25 03:59:20

这就是我要做的:

1)绘制一般线

2)CGContextSetBlendMode(context, kCGBlendModeClear)在绘制时“清除上下文”。

3) 绘制更大的圆圈

4) CGContextSetBlendMode(context, kCGBlendModeNormal) 返回正常绘图

5) 绘制小圆圈。

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.

沩ん囻菔务 2024-10-25 03:59:20

您可以改为启动一个透明图层,绘制线条,然后使用透明颜色绘制较大的透明圆圈,然后绘制较小的黑色圆圈。然后,当您完成透明层时,它将准确地将您想要的内容合成回上下文中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文