Re: NSAttributedString fill with gradient
Re: NSAttributedString fill with gradient
- Subject: Re: NSAttributedString fill with gradient
- From: Graham Cox <email@hidden>
- Date: Sun, 20 Dec 2009 13:30:19 +1100
On 20/12/2009, at 1:21 PM, BravoBug Software wrote:
>> Why would you even expect that to work? NSGradient is not a colour. At present there is no supported attribute for gradients.
>
> Oh? You might want to let the folks at Apple know that ;)
>
> [[NSColor selectedMenuItemColor] set];
> NSRectFill(someRect);
>
> -matt
That's hardly the same as what the OP was asking - how to apply any particular gradient attribute to a run of text.
The above works because it is a special-case within the drawing code, that detects that colour and substitutes the gradient fill effect. You cannot use it to apply an arbitrary gradient, and not to text.
It would be convenient if gradients could be passed around as NSColor objects, just as patterns can be, but for whatever reason, Apple decided not to do them that way.
--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