|
|
User login
Feeds |
How to display gif files
|
|||||
| Fri, 2004-11-05 13:05 | |
|
Hi All,
I get mad trying to display the gif files. Can any one pls help me out thete. This is what I had done to display the gif file: It is all about the CPAlbImageViewerBasic class, I know. That is, what I tried: * Step 1: // Place this line in the header file of your view or container CPAlbImageViewerBasic* iViewer; * My try 1: I chose the 'helloworldappview.h' header and put it right at the beginning of the 'class CHelloWorldAppView : public CCoeControl' definition. * Step 2: // Place this line in the contructor of your view or container iViewer=CPAlbImageViewerBasicNewL(this,Rect()); iViewer->SetAnimationObserver(this,ETrue); * My try 2: I put this into the construct function 'void CHelloWorldAppView::ConstructL(const TRect& aRect)' in 'helloworldappview.cpp'. * Step 3: // Call this to load and display every image you want iViewer->LoadImageL(_L("C\\Nokia\\Images\\Example.gif"),EColor4K); iViewer->PlayAnimationL(); // support image and animation * My try 3: I put this into the draw function 'void CHelloWorldAppView::Displaygif()' in 'helloworldappview.cpp' * Step 5: // Derive your view or container class from MPAlbAnimationObserver * My try 5: I put 'class MPAlbAnimationObserver' into the 'helloworlddocument.h' by extending the forward references right at the beginning. * Step 6: // Implement or override the following in your view or container class void Notify(TAnimationEvent aEvent) * My try 6: I did not put this anywhere, as 'notify events' is already contained in 'PAlbImageViewerBasic.h'. * Step 7: // Include this header file Palbimageviewerbasic.h * My try 7: I put '#include "Palbimageviewerbasic.h"' into 'helloworld.cpp'. * Step 8: // Link against this library Palbview.lib * My try 8: I extended the list in 'helloworld.mmp' with 'LIBRARY Palbview.lib'. Then When I run this Application no picture comes. I had checked the path of the file also. But all in vain. Pls tell me what is missing. Thank Jassi |
|
Forum posts: 81
can any body help me out..?
I know this thread is very old.. but this is good as some of you may have faced this issue, n should have a resolution for it..
Please post your comments..!
Forum posts: 128
do u want to display animate gif or just a static gig image. there is an example in
c:\symbian\7.0s\series60_v20_cw\Series60Ex\bmpmanip
it uses a gif image and does many operations on it, like
rotation, scaling,saving to bitmap etc.
bye
sunny
Forum posts: 35
you can use ICL library to convert gif.
Derive from CActive your decoder class, and create a CImageDecoder as follow
LoadBitmapL()
{
iLoadUtil = CImageDecoder::FileNewL( CEikonEnv::Static()->FsSession(), iFileName));
// start reading the bitmap: RunL called when complete
iLoadUtil->Convert(&iStatus, *iBitmap, iPage));
SetActive();
}
When RunL completes the decoded image is stored in iBitmap. iPage is the number of the frame you want to decode.
hope this helps,
fab
I often regret my speech, I never regret my silence
Forum posts: 81
Forum posts: 128
first of all u have to be precise
animating a gif (i.e. moving image on screen) and playing an animated gif are both different things.
and just showing a gif image (.gif without any animation) is also different thing.
so if u want to just show a .gif file without any animation then you have to convert it into bmp and then only you can blit it on the screen. to do so there is an example in sdk as i told u.
but to play a gif animation there is another method.
so be clear what u want to do.
bye
sunny
Forum posts: 81
i had already shown a .gif file without any animation by converting it into bmp.
but the thing i want is to play the animation i.e. to display the animated GIF.
Forum posts: 35
You can play animated gif in an easy way
iImage = CPAlbImageViewerBasic::NewL(this, TRect(TPoint(0,0),TSize(rect.Width(),rect.Height())) );
iImage->SetImageNameAndDisplaymodeL(nameGif ,CEikonEnv::Static()->DefaultDisplayMode());
iImage->SetAnimationObserver ( this, ETrue);
iImage->LoadImageL();
iImage->ScaleOptimumL();//FreeScaleL( TSize(80,80) , EFalse);
if(iImage->IsAnimation())
iImage->PlayAnimationL();
I often regret my speech, I never regret my silence
Forum posts: 128
i too used the same method as told by fabriz.
void CMultiViewsContainer4::ConstructL(const TRect& aRect)
{
CreateWindowL();
iImage = CPAlbImageViewerBasic::NewL(this,TRect(TPoint(15,15),TSize(aRect.Width()-30,aRect.Height()-30)));
iImage->SetAnimationObserver(this,ETrue);
iImage->SetImageNameAndDisplaymodeL(_L("c:\\test.gif"),CEikonEnv::Static()->DefaultDisplayMode());
  SetRect(aRect);
  ActivateL();
  DoTest();
}
void CMultiViewsContainer4::DoTest()
{
iImage->LoadImageL();
if(iImage->IsAnimation())
iImage->PlayAnimationL();
}
void CMultiViewsContainer4::Notify(TAnimationEvent aEvent)
{
switch(aEvent)
{
case EAnimationStarted:
break;
case EAnimationPlayed:
iImage->PlayAnimationL();
break;
case EAnimationCancelled:
break;
default:
User::Panic(_L("AnimationEvent"),KErrNotSupported);
}
}
TInt CMultiViewsContainer4::CountComponentControls() const
{
  return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CMultiViewsContainer4::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CMultiViewsContainer4::ComponentControl(TInt aIndex) const
{
 return iImage;
}
//extended class like this-i don't remember why i used MCoeControlObserver
class CMultiViewsContainer4 : public CCoeControl, MCoeControlObserver, MPAlbAnimationObserver
bye
sunny
Forum posts: 81
Forum posts: 128
i know about it, but i don't have the 3rd edition. i am still working in 2nd edition. so i don't know any alternative solution. may be somebody else can help u.
bye
sunny
Forum posts: 81
And i think its not too difficult to display the animated GIF i.e. to play the GIF image in 2nd edition (But not using CPAlbImageViewerBasic, as it is a depricated API).