Tech Note 04a: Using ResIn on Color Bitmaps

January 24, 2003

© NSB Corporation. All rights reserved.



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

First, a bit of background on how Palm devices display bitmaps. Palm 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/Palm 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 automatically converted to the special .bmp format that the Palm OS requires. It is in NS Basic Tools folder.

This same utility is used create color icons for your application.

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

Enabling gray scale on non-color Palm devices

Most non color Palm devices are capable of gray scale display, but are set to display only black and white. However, there is a utility to change the setting of your Palm, called ScreenPrefs. Note that after running this, you may need to adjust the contrast of your Palm to get optimal viewing.