LightTable Sample CoreAnimation Code
LightTable Sample CoreAnimation Code
- Subject: LightTable Sample CoreAnimation Code
- From: Alexander Heinz <email@hidden>
- Date: Wed, 23 Jun 2010 22:09:18 -0400
Hello all,
I've been attempting to make sense of Apple's "LightTable" sample code for Core Animation, and I'm completely lost. Specifically, a couple of calls appear to be assigning an NSImage to the contents of a CALayer, which, as I previously understood, (and according to the documentation) should be impossible.
Specifically, the "LTView" class contains the following, in its -insertSlides:atIndexes: method:
NSImage *image = [[NSImage alloc] initWithData:[slide valueForKey:kLTViewSlidePropertyPhoto]];
(snip)
LTMaskLayer *slideLayer = [LTMaskLayer layer];
slideLayer.photo = image;
Jumping over to the "LTMaskLayer" class, (keeping in mind that _visiblePhoto is a plain-vanilla CALayer ivar) we have:
- (void)setPhoto:(id)newContents
{
_visiblePhoto.contents = newContents;
}
Am I crazy? Aren't these calls assigning an NSImage to a CALayer's contents?
For reference, documentation for CALayer -setContents: reads:
A layer can set this property to a CGImageRef to display the image as its contents.
Can anyone explain what this code is doing?
Thanks in advance,
- Alex_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden