Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSAttributedString fill with gradient
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString fill with gradient



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

References: 
 >NSAttributedString fill with gradient (From: Chris Purcell <email@hidden>)
 >Re: NSAttributedString fill with gradient (From: Graham Cox <email@hidden>)
 >Re: NSAttributedString fill with gradient (From: BravoBug Software <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.