Skip navigation.
 
mlRe: See-through custom NSView
FROM : Andreas Mayer
DATE : Thu Jul 20 00:22:34 2006

Am 19.07.2006 um 16:40 Uhr schrieb Andreas Mayer:

> - (void)drawRect:(NSRect)rect {
>     [[NSColor colorWithCalibratedRed:0.f green:0.5f blue:0.f alpha:
> 0.5f] set];
>     NSRectFill(rect);
> }


In case someone got the impression it was somehow necessary to fall 
back to NSRectFill - here is how to do the same using NSBezierPath:

- (void)drawRect:(NSRect)rect {
   [[NSColor colorWithCalibratedRed:0.f green:0.5f blue:0.f alpha:0.5f] 
set];
   [[NSGraphicsContext currentContext] 
setCompositingOperation:NSCompositeCopy];
   [[NSBezierPath bezierPathWithRect:rect] fill];
}

I just thought NSRectFill was the simpler solution in this case. :)


Andreas

Related mailsAuthorDate
mlSee-through custom NSView Michael Lutz Jul 19, 12:41
mlRe: See-through custom NSView John C. Randolph Jul 19, 13:27
mlRe: See-through custom NSView Michael Lutz Jul 19, 14:30
mlRe: See-through custom NSView Stephane Jul 19, 15:00
mlRe: See-through custom NSView Michael Lutz Jul 19, 16:10
mlRe: See-through custom NSView Pascal Pochet Jul 19, 16:33
mlRe: See-through custom NSView Andreas Mayer Jul 19, 16:40
mlRe: See-through custom NSView Stephane Jul 19, 16:46
mlRe: See-through custom NSView Michael Lutz Jul 19, 17:11
mlRe: See-through custom NSView Pascal Pochet Jul 19, 17:45
mlRe: See-through custom NSView Andreas Mayer Jul 20, 00:22