Skip navigation.
 
mlRe: image opacity?
FROM : Michael Vannorsdel
DATE : Sun May 11 10:26:19 2008

NSView and subclasses have a setAlphaValue: that might do what you 
want.  It requires a backing Core Animation layer (CALayer) and 
therefore is Leopard only.  You can have IB setup the layer backing by 
setting the view's Wants Core Animation Layer under Effects of the 
Inspector window; I think Content View is the one to enable it on. 
You can do it programatically with setWantsLayer:YES as well.  Then 
you use the animator proxy like:

[[NSAnimationContext currentContext] setDuration:2.0];  //2 second fade
[[imageView animator] setAlphaValue:1.0f];  //fade in view to full 
opacity

Alternately you can subclass the NSImageView or make your own NSView 
subclass and override drawRect: to vary the drawn image's opacity.  If 
you're adventurous you can use Core Image to do an accelerated fade 
for Tiger and up.


On May 11, 2008, at 1:03 AM, Patrick J. Collins wrote:

> Does anyone happen to know how one could set the opacity of an
> NSImageView object?  I am looking for a way to simply fade in an image
> on within my app's window-- but neither of the NSImageView nor
> IKImageView list anything about opacity...

Related mailsAuthorDate
mlimage opacity? Patrick J. Collins May 11, 09:03
mlRe: image opacity? Michael Vannorsdel May 11, 10:26
mlRe: image opacity? Jim Puls May 11, 21:11