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
Delivered-to: email@hidden
Delivered-to: email@hidden
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer:sender; bh=hzFjs5uAg6D7pisxbE8Y0+05t03Erolp9hInetgmp4s=; b=PNtU2eZ+lUAk4HLYWNAhTUuGftvooJEvuBn5RMAa1XrM7wOTtZnWk/K5s+OB/EVc6t U9VSpumFRXY2D5kV1jA4s6AxpQd6fWsWDMz53a5ECbGfZlLllPBxh2H0UXmovEShLuPU /9KMZfOH9bxg4I4mfaYYrxf3cLkYsWxaOIze4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer:sender; b=AXcGr1TrSVx88objASfgAHkkF/50rrQadCbbrGdjEH+pf5gPeFciFwZVmBl7fq+Iwv u+dzqf0tptl7WK7K867qervGV1TRsYwxYyRrJTzjEvLCyuPUyOlrNHqIoEqpja4fv9x1 1bpOZa/wzWE3fW59bd4NMaPqsY3Nuf6l/NFPI=
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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.