Derive your application container class from MPAlbAnimationObserver, and declare these
CPAlbImageViewerBasic* iViewer ;
void Notify( TAnimationEvent aEvent );
And, in your container,Animation method/function use this code. Dont forget to return count in CountComponentControls() and iViewer pointer in ComponetControl() methods.
iViewer = CPAlbImageViewerBasic::NewL(this,aRect);
iViewer->SetAnimationObserver(this,ETrue); //for looping
iViewer->LoadImageL(_L("c:\\nokia\\images\\anim.gif"),EColor4K);
iViewer->PlayAnimationL(); // support image and animation
Headers Required:
#include <ICLAnimationDataProvider.h> //CICLAnimationDataProvider
#include <BasicAnimation.h > //CBasicAnimation
Library Needed:
LIBRARY animation.lib //CICLAnimationDataProvider, CBasicAnimation
Source:
iGifFileDataprovider = new (ELeave) CICLAnimationDataProvider;
iGifFileDataprovider->SetFileL(iFsSession,_L("C:\\nokia\\images\\anim.gif"));
igifanimationconfig.iFlags = TAnimationConfig::ELoop;
igifanimationconfig.iData = 10000;
TPoint gifpoint = Position();
iGifAnimatior = CBasicAnimation::NewL(iGifFileDataprovider,gifpoint,CEikonEnv::Static()
->WsSession(),Window());
iGifAnimatior->Start(igifanimationconfig);
//In your Draw method
iGifAnimatior->Draw(gc);
Additional way showing GIF animation with image decoder API: Showing_GIF_animations
NOTE: basicanimattion.h is not available in 3rd edition MR release. ref: MR documentation
As of S60 3rd edition FP2 the APIs mentioned above won't play well GIFs with 20 frames per second. It will just play too slow because that framework can't deliver 20FPS apparently. I've been using GIFs with only 6.66FPS and they render quite nicely on the phone. It might be worth testing 10 or 15FPS too see if they play properly. You may find that different devices deliver different performance.
No related wiki articles found