Symbian Programming Summary-Graphic image chapter-Open a bitmap type of image

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.