×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    45

    Using CPAlbImageViewerBasic to display an animated gif works only the first time

    Hi,
    I'm using CPAlbImageViewerBasic in a control in my main container for a view to display an animated gif. My control is created in the second phase contructor of my container. After the container is constructed, I start the animation from my DoActivateL method of my view and it works great. But if I change the view to another one and then came back to first view, the animation will not work anymore, only the first frame is displayed. I mention that the objects are destructed properly (the container and the control with the CPAlbImageViewerBasic).
    I need help with this if somebody nows what might be the problem. Thanks a lot.

    Here is the control's code:

    //---------------------------waitctrl.h------------------------------------

    #include <coecntrl.h>

    // FORWARD DECLARATIONS
    class CPAlbImageViewerBasic;
    class MPAlbAnimationObserver;

    // CLASS DECLARATION

    /**
    * CWaitCtrl
    *
    */
    class CWaitCtrl : public CCoeControl
    {
    public: // Constructors and destructor

    /**
    * Destructor.
    */
    ~CWaitCtrl();

    /**
    * Two-phased constructor.
    */
    static CWaitCtrl* NewL(const CCoeControl& aParent, const TRect& aRect, const TDesC& aFileName);

    /**
    * Two-phased constructor.
    */
    static CWaitCtrl* NewLC(const CCoeControl& aParent, const TRect& aRect, const TDesC& aFileName);

    private:

    /**
    * Constructor for performing 1st stage construction
    */
    CWaitCtrl();

    /**
    * EPOC default constructor.
    * @param aRect Frame rectangle for container.
    * @param aFileName The file name for the wait image
    */
    void ConstructL(const CCoeControl& aParent, const TRect& aRect, const TDesC& aFileName);

    public: // New functions

    /**
    * Sets the animation observer
    */
    void SetAnimationObserver(MPAlbAnimationObserver* aObserver);
    /**
    * Starts viewing (playing) image.
    */
    void PlayL();

    void StopL();

    private: // Functions from base classes

    /**
    * From CoeControl,SizeChanged.
    */
    void SizeChanged();

    /**
    * From CoeControl,CountComponentControls.
    */
    TInt CountComponentControls() const;

    /**
    * From CCoeControl,ComponentControl.
    */
    CCoeControl* ComponentControl(TInt aIndex) const;

    /**
    * From CCoeControl,Draw.
    */
    void Draw(const TRect& aRect) const;

    private: //data

    /**
    * Image viewer.
    */
    CPAlbImageViewerBasic* iImageViewer;
    };

    //---------------------waitctrl.h end--------------------------------------

    //---------------------waitctrl.cpp----------------------------------------

    #include <PAlbImageViewerBasic.h>
    #include "WaitCtrl.h"

    CWaitCtrl::CWaitCtrl()
    {
    // No implementation required
    }


    CWaitCtrl::~CWaitCtrl()
    {
    delete iImageViewer;
    }

    CWaitCtrl* CWaitCtrl::NewLC(const CCoeControl& aParent, const TRect& aRect, const TDesC& aFileName)
    {
    CWaitCtrl* self = new (ELeave)CWaitCtrl();
    CleanupStack::PushL(self);
    self->ConstructL(aParent, aRect, aFileName);
    return self;
    }

    CWaitCtrl* CWaitCtrl::NewL(const CCoeControl& aParent, const TRect& aRect, const TDesC& aFileName)
    {
    CWaitCtrl* self=CWaitCtrl::NewLC(aParent, aRect, aFileName);
    CleanupStack::Pop(); // self;
    return self;
    }

    void CWaitCtrl::ConstructL(const CCoeControl& aParent, const TRect& aRect, const TDesC& aFileName)
    {
    SetContainerWindowL(aParent);
    SetRect(aRect);

    iImageViewer = CPAlbImageViewerBasic::NewL(this, Rect());
    iImageViewer->LoadImageL(aFileName, EColor4K);
    iImageViewer->ScaleOptimumL();

    ActivateL();
    }

    // ---------------------------------------------------------
    // CSplashScreenContainer::SizeChanged()
    // Called by framework when the view size is changed
    // ---------------------------------------------------------
    //
    void CWaitCtrl::SizeChanged()
    {
    // TODO: Add here control resize code etc.
    }

    // ---------------------------------------------------------
    // CSplashScreenContainer::CountComponentControls() const
    // ---------------------------------------------------------
    //
    TInt CWaitCtrl::CountComponentControls() const
    {
    return 1; // return nbr of controls inside this container
    }

    // ---------------------------------------------------------
    // CSplashScreenContainer::ComponentControl(TInt aIndex) const
    // ---------------------------------------------------------
    //
    CCoeControl* CWaitCtrl::ComponentControl(TInt aIndex) const
    {
    switch (aIndex)
    {
    case 0:
    return iImageViewer;
    default:
    return NULL;
    }
    }

    // ---------------------------------------------------------
    // CSplashScreenContainer:raw(const TRect& aRect) const
    // ---------------------------------------------------------
    //
    void CWaitCtrl:raw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear(aRect);
    }


    void CWaitCtrl::SetAnimationObserver(MPAlbAnimationObserver* aObserver)
    {
    if (iImageViewer->IsAnimation())
    {
    iImageViewer->SetAnimationObserver(aObserver, ETrue);
    }
    }

    void CWaitCtrl::PlayL()
    {
    if (iImageViewer->IsAnimation())
    {
    iImageViewer->PlayAnimationL();
    }
    }

    void CWaitCtrl::StopL()
    {
    iImageViewer->CancelAnimation();
    }

    //----------------------------waitctrl.cpp end-----------------------------

  2. #2
    Super Contributor
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704

    Re: Using CPAlbImageViewerBasic to display an animated gif works only the first time

    Hi,




    Code:
    void CWaitCtrl::StopL()
    {
    iImageViewer->CancelAnimation();
    iImageViewer->ReleaseImageLoader();
    iImageViewer->ReleaseMemoryAndVisibleBitmap();
    }
    Use the above code...

    Regards,
    eswar

  3. #3
    Regular Contributor
    Join Date
    Oct 2004
    Location
    Tokyo,Japan
    Posts
    289

    Question Re: Using CPAlbImageViewerBasic to display an animated gif works only the first time

    hi guys ,
    can i use these APIs on Symbian OS 9.1 and
    do i need any capabilities !

    kindly guide me !!!!!!



    Thanks & Regards
    NEo

Similar Threads

  1. How to load a specific frame in a animated gif ?
    By ronin101 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2005-05-24, 03:51
  2. Looping Animated GIF in MMS
    By culyerr in forum General Messaging
    Replies: 0
    Last Post: 2005-02-02, 10:21
  3. Animated GIF for MMS Specifications
    By handtap in forum General Messaging
    Replies: 2
    Last Post: 2003-08-22, 09:46
  4. animated gif and 7650
    By tbabben in forum General Messaging
    Replies: 1
    Last Post: 2002-10-14, 11:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×