Animated GIF (repost)
Animated GIF (repost)
- Subject: Animated GIF (repost)
- From: Sam McCandlish <email@hidden>
- Date: Thu, 26 Feb 2004 15:53:37 -0500
So does this mean I should:
- Make an NSBitmapImageRep
- Set the current frame
- Set other properties for the frame
- Draw the frame (this is the part I am having problems with)
- Repeat the last three steps until finished
- Write the NSBitmapImageRep to a file
Have I got this right?
Thanks!
Sam
On Feb 22, 2004, at 6:20 PM, Jens Bauer wrote:
Hi Sam,
On Sunday, Feb 22, 2004, at 23:43 Europe/Copenhagen, Sam McCandlish
wrote:
Is there a way to make an animated gif in Cocoa? If possible can you
make it using an NSImage?
Searching this archive (recent), I found this by Troy Stephens:
---8<-----8<-----8<-----
Does anyone know if it is possible to 'run' an animated gif without
the need for an NSImageView to contain it ? Or in the least be able
to test the gif image data to see if it contains animations or a
single frame ?
Yes. Once you've got the .gif loaded as an NSImage, search the
NSImage for an NSBitmapImageRep, then refer to the animated GIF
properties listed in the NSBitmapImageRep docs:
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSBitmapImageRep.html#//apple_ref/
occ/cl/NSBitmapImageRep
NSImageFrameCount tells you how many frames there are in the
animation. NSImageLoop count tells you whether the animation should
be looped, and, if so, how many times. Set NSImageCurrentFrame to the
index of a desired frame to cause it to be the frame you get when you
next draw the image. Add an NSTimer to the mix and you're ready to
animate! :-) (NSImageCurrentFrameDuration tells you how long the
current frame should be displayed.)
--->8----->8----->8-----
Love,
Jens
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.