loading multiple images problem using CMdaImageFileToBitmapUtility
| Fri, 2006-11-10 14:12 | |
|
hi there,
i'm having problem on loading multiple images using CMdaImageFileToBitmapUtility since it works asynchronously. i have search in this forum and still havent found the answer. some of the post, using CActiveScheduler. still confuse on how to use that class. any clue? or maybe u can post ur snippet code? Thanks, Ronald |
|






Forum posts: 672
Can't you start loading a new bitmap when the previous is loaded?
Forum posts: 25
thx for the reply.
below is some part of my codes
{
TBuf<50> temp,temp2;
temp.Copy(_L("c:\\loadbitmap\\tempImageJ90001"));
temp2.Copy(_L("c:\\loadbitmap\\tempImageJ90002"));
if(iPathTempCover){delete iPathTempCover;iPathTempCover=NULL;}
iPathTempCover = new (ELeave) CArrayFixFlat<TFile> (1);
TFile a;
a.iBufferPath.Zero();
a.iBufferPath.Copy(temp);
iPathTempCover->AppendL(a);
a.iBufferPath.Zero();
a.iBufferPath.Copy(temp2);
iPathTempCover->AppendL(a);
iIndexLoadCoverPlaylist = 0;
//for(TInt i=0; i<iPathTempCover->Count(); i++)
{
//iEikonEnv->InfoWinL(_L("path"),(*iPathTempCover)[iIndexLoadCoverPlaylist].iBufferPath);
iFileBitmapLoader->OpenL((*iPathTempCover)[iIndexLoadCoverPlaylist].iBufferPath);
}
}
void CLoadmultibmpContainer::MiuoCreateComplete(TInt /*aError*/)
{
}
void CLoadmultibmpContainer::MiuoOpenComplete(TInt aError)
{
if (aError == KErrNone)
{
iConvertState = EConvertStateConvertingFromGif;
TFrameInfo frameInfo;
iFileBitmapLoader->FrameInfo(0,frameInfo);
//Create a bitmap based on the size of the gif
if (iCoverAlbum){delete iCoverAlbum;iCoverAlbum = NULL;}
iCoverAlbum = new(ELeave) CFbsBitmap();
TInt err = iCoverAlbum->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
if (err == KErrCouldNotConnect)
{
iEikonEnv->InfoWinL(_L("KErrCouldNotConnect"),_L(""));
return;
}
if (err == KErrArgument)
{
iEikonEnv->InfoWinL(_L("KErrArgument"),_L(""));
return;
}
TRAPD(convertErr,iFileBitmapLoader->ConvertL(*iCoverAlbum,0));
if (convertErr != KErrNone)
{
iEikonEnv->InfoWinL(_L("!KErrNone"),_L(""));
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);
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);
iFileBitmapLoader->Close();
iIndexLoadCoverPlaylist++;
if(iIndexLoadCoverPlaylist == iPathTempCover->Count())
{
if (iTempCover->Count() > 0)
{
iDrawState = EDrawList;
DrawNow();
}
else
{
iDrawState = EDrawMain;
DrawNow();
}
}
else
{
iFileBitmapLoader->OpenL((*iPathTempCover)[iIndexLoadCoverPlaylist].iBufferPath);
}
}
else
{
iEikonEnv->InfoWinL(_L(""),_L("Error converting file"));
}
}
when i use that codes, it works, but the image to be drawn is same "tempImageJ90002" (the latter) for both iTempCover array.
maybe that connected to the async problem.
any idea how to solve it?
Ronald
Forum posts: 672
This should be correct. Counters seem to be used correctly too.
Have you placed brakepoints at the beginning of each function to see what really happens? I cannot suggest anything else than just to debug to see what goes wrong, since I cannot see anything in the code.
Forum posts: 25
i just did what u've told. the index is correct. dunno what went wrong.
is it something related to CActiveScheduler? any idea?
Ronald
Forum posts: 25
rite now i can load 2 different images. but instead of using the same iCoverAlbum, i create 2 CFbsBitmap* variable to save the image of temp and temp2 and then append it to the array. so i guess the code went wrong when using the same CFbsbitmap* variable to save the different image. any idea why this is happen?
below is some of my snippet code
{
...
TInt err;
if(iIndexLoadCoverPlaylist == 0)
{
err = iDrawList3a->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
}
if(iIndexLoadCoverPlaylist == 1)
{
err = iDrawList3b->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
}
...
}
void CLoadmultibmpContainer::ConvertingFromGifFinished(TInt aError)
{
...
if(iIndexLoadCoverPlaylist == 0)
{
iTempCover->AppendL(*iDrawList3a);
}
if(iIndexLoadCoverPlaylist == 1)
{
iTempCover->AppendL(*iDrawList3b);
}
...
}
the problem is i dont know how many files to be load. so it cant work this way. plz help andreas/anyone...
-Ronald
Forum posts: 66
I am not sure, but you can try Reset();
Regards
Forum posts: 25
thx for the reply, but Reset() is not working.
i use watch to debug. the Value of iCoverAlbum is always the same.
-Ronald