ScreenSaverView and Core Animation
ScreenSaverView and Core Animation
- Subject: ScreenSaverView and Core Animation
- From: Brian Williams <email@hidden>
- Date: Tue, 5 Feb 2008 00:17:55 -0800 (PST)
Hi,
I am trying to get core animation to work with a ScreenSaverView.
The problem is that the layer is nil.
I have tried to setup the coreanimation layer manually but when I check with
the debugger it comes back empty.
This is in the screensaverview class init
- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
self = [super initWithFrame:frame isPreview:isPreview];
if (self) {
self.layer = [CALayer layer];
self.layer.frame = NSRectToCGRect(self.bounds);
self.layer.delegate = self;
self.layer.needsDisplayOnBoundsChange = YES;
self.wantsLayer = YES;
}
return self;
}
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context
{
NSLog(@"drawlayer");
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithGraphicsPort:context flipped:NO]];
[[NSImage imageNamed:@"water"]
drawInRect:NSRectFromCGRect(CGContextGetClipBoundingBox(context))
fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
[NSGraphicsContext restoreGraphicsState];
}
Any ideas?
Thanks
Brian
_______________________________________________
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