Re: NSColor opacity
Re: NSColor opacity
- Subject: Re: NSColor opacity
- From: Dan Messing <email@hidden>
- Date: Tue, 30 Jan 2007 01:39:21 -0600
NSRectFill() uses NSCompositeCopy, try using NSRectFillUsingOperation
([self bounds], NSCompositeSourceOver) instead. Or use NSBezierPath's
+fillRect: method.
Dan Messing
Stunt Software
http://www.stuntsoftware.com/
On Jan 30, 2007, at 12:36 AM, Ken Tozier wrote:
- (void) drawRect:(NSRect) rect
{
NSColor *tempColor = [NSColor colorWithDeviceRed: 0
green: 1
blue: 0
alpha: .1];
NSGraphicsContext *context = [NSGraphicsContext currentContext];
[context saveGraphicsState];
// composite the image to the rect
[currentImage drawInRect: [self bounds]
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0];
// overlay with hover color
[tempColor set];
NSRectFill([self bounds]);
[context restoreGraphicsState];
}
What I would expect is a 10 percent green screen overlayong the
specified rect What I get however is a 90 percent black rectangle.
Also tried changing the composite method by adding following line
before the [tempColor set] command to no effect.
[context setCompositingOperation: NSCompositeSourceAtop];
_______________________________________________
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