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.