×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    130

    load multiple images using 1 CFbsBitmap variable result in same image

    hi there,

    i have problem when load multiple images using only one variable CFbsBitmap as temporary before append it to array. the problem is solved when using multiple CFbsBitmap variables, but i dont know how many images to be loaded.

    below is snippet of my codes (with fixed number of images to be loaded):
    Code:
    void CLoadmultibmpContainer::startLoadFile()
    {
    	TBuf<50> temp, temp2, temp3;
    	temp.Zero();
    	temp.Copy(_L("c:\\loadbitmap\\tempCoverJ90001"));
    	temp2.Zero();
    	temp2.Copy(_L("c:\\loadbitmap\\tempCoverJ90002"));
    	temp3.Zero();
    	temp3.Copy(_L("c:\\loadbitmap\\tempCoverJKKTU"));
    	
    	if(iPathTempCover){delete iPathTempCover;iPathTempCover=NULL;}
    	iPathTempCover = new (ELeave) CArrayFixFlat<TRonald> (1);
    
    	if (iTempCover){delete iTempCover;iTempCover=NULL;}
    	iTempCover= new (ELeave) CArrayFixFlat<CFbsBitmap>(1);
    
    	TRonald a,b,c;
    	a.iSongPath.Zero();
    	a.iSongPath.Copy(temp);
    	iPathTempCover->AppendL(a);
    
    	b.iSongPath.Zero();
    	b.iSongPath.Copy(temp2);
    	iPathTempCover->AppendL(b);
    
    	c.iSongPath.Zero();
    	c.iSongPath.Copy(temp3);
    	iPathTempCover->AppendL(c);
    	
    	iIndexLoadCoverPlaylist = 0;
    
    	for(TInt i=0; i<iPathTempCover->Count(); i++)
    	{
    		iFileBitmapLoader->OpenL((*iPathTempCover)[iIndexLoadCoverPlaylist].iSongPath);
    		CActiveScheduler::Start();
    	}
    }
    
    void CLoadmultibmpContainer::MiuoCreateComplete(TInt /*aError*/)
    {
    }
    
    void CLoadmultibmpContainer::MiuoOpenComplete(TInt aError)
    {
    	if (aError == KErrNone)
    	{
    		iConvertState = EConvertStateConvertingFromGif;
    		
    		TFrameInfo frameInfo;
    		iFileBitmapLoader->FrameInfo(0,frameInfo);
    		
    		TInt err;
    		
    		/*//////////////////using 1 CFbsBitmap variable////////////////////////
    		//Create a bitmap based on the size of the gif
    		if (iCoverAlbum){delete iCoverAlbum;iCoverAlbum = NULL;}
    		iCoverAlbum = new(ELeave) CFbsBitmap();
    		err = iCoverAlbum->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);*/
    		
    		/////////////////using 2 or more CFbsBitmap variable////////////////////
    		if(iIndexLoadCoverPlaylist == 0)
    		{
    			err = iDrawList3a->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
    		}
    		else if(iIndexLoadCoverPlaylist == 1)
    		{
    			err = iDrawList3b->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
    		}
    		else if(iIndexLoadCoverPlaylist == 2)
    		{
    			err = iDrawList3c->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
    		}
    
    		if (err == KErrCouldNotConnect)
            	{
    			iEikonEnv->InfoWinL(_L("KErrCouldNotConnect"),_L(""));
    			//CActiveScheduler::Stop();
    			return;
    	        }
    	        if (err == KErrArgument)
    	        {
    			iEikonEnv->InfoWinL(_L("KErrArgument"),_L(""));
    			//CActiveScheduler::Stop();
    			return;
    	        }
    		
    		/* //using 1 CFbsBitmap variable
    		TRAPD(convertErr,iFileBitmapLoader->ConvertL(*iCoverAlbum,0));	
    		if (convertErr != KErrNone)
    		{
    			iEikonEnv->InfoWinL(_L("!KErrNone"),_L(""));
    			//CActiveScheduler::Stop();
    			return;
    		}*/
    
    		///////////////using 2 or more CFbsBitmap variable//////////////
    		if(iIndexLoadCoverPlaylist == 0)
    		{
    			TRAPD(convertErr,iFileBitmapLoader->ConvertL(*iDrawList3a,0));
    			if (convertErr != KErrNone)
    			{
    				iEikonEnv->InfoWinL(_L("!KErrNone"),_L(""));
    				//CActiveScheduler::Stop();
    				return;
    			}
    		}
    		else if(iIndexLoadCoverPlaylist == 1)
    		{
    			TRAPD(convertErr,iFileBitmapLoader->ConvertL(*iDrawList3b,0));
    			if (convertErr != KErrNone)
    			{
    				iEikonEnv->InfoWinL(_L("!KErrNone"),_L(""));
    				//CActiveScheduler::Stop();
    				return;
    			}
    		}
    		else if(iIndexLoadCoverPlaylist == 2)
    		{
    			TRAPD(convertErr,iFileBitmapLoader->ConvertL(*iDrawList3c,0));
    			if (convertErr != KErrNone)
    			{
    				iEikonEnv->InfoWinL(_L("!KErrNone"),_L(""));
    				//CActiveScheduler::Stop();
    				return;
    			}
    		}
    	}
    
    	else if (aError == KErrUnderflow)
    	{
    		iEikonEnv->InfoWinL(_L("KErrUnderflow"),_L(""));
    		//TRAPD(err,iFileBitmapLoader->OpenL(iDescCoverAlbum->Des()));
    		//TRAPD(err,iFileBitmapLoader->OpenL(_L("c:\\loadbitmap\\tempCover")));
    		return;	
    	}
    	else
    	{
    		TBuf<10> temp;
    		temp.Format(KNumber,aError);
    		iEikonEnv->InfoWinL(_L("other error"),temp);
    		//CActiveScheduler::Stop();
    		return;	
    	}
    }
    
    void CLoadmultibmpContainer::MiuoConvertComplete(TInt aError)
    {
    	switch (iConvertState)
    	{
    		//Finished converting gif file to bitmap
    		case EConvertStateConvertingFromGif:
    			ConvertingFromGifFinished(aError);
    			break;
    		case EConvertStateNull:
    		default:
    			ASSERT(FALSE);
    	}
    }
    
    //This function is called when conversion has finished
    void CLoadmultibmpContainer::ConvertingFromGifFinished(TInt aError)
    {
    	if (aError == KErrNone)
    	{	
    		iConvertState = EConvertStateReady;
    
    		//iTempCover->AppendL(*iCoverAlbum);	//using 1 CFbsBitmap variable
    		
    		//////using 2 or more CFbsBitmap var//////////
    		if(iIndexLoadCoverPlaylist == 0)
    		{
    			iTempCover->AppendL(*iDrawList3a);
    		}
    		if(iIndexLoadCoverPlaylist == 1)
    		{
    			iTempCover->AppendL(*iDrawList3b);
    		}
    		if(iIndexLoadCoverPlaylist == 2)
    		{
    			iTempCover->AppendL(*iDrawList3c);
    		}
    
    		CActiveScheduler::Stop();
    		
    		iIndexLoadCoverPlaylist++;
    		if(iIndexLoadCoverPlaylist == iPathTempCover->Count())
    		{
    			if (iTempCover->Count() > 0)
    			{
    				iDrawState = EDrawList;
    				DrawNow();
    			}
    			else 
    			{
    				iDrawState = EDrawMain;
    				DrawNow();
    			}
    		}
    	}
    	else
    	{
    		iEikonEnv->InfoWinL(_L(""),_L("Error converting file"));
    	}
    }
    u can find 2 ways in my codes above
    1. //using 1 CFbsBitmap variable// --> only using one var as temp but the result is all the image to be shown is same (the last image i.e. tempCoverJKKTU)
    2. //using 2 or more CFbsBitmap variable// --> in this example, i'm using 3 different var. the result is correct. but like i said, i dont know how many images to be loaded.

    any clue?

    PS: i'm using CMdaImageFileToBitmapUtility class

    -Ronald

  2. #2
    Regular Contributor
    Join Date
    May 2006
    Posts
    271

    Re: load multiple images using 1 CFbsBitmap variable result in same image

    Hai Rx-lee,
    use CGulIcon class,like this
    CArrayPtr< CGulIcon > *aIcons
    aIcons->Append();
    here u append all icons once u see the in grid exmple they append all icons in the array(LoadBitIcons() method) it may help for u.

Similar Threads

  1. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  2. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  3. saving jpeg image on grid list
    By flicker82 in forum Symbian C++
    Replies: 0
    Last Post: 2005-01-21, 04:22
  4. image failed to load
    By killarkai in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2003-07-25, 13:07
  5. how to extract multiple images from Single Image File
    By memphis_ in forum Mobile Java General
    Replies: 2
    Last Post: 1970-01-01, 02:00

Posting Permissions

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