Fast Windows bitmap loading


This HB++™ class has been designed for loading and saving Windows™ bitmaps, coded with uncompressed 24 bit RGB format.

It also ensures the Windows™ bitmaps to HB++™ conversion at runtime.

This class embeds ARM code for very fast loading, saving and conversion.



  • Loading such bitmaps from a stream or binary resource.
  • Saving such bitmaps to a stream.
  • Preserve mode: avoiding to reload from stream or binary resource the previous loaded bitmap.
  • Fast mode: load and save using ARM code (very fast, only available for OS 5.x + ARM processor based devices).
  • Low resolution mode: this option is used for avoiding loss of pixels for odd dimensions.
  • The LoadBitmap function allows to load a bitmap by index when the stream contains several bitmaps.

More details

If ARM code is not supported by the device that the code is running on, the standard method is automatically called, so there is no crash whatever the device used.

If you do not want to use ARM code you can disable it at compilation time by commenting the line, in the clsBitmap24bit class file, like this:

Using ARM code:

  #Const USEARM=TRUE  


Disabling ARM code:

 '#Const USEARM=TRUE  


The ARM code of the clsBitmap24bit class uses a StreamMemory to work. The size of memory space used is depending on the number of line you prefer to convert in one call.

This is defined by the constant:

  Private const MAXLINESTREAM As Long = 20  


You can change it if you want. More this value is high and faster the job is done.

I have made a compromise by defining the number of lines equal to 20, that ensures less than 20kb for a 500x500 Windows bitmap.

This class is provided with a full HB++ sample project.