• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
ScreenSaverView and Core Animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: ScreenSaverView and Core Animation
      • From: Brian Christensen <email@hidden>
  • Prev by Date: Re: Once again: Clickable hyperlink in NSTableView
  • Next by Date: Re: Setting an NSColor crashes - probably very simple issue
  • Previous by thread: Re: Setting an NSColor crashes - probably very simple issue
  • Next by thread: Re: ScreenSaverView and Core Animation
  • Index(es):
    • Date
    • Thread