Like the 24-bpp format, the 32-bpp format is a true-color format. Unlike the 24-bpp format, however, the 32-bpp format does not cause pixels to cross DWORD boundaries, although this format is less efficient in memory use. There are two ways to arrange the color channels in this format. One method puts blue in the least significant byte of each pixel, and the other method puts red in the least significant byte. These options correspond to the PAL_BGR and PAL_RGB modes. Microsoft recommends using PAL_RGB for slightly better performance. The following table shows the masks that you can use to extract red, green, blue, and alpha channels from each pixel.
Color |
PAL_RGB mask |
PAL_BGR mask |
Red | 0x000000FF | 0x00FF0000 |
Green | 0x0000FF00 | 0x0000FF00 |
Blue | 0x00FF0000 | 0x000000FF |
If your product does not use an alpha channel, use 0x00000000 as the mask for alpha. The following illustration shows the arrangement of memory for the format.