Re: Transparent white NSView
Re: Transparent white NSView
- Subject: Re: Transparent white NSView
- From: "I. Savant" <email@hidden>
- Date: Wed, 14 Jun 2006 08:15:35 -0400
Tom:
Well ... you're first drawing the whole background with
+controlDarkShadowColor, then you're drawing atop *that* color with
an alpha-faded white. What'd you expect when combining those colors? :-)
I recommend filling the whole thing with your alpha-white color
*first*. Then, using NSBezierPath's +bezierPathWithRect: method to
create a path with the bounds. *Stroke* the path with your
+controlDarkShadowColor, just don't *fill* it.
Also, when trying to inset a rectangle, use NSInsetRect(). This
will keep you from having to manually adjust the origin, and the area:
NSRect newRect = NSInsetRect(oldRect, 1, 1);
I hope this helps.
--
I.S.
On Jun 14, 2006, at 5:23 AM, Thomas Engelmeier wrote:
Hi,
I am implementing an assistant - type application.
All Apple variants (Network Diagnostics, Mail Account setup,
Network Setup Assistant) have a transparent white view above some
background artwork - which I try to mimick with a custom NSView.
Except my code produces an dirty gray background instead of an neat
lighter bg.
I'm running out of ideas how to cure it. My code looks like:
- (BOOL) isOpaque
{
return NO;
}
- (void) drawRect:(NSRect) frame
{
NSRect tRect=[self bounds];
[[NSColor controlDarkShadowColor] set];
NSFrameRect(tRect);
tRect.origin=NSMakePoint(1,1);
tRect.size.width-=2;
tRect.size.height-=2;
[[NSColor colorWithDeviceWhite:1.0 alpha:.3] set];
NSRectFill(tRect );
// doesn't help, either:
// NSRectFillUsingOperation(tRect, NSCompositePlusLighter );
}
TIA,
Tom_E
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden