Re: Drawing a string with a clearColor background
Re: Drawing a string with a clearColor background
- Subject: Re: Drawing a string with a clearColor background
- From: Rob Keniger <email@hidden>
- Date: Tue, 9 Dec 2008 08:17:02 +1000
On 09/12/2008, at 7:31 AM, Randall Meadows wrote:
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
[NSColor clearColor], NSBackgroundColorAttributeName,
nil];
[text drawInRect:textBounds withAttributes:attrs];
draws the string in the correct text color and font, with a black
rectangular background. I want the background image to show through
the "holes" in the string I'm drawing. I tried adding
[[NSColor clearColor] set];
NSRectFill(textBounds);
before the -drawInRect: call, to no avail. What am I missing?
If you don't set the background at all the text should draw with no
background.
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
nil];
[text drawInRect:textBounds withAttributes:attrs];
--
Rob Keniger
_______________________________________________
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