SeeDIB.exe Shows 16 and 32 Bits-Per-Pel Bitmap Formats

博客介绍了SeeDIB.exe可展示16和32位每像素的位图格式,包含概要、更多信息、示例、使用方法等内容,还提及适用于Windows 95系统。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SeeDIB.exe Shows 16 and 32 Bits-Per-Pel Bitmap Formats

Article ID:94326
Last Review:February 11, 2005
Revision:4.4
This article was previously published under Q94326

SUMMARY

SeeDIB.exe is a sample application that demonstrates how to load, display, and save 1, 4, 8, 16, 24, and 32-bits-per-pixel (Device Independent Bitmap (DIB) formats. In addition, SeeDIB.exe demonstrates a simple method of creating an optimized palette for displaying DIBs with more than 8-bits-per-pixel on 8-bits-per-pixel devices.

Note To minimize color loss, SeeDIB uses CreateDIBSection() to do conversions between uncompressed DIBs which have more than 8-bits-per- pixel. This function is not available on Windows NT 3.1.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. For DIBs, the 16 and 32-bit formats contain three DWORD masks in the bmiColors member of the BITMAPINFO structure. These masks specify which bits in the pel correspond to which color.

The three masks must have contiguous bits, and their order is assumed to be R, G, B (high bits to low bits). The order of the three masks in the color table must also be first red, then green, then blue (RGB). In this manner, the programmer can specify a mask indicating how many shades of each RGB color will be available for bitmaps created with CreateDIBitmap(). For 16-bits-per-pixel DIBs, CreateDIBitmap() defaults to the RGB555 format. For 32-bits-per-pixel DIBs, CreateDIBitmap() defaults to an RGB888 format.

NOTE: The DIB engine in Windows 95 supports only RGB555 and RGB565 for 16-bit DIBs and only RGB888 for 32-bit DIBs.

Example

The RGB555 format masks would look like the following example:
   0x00007C00  red   (0000 0000 0000 0000 0111 1100 0000 0000)
   0x000003E0  green (0000 0000 0000 0000 0000 0011 1110 0000)
   0x0000001F  blue  (0000 0000 0000 0000 0000 0000 0001 1111)
				
NOTE: For 16 bits-per-pel, the upper half of the DWORDs are always zeroed.

The RGB888 format masks would look like the following example:
   0x00FF0000  red   (0000 0000 1111 1111 0000 0000 0000 0000)
   0x0000FF00  green (0000 0000 0000 0000 1111 1111 0000 0000)
   0x000000FF  blue  (0000 0000 0000 0000 0000 0000 1111 1111)
				

Usage

When using 16 and 32-bit formats, there are also certain fields of the BITMAPINFOHEADER structure that must be set to the correct values:

1.The biCompression member must be set to either BI_RGB or BI_BITFIELDS. Using BI-RGB indicates that no bit masks are included in the color table and that the default (RGB555 for 16bpp and RGB888 for 32bpp) format is implied. Using BI_BITFIELDS indicates that there are masks (bit fields) specified in the color table.
2.As with 24-bits-per-pixel formats, the biClrUsed member specifies the size of the color table used to optimize performance of Windows color palettes. If the biCompression is set to BI_BITFIELDS, then the optimal color palette starts immediately following the three DWORD masks. Note that an optimal color palette is optional and many applications will ignore it.

Windows 95

In Windows 95, if the BI_BITFIELDS flag is set, then a color mask must be specified and it must be one of the following:
   Resolution    Bits Per Color    Color Mask
   -------------------------------------------------------------
   16bpp         5,5,5             0x00007c00 0x000003e0 0x0000001f
   16bpp         5,6,5             0x0000f800 0x000007e0 0x0000001f
   32bpp         8,8,8             0x00ff0000 0x0000ff00 0x000000ff
				
User-defined color masks are not available under Windows 95.

APPLIES TO
Microsoft Win32 Application Programming Interface (API), when used with:
 Microsoft Windows 95 Service Pack 1
 Microsoft Windows NT Server 3.5
 Microsoft Windows NT Server 3.51
 Microsoft Windows NT Workstation 3.5
 Microsoft Windows NT Workstation 3.51
 Microsoft Windows 2000 Advanced Server
 Microsoft Windows 2000 Server
 Microsoft Windows 2000 Professional Edition
 Microsoft Windows XP Home Edition
 Microsoft Windows XP Professional
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值