maseth
maseth

Reputation: 841

How to draw elliptical gradient in cocoa?

Is it possible to get this kind of gradient in cocoa ? enter image description here

I can use simple CGContextDrawRadialGradient with clip made by CGContextAddEllipseInRect but the effect will slightly different.

Is it any posibility to draw exact this shade/gradient?

Upvotes: 0

Views: 265

Answers (1)

AlexWien
AlexWien

Reputation: 28727

I would use a radial gradient, and then apply a scale trasnformation such that the y coordinate is squiched, and the x remains.

There is an advanced topic where you can define your own gradients providing an callback that calculates the color or so. Ist stated in Core Graphics docu.

Upvotes: 2

Related Questions