CALayer drawing transition effect?

2008-07-31 Thread Joseph Kelly
I am subclassing CALayer, and overriding -drawInContext: to perform my  
drawing.


I'm noticing that whenever my -drawInContext gets called (in response  
to calling -setNeedsDisplay)  that there appears to be an actual  
animated fade-out / fade-in of of the old content and the new content.


I do not see this transition effect documented anywhere, so I'm  
wondering if I'm doing something wrong. Or, if this is the correct  
behavior, how do I turn it off?


It's really quite an eye-catching effect, but it's not desirable in  
this particular case; I need the layer content to show up immediately.


I've got several instances of my CALayer subclass as sublayers of an  
NSView with -setWantsLayer:YES.


The reason I subclass CALayer is merely as a convenience. I pass off  
drawing to a C++ object, and rather than create an objective C proxy  
which delegates drawing from a CALayer which it owns, I collapsed it  
into a subclass. But if this is the culprit, I'll go ahead w/ the  
proxy object.


Thanks in advance,


Joe K.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: CALayer drawing transition effect?

2008-07-31 Thread Jens Alfke


On 31 Jul '08, at 10:24 AM, Joseph Kelly wrote:

I'm noticing that whenever my -drawInContext gets called (in  
response to calling -setNeedsDisplay) that there appears to be an  
actual animated fade-out / fade-in of of the old content and the new  
content.
I do not see this transition effect documented anywhere, so I'm  
wondering if I'm doing something wrong. Or, if this is the correct  
behavior, how do I turn it off?


The content of a layer is an animatable property, so by default,  
changing the content will do a crossfade. It seems that applies to  
custom content (drawn by -drawInContext:) as well as the content  
property.


There are a couple ways to suppress animations. You can use the  
CAContext API to disable all animations while you make your changes,  
or you can use the layer's actions dictionary to override the  
animation for the content transition.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: CALayer drawing transition effect?

2008-07-31 Thread Joseph Kelly


On Jul 31, 2008, at 11:07 AM, Jens Alfke wrote:

The content of a layer is an animatable property, so by default,  
changing the content will do a crossfade. It seems that applies to  
custom content (drawn by -drawInContext:) as well as the content  
property.


There are a couple ways to suppress animations. You can use the  
CAContext API to disable all animations while you make your changes,  
or you can use the layer's actions dictionary to override the  
animation for the content transition.


Thanks!

I tried the following which seems to work. I'm not sure if it's the  
approved way or not:


- (idCAAction)actionForKey:(NSString *)event
{
if ([event isEqualToString:@contents])
return nil;
return [super actionForKey:event];
}

(there was some mention of returning [NSNull null] to terminate  
further searching, but it just crashed when I did that)


Joe K.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]