Cocoa resize NSImage while preserving animation
is there a way to resize a NSImage
(animated gif) and preserve the animation?
I want to make the animated gif with 512x256px size, fit a rect of 256x256px.
[newImage lockFocus];
[animatedGif drawInRect:newRect
fromRect:NSMakeRect(0.0f, 0.0f, self.size.width, self.size.height)
operation:NSCompositeCopy
fraction:1.0f];开发者_JAVA百科
[newImage unlockFocus];
I would save the first picture of the animated gif. When you are going to resize the NSImage, just draw the first image of the animation.
I hope I understood your question correctly.
perhaps you can animate it manually with a timer which shows every 0.1 second another frame?
精彩评论