Adding bitmaps to your application (Part I): Creating a MBM file
24 Mar 2003 - 22:25
Keywords :

This short tutorial will explain how a Symbian application can access and display bitmaps. There is several ways to do it but we will only deal with the simplest one:
-  create some standard BMP files
-  construct a MBM file. MBM stands for Multi-BitMaps and is Symbian specific file format to hold bitmaps. A single MBM file can contain several bitmaps with different resolution and/or color-depth.
-  open it in the application

The MBM file is constructed as a part of the compilation process. So you have do declare an entry for it in the application's MMP file. The syntax for this is:
start bitmap target-file
[targetpath target-path ]
[header ]
[sourcepath source-path ]
source color-depth source-bitmap-list
end

target-file is the name of the file to generate with its MBM extension (e.g. sprites.mbm).

The targetpath primitive is optional. If it is specified, target-path is the location where the MBM file will be stored. If it is not specified, the application directory will be used.

If the header keyword is supplied, a .mbg header file will be generated in directory epoc32\include (e.g. sprites.mbg). This is sometimes useful since it automatically creates token IDs to adress each invidual bitmaps within the MBM.

sourcepath indicates the location of your original BMP files.

The source statement is used to specify the list of BMP files to write into the MBM. All the bitmaps within the statement shall have the same color-depth. The format for his specifier is [c]bit-depth where bit-depth is the number of bits per pixel and c indicates a color bitmap.

If you want to include files with different color-depth in a single MBM, you have to add several source statement. If you want to include files located in several directories in a single MBM, you need to add several sourcepath... source statements.

Example:

start bitmap sprites.mbm
header
sourcepath ..\bitmaps
source c8 ship.bmp bullet.bmp alien1.bmp alien2.bmp
end

If you need to create several MBM files, you need to use a start bitmap ... end declaration for each of your file.

Tutorial posted March 24th, 2003 by eric

Submitted by Anonymous on Wed, 2003-04-02 14:55.

Hi.

What are the possible values for the color depth parameter?

Regards, Vitor Fernandes


Submitted by BenK (not verified) on Thu, 2003-04-03 16:11.

I guess you can use c4, c8, c12 and probably c16 or c24. But I never tried these.

c8 is a safe and conservative choice since most (phone) devices have at least 256 colors.


Submitted by Nicholas (not verified) on Tue, 2003-05-06 11:57.

Using the Sendo Bitmap Converter makes it really easy to create, decompile MBM's, you can also set the colour depth. You will find it in the Tools & SDK Section.

Submitted by Anonymous on Tue, 2005-05-24 13:19.

hi,

i wanted to load the mbm file (as created above) into the programm and wanted to add the icons to listbox ?


Submitted by Anonymous on Tue, 2006-10-10 15:15.

Hello,Very Nice Article!!!

where the next???


Submitted by ranmaru (not verified) on Tue, 2004-08-24 10:29.

hi

i am still very new to Symbian OS C++. can you guide me through the way to upload a image on to the emulator and also the .cpp files that are needed.

i am using CodeWarrior v2.5, i seriously do not understand much.

Thanks a lot.

Regards

Ranmaru


Submitted by DeepBlueSystem (not verified) on Tue, 2005-02-22 08:33.

use the command ‘bmconv /hfilename.mbg filename.mbm [OPT]bmp_1 .... [OPT]bmp_n’ to create mbm/mbg file for example: :> bmconv /hAnkExMyApp.mbg AnkExMyApp.mbm /c12MyBMP_1.bmp /c12MyBMP_2.bmp /c12MyBMP_3.bmp /c8MyBMP_4.bmp

Submitted by Stanciu Lucian Daniel (not verified) on Mon, 2005-05-30 13:56.

Hello.

Nice article.

I have a question. I created an application that uses an MBM file. In the pkg i added the mbm file that is installed in the same directory with the application. It works fine for my Nokia 6600 but a friend from France can't use it. After installation, he runs the application and it closes immediately (i display a picture from the mbm file at startup).

Are there any security restrictions for file installations? Vodafone maybe?

Can i merge the mbm file in the rsc of the application?

Thank you, Lucian


Submitted by Anonymous on Wed, 2005-08-24 21:58.

Have you handled the possibility to install to mmc card also? If not, applicataion would work perfectly while installed on phone memory, but if on mmc, bitmap cannot be read from correct place and normally you would program Leave on that case. This might be why it's working with some phones (that have installed on phone) and failing on some (that have installed on mmc)

Harri


Submitted by Just venting... (not verified) on Fri, 2005-07-01 19:50.

Thanks a lot for the article. It helped a lot!...

I have a comment on Symbian tools. I was just shocked to know that files generated by the compilation process end up in the epoc32\include directory. That's the main SDK include directory.

I hate that the compilation for Symbian leaves files all over the place but, in the main include directory? Wacko!!!....

My two cents...



copyright 2003-2009 NewLC SARL