Tech Note 04c: Tutorial: How to Create Transparent Icons and Bitmaps

March 30, 2004

© NSB Corporation. All rights reserved.

Contributed by Onik Arian

Contents


1.) Introduction

This Tech Note gives detailed instructions for creating and using transparent Icons and bitmaps in an NS Basic project. It assumes you have POSE and a handheld with Palm OS 3.5 or greater. To use transparent bitmaps in a PRC file, there are 4 steps that are required. Here is the overview:

For demonstration purposes, we will create and install 3 families of transparent images into a PRC file:


2.) Creating Bitmap Images

Use your favorite image editor and save the images as BMP files. There are some important things to know about them:



Now, go ahead and create 6 bitmaps, representing 3 families, and save them as 8-bit BMP files into your NS Basic Bitmaps folder:


3.) Creating the Project and PRC File

We will now create an NS Basic project, add the 6 bitmaps as resources, and compile a PRC file. At this point, the BMP files all have an opaque background. Note the ID# of the Bitmap family; you will need that number later. Donít worry about the ID# for the family of Large and Small icons.


4.) Using PilRC to Generate Bitmap Resources

The Pilot Resource Compiler (PilRC) is an application that takes a resource script file and generates one or more binary resource files that can be used when developing for the Palm Computing Platform. For example, PilRC can compile a group of BMP files into a PRC database. It can also compile BMP files into binary (*.BIN) files. These can then can be used to replace the original BMP files that were used in our NS Basic project. PilRC is a command line utility that uses an .rcp file with information about what resources to compile, and what kind of resource file to generate. This .rcp file is created with a text editor, like Notepad. The syntax for the commands within the file are covered in the PilRC manual. Read the manual carefully, and pay special attention to the section on Bitmaps. PilRC is a free utility that was created by Wes Cherry and Aaron Ardiri, and can be found on the internet.


5.) Using PAR to Replace the Bitmaps

PAR (Palm Database Archiver) is a utility that creates and manipulates PalmOS database (.pdb) and resource (.prc) files. Like PilRC, it is a free utility and can be found on the internet. PAR was written by David Williams.

We will use it to first delete the opaque bitmaps. Then weíll replace them with the corresponding binary files that contain our transparent bitmaps and icons. Again, read the PAR manual carefully to understand the command-line syntax of this DOS utility. Like PilRC, we can make batch files to simplify things. Letís make 3 of them: to List whatís in our PRC file, to Delete the opaque bitmaps, and to Add our newly created binary files. We will name them: ParList.bat, ParDel.bat, & ParAdd.bat. See the next section for instructions on how to create these batch files. After you've written them, copy the batch files, along with the PAR utility (par.exe) to the temp folder containing PilRC and the image files. Then, weíll ready for the final steps.


6.) Testing the New PRC File

Load the new TransBit.prc into both the POSE and your handheld. Check out the Large & Small Icons in Icon View and List View. Then run TransBit and check out the bitmap image. The ugly beige background should now be gone, replaced by a transparent background.


7.) Miscellaneous Tips


8.) Acknowledgements and Further Information