Re: NSColor opacity
Re: NSColor opacity
- Subject: Re: NSColor opacity
- From: Darkshadow <email@hidden>
- Date: Sun, 25 Feb 2007 20:05:08 -0500
On Feb 25, 2007, at 4:01 PM, Uli Kusterer wrote:
Am 30.01.2007 um 05:53 schrieb Ken Tozier:
NSRectFill([self bounds]);
That's your error. In 99% of the cases where I see people using
NSRectFill(), it's a mistake. NSRectFill() is for "erasing". I.e.
it actually assigns exactly the color you specify to the back
buffer. If your window is opaque (no setOpaque:NO) that means it
gets black.
What you want is
[NSBezierPath fillRect: [self bounds]];
That will composite the colour into what's already in the window.
Well, you can also use NSRectFillUsingOperation() with an operation
of NSCompositeSourceOver to do the same thing that NSBezierPath's -
fillRect: does.
In fact, if you change the graphic context's composite operation to
something other than NSCompositeSourceOver, using NSBezierPath's -
fillRect: method will behave differently, while
NSRectFillUsingOperation() will always use the operation you specify.
------------------------------------------------
Darkshadow
(aka Michael Nickerson)
http://www.nightproductions.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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