开发者

How do I draw an angle gradient using CALayer or CoreGraphics functions? [duplicate]

开发者 https://www.devze.com 2023-04-03 10:09 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: CGContextDrawAngleGradient?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

CGContextDrawAngleGradient?

HI I want to dr开发者_如何学Goaw a gradient like the one below in a UIView or CALayer using Quartz2D or CoreGraphics methods.

Does anyone know how can I achieve that?

Any snippet would be great.

Thank you!

How do I draw an angle gradient using CALayer or CoreGraphics functions? [duplicate]


Unfortunately, Core Graphics and Quartz only support axial (linear) and radial (circular) gradients. For an angle gradient you’ll either have to draw it manually (perhaps by drawing triangles in a circle at a resolution fine enough for the color shifts to be unnoticeable) or have a precomposed angle-gradient image that you resize and clip to your drawing needs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号