Re: How do I make a screensaver that draws pictures?
Re: How do I make a screensaver that draws pictures?
- Subject: Re: How do I make a screensaver that draws pictures?
- From: David Remahl <email@hidden>
- Date: Mon, 31 Dec 2001 00:10:08 +0100
>
I'm trying to make a screensaver using the tutorial on cocoadevcentral. But
>
instead of drawing shapes, I wanna be able to draw pictures and perhaps move
>
then. Can anyone tell me how do that?
>
>
SO far I have this, but doesn't do anything:
>
>
- (void)animateOneFrame
>
{
>
NSImage *image;
>
NSRect myRect;
>
NSSize mySize;
>
>
image = [[NSImage imageNamed:@"mypict.jpg"] copy];
>
>
mySize = [image size];
>
>
myRect.origin.x = 0;
>
myRect.origin.y = 0;
>
myRect.size = mySize;
>
>
[image lockFocus];
>
[image drawInRect:[self bounds] fromRect:myRect
>
operation:NSCompositeCopy fraction:0.5];
>
[image unlockFocus];
>
}
Skip the lockFocus part and I think you should be fine...The focus should be
locked on the target. ie the screen saver view. That is done for you.
/ david