FROM : Jim Puls
DATE : Sun May 11 21:11:46 2008
On May 11, 2008, at 1:26 AM, Michael Vannorsdel wrote:
> 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...
>
> 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.
Or, for the particular case of fading in and out, you can always use
NSViewAnimation: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSViewAnimation_Class/Reference/Reference.html
-> jp
DATE : Sun May 11 21:11:46 2008
On May 11, 2008, at 1:26 AM, Michael Vannorsdel wrote:
> 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...
>
> 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.
Or, for the particular case of fading in and out, you can always use
NSViewAnimation: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSViewAnimation_Class/Reference/Reference.html
-> jp
| Related mails | Author | Date |
|---|---|---|
| Patrick J. Collins | May 11, 09:03 | |
| Michael Vannorsdel | May 11, 10:26 | |
| Jim Puls | May 11, 21:11 |






Cocoa mail archive

