0

I am learning about DIBV5 format (at https://msdn.microsoft.com/en-us/library/windows/desktop/dd183381(v=vs.85).aspx):

What is actual meaning of alpha mask field? Doc says that:

Color mask that specifies the alpha component of each pixel.

What is benefit of such mask? Is it just compression of alpha information in the case, where all pixels have the same alpha?

Alex Aparin
  • 4,393
  • 5
  • 25
  • 51
  • 4
    It depends on the bV5BitCount, 16 being the usual problem since it is the most awkward way to encode alpha, red, green and blue. 1555, 555 and 565 have been used. The alpha mask determines what bits in a 16-bit pixel value represent the alpha value. So 0x8000, 0 and 0. Do beware that nobody uses this and standard graphics libraries don't support it. – Hans Passant Apr 22 '17 at 12:44

1 Answers1

1

Ideally it has the same meaning as the other mask members; to specify which bits are valid in a DWORD for a BI_BITFIELDS "compressed" image. There is no compression of alpha values. I suppose you could store alpha values in a image with less than 32bpp by packing the alpha and color values into 3 bytes but I have never seen such an image in the wild.

Bitmap alpha channels have always been poorly documented so you might run into some issues.

If you are writing a image viewer you probably have to check if a .bmp contains varying alpha channel values even if bV5AlphaMask is 0 or 0xff000000 because you want to handle older DIB formats and BI_RGB.

Community
  • 1
  • 1
Anders
  • 97,548
  • 12
  • 110
  • 164