Just noticed this, not what I was expecting. I'll file a bug unless someone can convincingly explain it's correct behaviour...

[NSGradient interpolatedColorAtLocation:<value>];

If the gradient has stops that run from, say, 0.5 to 1.0, but <value> is less than 0.5, this method returns nil. I would have expected it to return the extended colour, i.e. the first one in this case.

The discussion for this method says:

"This method does not simply return the color values used to initialize the receiver. Instead, it computes the value that would be drawn at the specified location."

For the case above this depends on whether the gradient will be drawn with the colour extending flags set, but since this method doesn't know about those flags, it's not well-defined. I would suggest that the method should assume the flags are set, since that's a useful assumption, whereas the opposite isn't.

Also, the discussion says:

"The start color of the gradient is always located at 0.0 and the end color is always at 1.0."

Which is simply untrue.


--Graham




_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to