• 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: How to draw a NSImage in a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How to draw a NSImage in a view (From: Quentin Mathé <email@hidden>)

  • Prev by Date: Re: NSMenu in small PopUp buttons
  • Next by Date: Re: NSTask - grep
  • Previous by thread: Re: How to draw a NSImage in a view
  • Next by thread: Security FrameWork Help
  • Index(es):
    • Date
    • Thread