×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jan 2010
    Location
    Pune Maharashtra India
    Posts
    34

    [moved] HOw to display image file on symbian s60 3rd edition phone

    I just want to display the image on the s60 3rd phone. But cant be able to do that

    First of all I am converting the jpeg image to bitmap file & then try to show it.

    But Since I am decoding the image using CImageDecoder::FileNewL but this call always fails,

    Please Help me.

    I am using following code snippet

    iDecoder = CImageDecoder::FileNewL(iFs,aFileName,CImageDecoder::EOptionAlwaysThread,KNullUid,KNullUid,KNullUid);
    iFrame = NULL;
    iFrame = new(ELeave)CFbsBitmap();
    iFrame->Create(iDecoder->FrameInfo(0).iOverallSizeInPixels,iImageDecoder->FrameInfo(0).iFrameDisplayMode);

    iDecoder->Convert(&iStatus,*iFrame,0);

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HOw to display image file on symbian s60 3rd edition phone

    How does it Fail ? have you already checked wiki for complete examples ?

  3. #3
    Registered User
    Join Date
    Jan 2010
    Location
    Pune Maharashtra India
    Posts
    34

    Re: HOw to display image file on symbian s60 3rd edition phone

    ya I have checked the various examples but,

    every examples only give two arguments to the function

    FileNewL(CCoeEnv::Static()->FsSession(),aFileName,ImageType);

    then it gives an error as ambiguous access to overloaded function

    I cant be able to overcome this.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HOw to display image file on symbian s60 3rd edition phone

    The wiki examples should have the variable right, so can you check it again, also check SDK docs (or header) for variables and their types and try using the correct ones when calling the function.

  5. #5
    Registered User
    Join Date
    Jan 2010
    Location
    Pune Maharashtra India
    Posts
    34

    Re: HOw to display image file on symbian s60 3rd edition phone

    I have tried it

    is there any other way to display the jpeg image directly without converting it to bitmap

    Help me

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HOw to display image file on symbian s60 3rd edition phone

    No other way really, anyway, the examples should work, so you should be able to get it working as well. So Can you try checking the examples, and then if you still have problems, please explain them in detail.

  7. #7
    Registered User
    Join Date
    Jan 2010
    Location
    Pune Maharashtra India
    Posts
    34

    Re: HOw to display image file on symbian s60 3rd edition phone

    Ok I will give details,

    First of all I have used the CImageDecoder::FileNewL(RFs,SourceFileName);

    but It gives me an error as ambiguous access to overloaded function as a compilation error.

    Then I have changed that call as

    CImageDecoder::FileNewL(FileSess,aFileName,CImageDecoder::EOptionNone,KNullUid,KNullUid,KNullUid);

    where FileSess is RFs,
    aFileName is sourcefilename.

    then it successfully compiled,

    after that when I execute that program it exits with status -3

    exit status -3 means the "an operation that has been cancelled"

    now what to do

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HOw to display image file on symbian s60 3rd edition phone

    In which point does it exit ?, as well as what is the error note excatly saying ? Also please add delete iFrame before setting it to NULL, othervise you could end up leaking memory.

  9. #9
    Registered User
    Join Date
    Jan 2010
    Location
    Pune Maharashtra India
    Posts
    34

    Re: [moved] HOw to display image file on symbian s60 3rd edition phone

    ya It gives following error

    <terminated, exit value: 3>C:\Symbian\S60_3rd_FP2_Beta\epoc32\release\winscw\udeb\HTTPClientExample.exe (4/19/10 2:18 PM)

  10. #10
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: [moved] HOw to display image file on symbian s60 3rd edition phone

    I'm almost certain that it is not -3 panic, anyway, can you try the code's from the example without too much modifications, for exmaple gif reader would be fine: http://wiki.forum.nokia.com/index.ph...Symbian_bitmap

    And debug and see what line gets called last. As well as you could also try using TRAPs for getting the leave error values.

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: [moved] HOw to display image file on symbian s60 3rd edition phone

    +3 and -3 are totally different. If you have "3", that is probably a KERN-EXEC 3, you can check it via enabling the error messages: http://wiki.forum.nokia.com/index.ph...ded_panic_code

  12. #12
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: [moved] HOw to display image file on symbian s60 3rd edition phone

    Use this:
    Code:
    /*
     * cloadimage.cpp
     *
     *  Created on: 09.02.2009
     *      Author: TAMHAN
     */
    
    #include "mobilepaint/cloadimage.h"
    
    #include "LocaNotePaint.h"
    
    CLoadImage* CLoadImage::NewL(MLoadImageObserver* iContainer)
        {
        CLoadImage* self = CLoadImage::NewLC(iContainer);
        CleanupStack::Pop (self );
        return self;
        }
    
    CLoadImage* CLoadImage::NewLC(MLoadImageObserver* iContainer)
        {
        CLoadImage* self = new ( ELeave ) CLoadImage();
        CleanupStack::PushL (self );
        self->iContainer=iContainer;
        self->ConstructL();
        self->iBackBufferRotator=NULL;
        self->iImageDecoder=NULL;
        return self;
        }
    
    CLoadImage::~CLoadImage()
       {
    	Cancel();
        if(iImageDecoder!=NULL)
        {
        	delete iImageDecoder;
        	iImageDecoder=NULL;
        }
        	iFs.Close();
        	
        if(iBackBufferRotator)
        {
        	delete iBackBufferRotator;
        	iBackBufferRotator=NULL;
        }
       }
    
    void CLoadImage::LoadAndRotateL(CFbsBitmap* aBitmap, TFileName& aFileName)
    {
    	if (!IsActive())
    	{
    		if (iImageDecoder)
    		{
    			delete iImageDecoder;
    			iImageDecoder = NULL;
    		}
    
    		targetBitmap=aBitmap; //persist bitmap
            localBitmap = new (ELeave) CFbsBitmap;
    		iImageDecoder = CImageDecoder::FileNewL(iFs, aFileName);
            
    		localBitmap->Create(iImageDecoder->FrameInfo().iOverallSizeInPixels,EColor64K);
            
    		iImageDecoder->Convert(&iStatus, *localBitmap);
    		SetActive();
    	}
    }
    
    void CLoadImage::RotationCompletedL(TInt /*aError*/)
    {
    	TSize bmpSize = localBitmap->SizeInPixels();
    	
    	int scanLineLength = CFbsBitmap::ScanLineLength( bmpSize.iWidth, EColor4K );
    	   
    	if (targetBitmap && targetBitmap->DataAddress() )
    	{
    	   memcpy( (void*)targetBitmap->DataAddress(), (void*)localBitmap->DataAddress(), scanLineLength * bmpSize.iHeight );
    	}
    	
    	delete localBitmap;
    	if(iBackBufferRotator)
    	{
    		delete iBackBufferRotator;
    		iBackBufferRotator=NULL;
    	}
    	localBitmap=NULL;
    	this->RunL();
    
    }
    
    void CLoadImage::ArmL(CFbsBitmap* aBitmap, TFileName& aFileName)
    {
    myBitmap=aBitmap;
    myFileName=aFileName;
    }
    
    void CLoadImage::LoadL()
        {
    	if(myBitmap!=NULL && myFileName.Length()>3)
        LoadL(myBitmap,myFileName);
        }
    
    
    void CLoadImage::LoadL(CFbsBitmap* aBitmap, TFileName& aFileName)
        {
        if (!IsActive())
            {    
            if (iImageDecoder)
                {
                delete iImageDecoder; 
                iImageDecoder = NULL;
                }
    		
    			localBitmap=NULL; //Just in case
    			iImageDecoder = CImageDecoder::FileNewL( iFs, aFileName);
    			iImageDecoder->Convert( &iStatus, *aBitmap);
    			SetActive();
            }
        }
    
    void CLoadImage::DoCancel()
        {
    	if(iBackBufferRotator!=NULL && iBackBufferRotator->IsActive())
    	{
    		iBackBufferRotator->Cancel();
    	}
    	if(iImageDecoder)
    	iImageDecoder->Cancel();
    	//cleanup moved to destructor
        }
    
    void CLoadImage::RunL()
        {
       //call iObserver - called when done
    	if(localBitmap==NULL)
    	{
    		iContainer->ImageLoaded();
    	}
    	else
    	{//rotate and call observer from there
    		if(localBitmap->SizeInPixels()==targetBitmap->SizeInPixels())
    		{
    			this->RotationCompletedL(KErrNone);
    		}
    		else
    		{
    		iBackBufferRotator=CBitmapRotatorAO::NewL(this);
    	    if (localBitmap->SizeInPixels().iWidth < localBitmap->SizeInPixels().iHeight)
    	        {
    	        iBackBufferRotator->Rotate(CBitmapRotator::ERotation270DegreesClockwise,localBitmap);
    	        }
    	    else
    	        {
    	        iBackBufferRotator->Rotate(CBitmapRotator::ERotation90DegreesClockwise,localBitmap);
    	        }
    		}
    	}
    	}
    
    TInt CLoadImage::RunError(TInt /*aError*/)
        {
        //This call must ALWAYS be here as it is needed to "chain" the AO execution
    	//see more in the ListView ImageLoaded routine
    	iContainer->ImageLoaded();
        return KErrNone;
        }
        
    void CLoadImage::ConstructL()
        {
    	this->localBitmap=NULL;
        CActiveScheduler::Add(this);
        User::LeaveIfError( iFs.Connect() );
        }
    
    CLoadImage::CLoadImage(): CActive(EPriorityStandard)
        {
        }
    
    void CLoadImage::GetEncoderImageTypesL( 
        RImageTypeDescriptionArray& aImageTypeArray )
        {
        CImageEncoder::GetImageTypesL( aImageTypeArray );
        }
    
    TBool CLoadImage::INRI()
    {//when Jesus christ died, he said INRI. So does CLoadImage
     if(iImageDecoder!=NULL)
    	 return false;
     else
    	 return true;
    }
    header

    Code:
    // INCLUDES
    #ifndef CLOADIMAGE_H
    #define CLOADIMAGE_H
    
    #include <aknappui.h>
    #include <aknutils.h>
    #include <ImageConversion.h>
    #include "mobilepaint/cbitmaprotatorao.h"
    #include "prefs/LocaNoteGeneric.h"
    
    class CLocaNotePaint;
    
    
    class MLoadImageObserver
        {
        public:
            virtual void ImageLoaded()=0;
        };
    
    
    class CLoadImage : public CActive, MBitmapRotatorObserver
        {
        public:
            static CLoadImage* NewL(MLoadImageObserver* iContainer);
            static CLoadImage* NewLC(MLoadImageObserver* iContainer);
            virtual ~CLoadImage();
    
        public:
        	void LoadL(CFbsBitmap* aBitmap, TFileName& aFileName);
        	void ArmL(CFbsBitmap* aBitmap, TFileName& aFileName);
        	void LoadL();
            void DoCancel();
            void RunL();
            TInt RunError(TInt aError);
            void GetEncoderImageTypesL(RImageTypeDescriptionArray& aImageTypeArray);
            TBool INRI();
            void LoadAndRotateL(CFbsBitmap* aBitmap, TFileName& aFileName);
            
        private:
            void ConstructL();
            CLoadImage();
         
        //Darn MBitmapRotatorObserver    
        private:
        	void RotationCompletedL(TInt aError);
        	
        public:
        	//Must be public as the bitmap must be scaled when done by the handler
            CFbsBitmap* myBitmap;
            
        private:
            CImageDecoder*          iImageDecoder;
            CBitmapRotatorAO* iBackBufferRotator;
            CFbsBitmap* targetBitmap;
            CFbsBitmap* localBitmap;
            RFs                     iFs;
            MLoadImageObserver*         iContainer;
            
            TFileName myFileName;
            
            };
    
    #endif
    I am very successful with that on PNG files.
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

Similar Threads

  1. Replies: 0
    Last Post: 2009-07-27, 08:35
  2. Replies: 4
    Last Post: 2009-04-26, 07:27
  3. Replies: 35
    Last Post: 2009-04-11, 14:36
  4. SyncML OMA setting for symbian S60 3rd edition
    By ewawong in forum OMA DM/DS/CP
    Replies: 0
    Last Post: 2007-01-08, 06:09

Posting Permissions

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