[fpc-pascal] FCL-Image and OS/2 BMP support

Graeme Geldenhuys graeme at geldenhuys.co.uk
Fri Apr 5 11:49:30 CEST 2013


Having had a quick look at the FPReadBMP.pp unit, the only BMP format
FCL-Image supports is the Windows BMP format. I need to read OS/2 BMP
files too.

Here is a very brief comparison between the two formats. Note that OS/2
Bitmaps can be larger, multiple images per file, different compression
algorithms, different file headers etc.

OS/2 Bitmap:

Windows Bitmap:

I'm doing the work for fpGUI's DocView, but would like to share the code
with FPC too. What would be the suggested way of doing this?

 1) extend the existing FPReadBMP.pp unit. This could be messy.

 2) create a whole new unit specific to OS/2 Bitmaps.

I would opt for (2). But that raises another problem, but probably not
relevant to others here. If option (2) is used, your application can't
simply assume a *.bmp can be read with FPReadBMP, it needs to check the
file header first, then determine the correct unit & class to use to
read the bitmap.

A shot in the dark....  Has anybody else created a Object Pascal unit
they could share that can read OS/2 Bitmap files? I've got the basics
down, but need lots of testing and debugging still.

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list