Tech Note 04a: Using ResIn on Color Bitmaps

May 01, 2008

© NSB Corporation. All rights reserved.



It is easy to display color bitmaps in NS Basic/Symbian OS programs.

First, a bit of background on how NS Basic displays bitmaps. Devices come in different varieties: some can display a full set of colors, while other can only display simple black and white. Some can do settings in between. There are 5 levels that can currently be displayed: 1 bit, 2 bit, 4 bit, 8 bit and 16 bit. A 1 bit (monochrome) device cannot display an 8 bit picture, nor can it convert it to something it can display. Therefore, for a program to run on all possible devices, you need to supply bitmaps in all for levels.

Bitmaps are stored in your program as resources. NS Basic/Symbian OS creates a bitmap resource for each bitmap you add to the program, and gives it the 4 digit ID number you see in the Project Explorer. You can add a list of up to 5 paths to images for a single bitmap resource. Make sure the images you add to your project already have the correct bit depth for the place you are assigning them!

Internally, NS Basic using a handy utility to do this called ResIn. It allows you to use .bmp, .gif, .jpg, ico, .emf or .wmf files as input: they are is used at runtime. It is in NS Basic Tools folder.

This same utility is used create color icons for your application that are displayed in the StyleTap Launcher. It is not used for icons in the Symbian Launcher.

Internally, the format of the ResIn command line is
ResIn.exe imageNames:n filename.prc resType resID

Sample:
ResIn.exe a1.bmp:1 a2.bmp:2 a4.bmp:4 a8.bmp:8 ColorBitmap.prc Tbmp 1006