• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSColor opacity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSColor opacity
      • From: Ken Tozier <email@hidden>
  • Prev by Date: Re: NSColor opacity
  • Next by Date: Re: NSColor opacity
  • Previous by thread: Re: NSColor opacity
  • Next by thread: Re: NSColor opacity
  • Index(es):
    • Date
    • Thread