如何用quartz2d绘制阴影和渐变?
我有一个使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.