[OpenJDK 2D-Dev] [11] RFR JDK-7031957: DIB header of type BITMAPV2INFOHEADER & BITMAPV3INFOHEADER is not supported in BMPImageReader

Phil Race philip.race at oracle.com
Mon Mar 19 17:37:12 UTC 2018


Since the principal addition of these formats is to add explicit fields
for supporting the bitmasks for accessing R/G/B/A it seems odd to
see there is code like this which ignores it when the data is uncompressed
by using these hardcoded values :

  456                             if ((int)compression == BI_RGB) {
  457                                 redMask = 0x7C00;
  458                                 greenMask = 0x3E0;
  459                                 blueMask = 0x1F;


I do see that it seems likely you copied this from the 108/124 case
but I'd like to see some proof that this is correct.


-phil.

On 03/14/2018 03:39 AM, Jayathirth D V wrote:
>
> Hello All,
>
> 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/ 
> <http://cr.openjdk.java.net/%7Ejdv/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.
>
> Thanks,
>
> Jay
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20180319/4813090c/attachment.html>


More information about the 2d-dev mailing list