Re: Banding/smoothing problem with drawing angled gradients.
Re: Banding/smoothing problem with drawing angled gradients.
- Subject: Re: Banding/smoothing problem with drawing angled gradients.
- From: Graham Cox <email@hidden>
- Date: Fri, 20 Mar 2009 18:30:31 +1100
On 20/03/2009, at 2:57 PM, Phi Le wrote:
Hello,
I want to draw angled gradients with multiple sharp transitions using
NSGradient. I am not getting very smooth transitions between the
colors. Please take a look at my attachment to see the problem. Are
there solutions without having to use NSShading?
Is the problem the "step" effect you're seeing with small angles?
If so, you could try drawing the gradient always in a fixed direction
(0 degrees) and using the current transform to set the angle. It might
turn out that gives a better anti-aliasing effect than relying on the
gradient angle (which appears to be anti-aliasing only across
horizontal scanlines and not vertical). Of course the gradient might
be simply using a transform internally so it might not help, but it's
worth a try.
Another alternative is to render the gradient into a bitmap at some
larger size - say 4x the final output, then scale the bitmap down to
the final destination. That should blend out the artifacts you're
seeing though expect this approach to be quite a lot slower to draw.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden