Re: Transparency in NSButtonCell
Re: Transparency in NSButtonCell
- Subject: Re: Transparency in NSButtonCell
- From: Andreas Mayer <email@hidden>
- Date: Sun, 17 Jul 2005 01:27:56 +0200
Am 17.07.2005 um 00:55 Uhr schrieb Matt Ball:
Rather than retooling my setup to include [self path] and [self
setPath:], is there any reason this wouldn't work: (because when I use
it, nothing is drawn...)
- (void)drawRect:(NSRect)rect {
if(!roundRectHasBeenFilled) {
[self drawRoundRectWithFrame:[self bounds]];
}
}
Yes, there is. You simply don't draw anything except for the first
time drawRect: is called.
Also, drawRect: might be called frequently, so you should try to
minimize the work done there. Why create and destroy all those
objects (colors, shadows, bezier paths ...) over and over again when
they will stay the same as long as the window's size does not change.
if(rect.origin.y <= 19)
[[NSColor colorWithCalibratedWhite:0.2 alpha:0.7] set];
else
[[NSColor colorWithCalibratedWhite:0.05 alpha:0.7] set];
NSRectFill(rect);
I don't think this will work in all situations.
What if rect is something like {0, 12, 200, 50}?
Andreas
_______________________________________________
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