I was trying to implement 8-bit RLE encoding on a whim. While testing my resulting code against the bmpsuite:
http://entropymine.com/jason/bmpsuite/
I found a number of other obscure problems not related to my own code.
Fixed:
- BMPDecoder constructor was reading the data offset but not actually skipping to it (there can be space between the colour table and the bitmap data.)
- readColorTable was reading the maximum number of colours, not the number of colours declared to be in use (a 1-bit image can have a colour table with only one entry in it, for instance. Same can occur for any other indexed colour depth.) As a result it would read too far into the file, past bitmap data.
Added:
- toString() in ColorEntry for the purpose of debugging.
- Constants for other unsupported compression types, BI_BITFIELDS, BI_JPEG, BI_PNG
Net result after applying this patch is that every BMP file in the bmpsuite can load except for the ones which use unsupported compression methods.
image4j-fixes.patch