Symbian OS not only native support bitmap bitmap, but also can use Cimagedecoder class to encode and decode jpeg/gif/png type of image.
Cimagedecoder can be created from a file or created from a descriptor, see the SDK for a specific method of creation.
Cimagedecoder to be used in conjunction with active objects, the method used is simple:
void CImageHelper::LoadPngImageL(TDesC& aFileName, CFbsBitmap* aBitmap, CFbsBitmap* aBitmapMask)
{
if (iImgDecoder)
{
iImgDecoder->Cancel();
delete iImgDecoder;
iImgDecoder = NULL;
}
// 获取图片
iImgDecoder = CImageDecoder::FileNewL(iFs, aFileName, KMIMEType);
TSize size = iImgDecoder->FrameInfo().iOverallSizeInPixels;
TDisplayMode mode = iImgDecoder->FrameInfo().iFrameDisplayMode;
// 创建位图
User::LeaveIfError(aBitmap->Create(size, mode));
User::LeaveIfError(aBitmapMask->Create(size, EGray256));
// 调用转换异步函数
iStatus = KRequestPending;
iImgDecoder->Convert(&iStatus, *aBitmap, *aBitmapMask);
SetActive();
iActiveSchedulerWait->Start();
}
Among them, Kmimetype is the MIME type of image file, corresponding JPEG, GIF, PNG is Image/jpeg, Image/gif, image/png respectively.
This article supporting source code