Reading and displaying BMP files in Symbian

Source: Internet
Author: User

1 read:

First, we define the location of the bitmap to be read:

_ values (kmultibitmapfilename, "\ System \ apps \ graphics \ images. MBM ");

images. MDM is the compressed and packaged result of our bitmap file. It is a multi-bitmap file. We need to define the following in the. MMP file:

Start bitmap images. MBM

header

targetpath \ System \ apps \ graphics

sourcepath .. \ bitmaps

source C12 image1.bmp

source C12 image2.bmp

End

The system generates a Bitmap header file. mbg, which provides an access bitmap ID. For example, the images. mbg file in epoc32 \ include contains the following content:

Enum tmbmimages {

embmimagesimage1,

embmimagesimage2,

     };

Next we will define:

Cfbsbitmap * iimage1;

Cfbsbitmap * iimage2;

Then we can read the bitmap file in MDM:

Iimage1 = new (eleave) cfbsbitmap ();

cleanupstack: pushl (iimage1);

tint loadexception = iimage1-> load (kmultibitmapfilename, embmimagesimage1);

User: leaveiferror (loadexception );

Cleanupstack: Pop (iimage1 );

2 display:

Before display, remember to set the image display size:

Tsize asize (2000,200 0 );
Iimage1-> setsizeintwips (asize );

 

By using the drawbitmap () method, you can display the read or drawn bitmap in the window.

void drawbitmap (const tpoint & atopleft, const cfbsbitmap * asource)

here, atopleft specifies the coordinates in the upper left corner of the bitmap to be drawn, and asource gives the content of the bitmap to be drawn.

void drawbitmap (const trect & adestrect, const cfbsbitmap * asource)

draws the bitmap asource in the specified rectangle area adestrect.

void drawbitmap (const trect & adestrect, const cfbsbitmap * asource, const trect & asourcerect)

In the given bitmap asource, extract the asourcerect area and draw its content in the specified rectangle area adestrect.

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.