Symbian Study Notes (5): Method for loading JPEG images

Source: Internet
Author: User
What I learned last time was to load images from the MIF and MBM files. Generally, this method can be used for all the images in the program, but with a little regret, it can only use the SVG or BMP format, most of the resources in brew or j2s are in PNG format.

If you want to use jpg or PNG images in Symbian, you need to use the class in the multimedia ICL library provided by Symbian. The cimagedecoder class is the most important one, providing the function of decoding images.

Let's see how to use it. Define two strings first:

_ Partition (kmeanfile, "C: // data // me.jpg ");
_ Partition (k1_type, "image/JPEG ");

The code used is relatively simple, as shown below:

IDEC = cimagedecoder: filenewl (IRFS, k1_file );

Iparent-> ibkimagemask = new (eleave) cfbsbitmap ();
Iparent-> ibkimagemask-> Create (IDEC-> frameinfo (). ioverallsizeinpixels, IDEC-> frameinfo (). iframedisplaymode );
IDEC-> convert (& istatus, * (iparent-> ibkimagemask ));

Here, IDEC is the cimagedecoder instance, while IRFS is The RFS instance. Iparent-> ibkimagemask is a cfbsbitmap object instance.

That is to say, we first use cimagedecorder: filenewl to open an image file (it will determine the image type by itself, and we can also provide it with the specified image type ). Then the information of this image is saved in IDEC-> frameinfo (). You can use this information to create a cfbsbitmap instance (because all the images displayed in Symbian are of this type ). Finally, call the asynchronous function convert of cimagedecorder to convert an image (in JPEG or PNG format) to a cfbsbitmap bitmap. The only trouble is that convert is an asynchronous function. The first parameter is the trequeststatus type (it can be an istatus member of an active object ).

In addition to cimagedecorder: filenewl, A cimagedecorder:; datanewl can also be used to construct image data from bytes in a buffer zone, but its second parameter is tdesc8 & type asourcedata.

[Supplement]

Do not forget to include the header file imageconversion. H, and imageconversion. Lib.

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.