如何使用quartz2d绘制阴影和渐变? [英] How to draw a drop shadow AND gradient with quartz2d?

查看:81
本文介绍了如何使用quartz2d绘制阴影和渐变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用核心图形的自定义形状绘图,我还想为其添加一个阴影和一个渐变。我一直在尝试和搜索有关如何组合和执行此操作的大量信息,但我无法使其正常工作。我只能画一个。
是否有人已经这样做或知道如何做?谢谢。

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.

推荐答案

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

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.

这篇关于如何使用quartz2d绘制阴影和渐变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆