Is it possible to set the contents of a CALayer to an animated GIF and have it 
display that animation? I know that I can set the contents to an image like so:

CALayer* subLayer = [CALayer layer];
NSImage *image = [[NSImage alloc] initWithData:data];
subLayer.contents = image;

And the image will show, but if it's animated, the animation will not display. 
Is the only solution to get the individual frames for the GIF, get the frame 
rate, then change the content of the sublayer according to the frame rate? Or 
is there a much simpler method that I'm overlooking?

Another idea I had was to have a blank NSImageView, then display it/fill it 
with the GIF data if the active sublayer included an animated GIF. This kind of 
worked, except only if the top-most NSView wasn’t using core animation. If it 
was using core animation, the GIF would only play if the window was >= the size 
of the GIF. If it was smaller, the GIF would simply stop playing (I even 
reproduced this in its own test project, same behavior). But then turning off 
core animation on the top view and having it enabled on the lower ones caused a 
series of unideal behavior (lag, glitches, flickering), as I don’t think a view 
hierarchy is supposed to be setup like that.

Also, my reason for using core animation in the first place is because I'm 
loading a fair number of images at once and then individually showing one at a 
time. I started with just using an NSImageView, but the performance was awful 
compared to core animation. 

Anyways, any other ideas?
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to