如何用quartz2d绘制阴影和渐变?

发布于 2024-08-27 16:24:23 字数 120 浏览 6 评论 0原文

我有一个使用 coregraphics 的自定义形状绘图,我还想为其添加阴影和渐变。我一直在尝试和搜索大量有关如何组合和执行此操作的信息,但我无法让它发挥作用。我也只能画一张。 有人已经这样做过或者知道如何做到这一点吗?谢谢。

I've a custom shape drawing using coregraphics and i want to add a drop shadow and a gradient to it also. I've been trying and searching a lot of informations on how to combine and do this, but i can't get it to work. I'm able to draw only one either.
Anyone doing this already or know how to do this? Thank you.

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

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

发布评论

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

评论(1

揽月 2024-09-03 16:24:23

Quartz 仅将阴影应用于填充和描边。绘制渐变不算作填充。

填充纯色(以绘制阴影),然后在同一区域绘制渐变。

Quartz only applies shadows to fills and strokes. Drawing a gradient does not count as a fill.

Fill with a solid color (to draw the shadow), then draw the gradient in the same area.

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