Hello,
I try to wait the end of the CImageEncoder conversion saving a bitmap. I want load it just after in order to verify if it well saved.
I wrote on my class:
TBool CCImageProcessor::Save(CFbsBitmap & aBitmap/*, RFs *aFs */)
{
TInt index = 0;
do
{
iNewFileName.Copy( iImagePath->Des() );
iNewFileName.Append( KImageFileNamePicture );
TBuf<K2FileNameIndexMaxLength> num;
num.Num( index );
iNewFileName.Append( num );
iNewFileName.Append(KbmpFileExtension);
iNewFileName.Append( K2pngFileExtension );
if ( !BaflUtils::FileExists( iEikEnv->FsSession(), iNewFileName ) )//verify if the name without the extension is allready used
break;
index ++;
} while ( 1 );
RFs* aFs =&(iEikEnv->FsSession());
const TFileName *aNewFilePathAndName = &iNewFileName;
if ( !iEncoder )
iEncoder = CImageEncoder::FileNewL(*aFs, *aNewFilePathAndName, KbmpMimeType, CImageEncoder::EOptionAlwaysThread);
// If it is not busy, start to do the conversion.
if ( !IsActive() )
{
iStatus=KRequestPending;
iEncoder->Convert( &iStatus, aBitmap );
SetActive();
iState=EConvertingImage;
return ETrue;
}
return EFalse;
}
And I test :
CCImageProcessor *imagep;
CFbsBitmap * offScreenBitmap;
CFbsBitmap * iLoadedBitmap;
I initialized each bitmap, created imagep object and i do :
imagep->Save(*offScreenBitmap);
User::WaitForRequest(imagep->iStatus);
imagep->LoadBitmap(iLoadedBitmap,0);
User::WaitForRequest(imagep->iStatus);
It can not Load the bitmap but I put a WaitForRequest...
Need help![]()



