[OpenJDK 2D-Dev]  RFR JDK-7031957: DIB header of type BITMAPV2INFOHEADER & BITMAPV3INFOHEADER is not supported in BMPImageReader
Jayathirth D V
jayathirth.d.v at oracle.com
Wed Mar 14 10:39:52 UTC 2018
Please review the following solution in JDK11 :
Bug : https://bugs.openjdk.java.net/browse/JDK-7031957
Webrev : http://cr.openjdk.java.net/~jdv/7031957/webrev.00/
Issue: If we try to read any BMP image of DIB header type BITMAPV2INFOHEADER/ BITMAPV3INFOHEADER, we get IOException mentioning the BMP image type in not yet implemented.
Root cause: BMPImageReader doesn't support DIB header types BITMAPV2INFOHEADER/ BITMAPV3INFOHEADER we support only BITMAPCOREHEADER, BITMAPINFOHEADER, BITMAPV4HEADER & BITMAPV5HEADER.
Solution: Many other tools like GIMP, Microsoft PowerPoint, IrfanView support BITMAPV2INFOHEADER & BITMAPV3INFOHEADER format BMP images. We can consider BITMAPV2INFOHEADER & BITMAPV3INFOHEADER header types having functionality in between that of BITMAPINFOHEADER & BITMAPV4HEADER. BITMAPINFOHEADER with type BITFIELDS & extra 4 bytes for alpha channel or First 56 bytes of BITMAPV4HEADER is nothing but BITMAPV3INFOHEADER.
To support BITMAPV2INFOHEADER & BITMAPV3INFOHEADER we can use similar approach of what we are doing while decoding first 56 bytes under BITMAPV4HEADER. So I have added additional "if()" to do the same, we can merge decoding of BITMAPV2INFOHEADER & BITMAPV3INFOHEADER at the same place where we are decoding BITMAPV4HEADER but we need to add many branch conditions to follow that approach.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the 2d-dev