[fpc-pascal] FCL-Image and OS/2 BMP support
Michael Van Canneyt
michael at freepascal.org
Fri Apr 5 14:42:41 CEST 2013
On Fri, 5 Apr 2013, Sven Barth wrote:
> Am 05.04.2013 12:07, schrieb Michael Van Canneyt:
>> On Fri, 5 Apr 2013, Graeme Geldenhuys wrote:
>>> 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.
>> That's why, unfortunately, I think 1) is better.
>> A second problem is the 'multiple images per file'.
>> You will need an image number when loading. That will need a change in the
>> reader or in TFPCustomImageHandler.
>> (a property, default set to 0, so it reads the first image (zero based))
> With support for multiple images per file we could add *.ico support to
> fcl-image as well (currently this is implemented in the LCL). And this could
> also benefit *.gif :)
Well I alread had .gif in mind when proposing this, I didn't know about .ico.
So much the better :-)
More information about the fpc-pascal