Re: How to draw a NSImage in a view
Re: How to draw a NSImage in a view
- Subject: Re: How to draw a NSImage in a view
- From: Andrew Platzer <email@hidden>
- Date: Tue, 10 Jul 2001 11:07:44 -0700
On Monday, July 9, 2001, at 11:53 , Quentin Mathi wrote:
I have a subclass of NSView with two methods :
- (void)drawRect:(NSRect)rect {
NSRect myBounds = [self bounds];
[tableViewImage drawInRect:myBounds
fromRect:myBounds
operation:NSCompositeCopy
fraction:nil];
}
I don't understand what is the use of the parameters fromRect and
fraction...
Two things.
1) 'fromRect' allows you to specify part of the source image. Use
NSZeroRect to draw the whole image.
2) fraction is the alpha value and, as described in NSImage.h, it is a
float between 0.0 and 1.0. Passing in nil (which should have generated a
warning) means no alpha, i.e. a completely transparent image which is why
nothing is visible.
Andrew
__________________________________________________________________
A n d r e w P l a t z e r
A p p l i c a t i o n F r a m e w o r k s
A p p l e