On 29 Jul 2008, at 12:31 pm, Dale Miller wrote:

I cannot get transparent colors to work. I have tried two cases:
1) I have a view which returns YES to "isTransparent". The log shows the method has been called and responded YES. If I do a NSRectFill after [[NSColor clearColor] set] the view displays as black.

-isTransparent only applies to certain controls, not to views in general. Did you mean -isOpaque instead?

I think there is a bug that seemed to get introduced in Leopard. The NSRectFill methods now seem to do something different from what they did on Tiger, using a different composition mode that stops transparency working quite right. I'm not completely sure though - I just noticed some drawing problems in my code when I went to Leopard and didn't investigate them - I just switched to using a different technique.

You can avoid the problem by using NSBezierPath instead (e.g. [NSBezierPath fillRect:])



2) If i do a "drawInRect" with the attribute NSBackgroundColorAttributeName set to [NSColor clearColor] (or to a color with an alpha of 0. regardless of the red/green/blue components) the background of the text draws as black. What is it that I don't understand?

I believe this is a known bug - transparent text backgrounds aren't supported. You can achieve the equivalent just by rendering the text atop the background in the usual way (i.e. no background attribute set at all) - the only place this bug causes a problem is with editing text using NSTextView with a transparent background. So this might be related to your (mis)use of isTransparent?

hth,

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