How to display gif files

Login to reply to this topic.
Fri, 2004-11-05 13:05
Joined: 2004-11-05
Forum posts: 2
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

Wed, 2005-12-28 06:45
Joined: 2005-07-26
Forum posts: 81
Re: How to display gif files
Sad i'm facing the same problem dear..

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..!
Wed, 2005-12-28 10:18
Joined: 2005-08-04
Forum posts: 128
Re: How to display gif files
hi,
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
Wed, 2005-12-28 10:20
Joined: 2003-10-20
Forum posts: 35
Re: How to display gif files
Hi,
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

Tue, 2006-01-03 07:39
Joined: 2005-07-26
Forum posts: 81
Re: How to display gif files
But what is the exact way/method to animate a GIF image (not using cpalbimageviewerbasic). Ihad tried using the bmpmanip but i did not got any method.
Tue, 2006-01-03 08:08
Joined: 2005-08-04
Forum posts: 128
Re: How to display gif files
hi paul,

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
Tue, 2006-01-03 08:29
Joined: 2005-07-26
Forum posts: 81
Re: How to display gif files
ya thanks for replying sunny..

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.
Tue, 2006-01-03 08:59
Joined: 2003-10-20
Forum posts: 35
Re: How to display gif files
Why you don't want to use CPAlbImageViewerBasic class?

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

Tue, 2006-01-03 10:46
Joined: 2005-08-04
Forum posts: 128
Re: How to display gif files
hi paul,

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
Tue, 2006-01-03 11:30
Joined: 2005-07-26
Forum posts: 81
Re: How to display gif files
Guys you don't know but the fact is that CPAlbImageViewerBasic is a depricated class, and it is no longer supported in Series 60 3rd edition. Thats why i was asking for an alternate.
Wed, 2006-01-04 05:28
Joined: 2005-08-04
Forum posts: 128
Re: How to display gif files
hi paul,

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
Wed, 2006-01-04 05:55
Joined: 2005-07-26
Forum posts: 81
Re: How to display gif files
To make it easy for you people let me tell you one thing that most of the API are same in 2nd Edition and 3rd Edition. So if we are able to produce something using 2nd edition (provided it should not be using depricated API) it will definetely run on 3rd edition as well.

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).
  • Login to reply to this topic.