![]() |
![]() |
![]() |
![]() |
Updated to GDITOOLS 041
Bitmaps provide the pixel patterns used by pictures[gdi], icons and masks, sprites and brush styles for filling areas of the display. To optimise bitmap handling performance EPOC32 uses files containing multiple bitmaps in its own EPOC bitmap format. These files are of two types:
The bmconv
tool is used to allow bitmaps that are designed on a PC to be converted to EPOC bitmap format. The tool is also used to perform the reverse conversion process, so bitmaps can be created on either platform.
Section Contents
Use this program to create an EPOC multi-bitmap file (extension .mbm
) from one or more Windows bitmap files (extension .bmp)
. The destination file produced may be either a font store file or a ROM image file (which does not use any RAM when being accessed). The conversion process can translate the Windows bitmap files into either 2 or 4 bits-per-pixel EPOC bitmaps.
The program can also split an EPOC multi-bitmap file into its component bitmaps and convert those to Microsoft Windows bitmap files.
or:
or:
/r |
If specified, indicates that the destination file is a ROM image file; otherwise a file store destination file is produced. |
/hheader-file |
If specified, a header file is generated which may be included in C++ code (header-file may include a path). |
psi-file |
The filename of the EPOC multi-bitmap file (may include a path). |
bmp-file_n |
The filename of the nth Windows bitmap file (may include a path). |
/4 |
Specifies that the converted bitmap for the particular bmp-file in the resulting |
/u |
If specified, indicates that the source file is the EPOC multi-bitmap file and the destination is the individual Windows bitmaps. Otherwise, the source files are the |
command-file |
If specified, a file containing the command line, with commands separated by spaces or new-lines. (NB. C++ style // comments may be included in command files.) |
The command line syntax and brief notes may be obtained by typing bmconv on the command line.
The number of source files that may be used is limited only by the PC memory, the available storage on the destination machine for the destination file, and the number of characters available on the DOS command line.
File store bitmaps, created with the bmconv tool, are compressed automatically, whereas ROM bitmaps are not.
The name of the header file and the name of the multi-bitmap file do not have to be the same, though it may be convenient if they are.
There is no standard filename extension for an EPOC multi-bitmap file, but the use of .mbm
is recommended for a font store file, and .mbr
for a ROM image file.
Do not include a space between the /4 flag and the source filename, or between the /h flag and the header file name.
The generated header file contains an enum with items referring to the identifiers of the source bitmaps within the generated multi-bitmap file. These enumerated constants can be used as parameters to the CFbsBitmap::Load() function when a bitmap is required by an application program.
Each enums type name is generated by
For example, if the header filename is head.h
the enum name will be TMbmHead.
The item names are generated by
For example, if the name of the header file is head.h
and the source .bmp
filename is tblank
the enum item name will be EMbmHeadTblank.
Section Contents
Making a file of bitmaps for use by EPOC32 consists of two stages:
.bmp
format).This example shows the creation of the multi-bitmap file used in grbmap, from a smiley bitmap and a mask bitmap, both of 2 bits per pixel.
The simplest Windows tool for designing bitmaps is Microsoft Paintbrush. The default Paintbrush bitmap is 200x200 pixels, 256 colors, 1 plane.
The simplest bitmap to design is a blank monochrome one (two colors), and this is made simply by saving the default Paintbrush bitmap using:
File|Save As...|Monochrome bitmap (*.BMP)
Note that monochrome Windows bitmaps are converted into 2 bits per pixel EPOC bitmaps as there is no EPOC 1 bit per pixel format, due to the time cost of having to convert monochrome bitmaps to 2 bpp to display them on 2 bpp screens.
In the example two 16 color bitmaps (which will be converted down to 2 bits per pixel) are created: smiley.bmp
and smilmask.bmp
. These are drawn in various colors or shades of gray, using the default Paintbrush bitmap size, and then saved using:
File|Save As...|16 Color bitmap (*.BMP)
The .bmp
files must be converted into EPOC format bitmaps and combined into a multi-bitmap file.
The command line to use is:
bmconv /hgrbmap2.h grbmap2.mbm smiley.bmp smilmask.bmp
The screen output should be:
BMCONV version 27. Compiling... Multiple bitmap store type: File store Psion file: grbmap2.mbm Bitmap file 1 : smiley.bmp Bitmap file 2 : smilmask.bmp Success.
The header file generated is as follows:
// u:/sdk/gdi/grbmap2.h // Generated by BitmapCompiler // (C) Copyright Psion PLC 1996 // enum TMbmGrbmap2 { EMbmGrbmap2Smiley, EMbmGrbmap2Smilmask };
The .mbm
file (previously generated by the bmconv
tool) should be installed in the data subdirectory (hence the //data// in the code fragment below). It must be used with the header file that was generated at the same time (grbmap2.h in this example).
... // header for multi-bitmap file grbitmap.mbm // containing 2 bitmaps to use #include "grbmap2.h" ... // set the name of the multi-bitmap file containing the bitmap // and bitmap mask files TFileName multiBitmapFile2(_L("//data//grbmap2.mbm")); // set up name for bitmap sharing TBool shareIfLoaded(ETrue);
To load the blank bitmap:
... // load the bitmap and mask bitmap iBitmap = new (ELeave) CFbsBitmap(); User::LeaveIfError(iBitmap->Load(multiBitmapFile2, EMbmGrbmap2Smiley,shareIfLoaded)); iMaskBitmap = new (ELeave) CFbsBitmap(); User::LeaveIfError(iMaskBitmap->Load(multiBitmapFile2, EMbmGrbmap2Smilmask,shareIfLoaded)); ...
The bitmap can then be used as required, and should be deleted when it is no longer needed.
![]() |
![]() |
![]() |
![]() |