⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bmp.html

📁 刚刚看到本站有Visual C++数字图象处理(人民邮电出版社)的电子书
💻 HTML
📖 第 1 页 / 共 3 页
字号:
        components, respectively, of each pixel. each dword in the bitmap array represents a 

        single pixel.</p>

        <b><p align="justify">windows nt specific:</b> when the <i>compression</i> field is set to 

        bi_bitfields, bits set in each dword mask must be contiguous and should not overlap the 

        bits of another mask. all the bits in the pixel do not have to be used. </p>

        <b><p align="justify">windows 95 specific:</b> when the <i>compression</i> field is set to 

        bi_bitfields, windows 95 supports only the following 32bpp color mask: the blue mask is 

        0x000000ff, the green mask is 0x0000ff00, and the red mask is 0x00ff0000.</font></p>

      </dir>

    </dir>

    <b><font face="宋体" lang="zh-cn" size="5"><p></font><font face="book antiqua" size="5"><a

    name="_toc381201088">compression field</a></p>

    </font></b><font face="book antiqua" size="3"><p align="justify">the <i>compression</i> 

    field specifies the way the bitmap data is stored in the file. this information together 

    with the <i>bits per pixel</i> (<i>bpp</i>) field identifies the compression algorithm to 

    follow.</p>

    <p align="justify">the following values are possible in this field:</p>

    </font><table border="1" cellspacing="2" bordercolor="#000000" cellpadding="7" width="657">

      <tr>

        <td width="18%" valign="top"><font face="book antiqua" size="3" color="#808080"><b><p

        align="justify">value</b></font></td>

        <td width="82%" valign="top"><font face="book antiqua" size="3" color="#808080"><b><p

        align="justify">meaning</b></font></td>

      </tr>

      <tr>

        <td width="18%" valign="top"><font face="book antiqua" size="3"><p align="justify">bi_rgb</font></td>

        <td width="82%" valign="top"><font face="book antiqua" size="3"><p align="justify">an 

        uncompressed format.</font></td>

      </tr>

      <tr>

        <td width="18%" valign="top"><font face="book antiqua" size="3"><p align="justify">bi_rle4</font></td>

        <td width="82%" valign="top"><font face="book antiqua" size="3"><p align="justify">an rle 

        format for bitmaps with 4 bits per pixel. the compression format is a two-byte format 

        consisting of a count byte followed by two word-length color indices. for more 

        information, see the following remarks section.</font></td>

      </tr>

      <tr>

        <td width="18%" valign="top"><font face="book antiqua" size="3"><p align="justify">bi_rle8</font></td>

        <td width="82%" valign="top"><font face="book antiqua" size="3"><p align="justify">a 

        run-length encoded (rle) format for bitmaps with 8 bits per pixel. the compression format 

        is a two-byte format consisting of a count byte followed by a byte containing a color 

        index. for more information, see the following remarks section.</font></td>

      </tr>

      <tr>

        <td width="18%" valign="top"><font face="book antiqua" size="3"><p align="justify">bi_bitfields</font></td>

        <td width="82%" valign="top"><font face="book antiqua" size="3"><p align="justify">specifies 

        that the bitmap is not compressed and that the color table consists of three double word 

        color masks that specify the red, green, and blue components, respectively, of each pixel. 

        this is valid when used with 16- and 32- bits-per-pixel bitmaps.</font></td>

      </tr>

    </table>

    <font face="book antiqua" size="3"><p align="justify">when the compression field is 

    bi_rle8, the bitmap is compressed by using a run-length encoding (rle) format for an 8-bit 

    bitmap. this format can be compressed in encoded or absolute modes. both modes can occur 

    anywhere in the same bitmap.</p>

    <ul>

      <b>

      <li>encoded mode consists of two bytes: </b></font></li>

    </ul>

    <font face="宋体" lang="zh-cn" size="3"><dir>

      <dir>

        </font><font face="book antiqua" size="3"><p align="justify">the first byte specifies the 

        number of consecutive pixels to be drawn using the color index contained in the second 

        byte. in addition, the first byte of the pair can be set to zero to indicate an escape 

        that denotes an end of line, end of bitmap, or delta. the interpretation of the escape 

        depends on the value of the second byte of the pair, which can be one of the following:</font></p>

      </dir>

    </dir>

    <table cellspacing="0" border="0" cellpadding="7" width="602">

      <tr>

        <td width="9%" valign="top"><font face="book antiqua" size="3"><p align="justify">0</font></td>

        <td width="91%" valign="top"><font face="book antiqua" size="3"><p align="justify">end of 

        line.</font></td>

      </tr>

      <tr>

        <td width="9%" valign="top"><font face="book antiqua" size="3"><p align="justify">1</font></td>

        <td width="91%" valign="top"><font face="book antiqua" size="3"><p align="justify">end of 

        bitmap.</font></td>

      </tr>

      <tr>

        <td width="9%" valign="top"><font face="book antiqua" size="3"><p align="justify">2</font></td>

        <td width="91%" valign="top"><font face="book antiqua" size="3"><p align="justify">delta. 

        the two bytes following the escape contain unsigned values indicating the horizontal and 

        vertical offsets of the next pixel from the current position.</font></td>

      </tr>

    </table>

    <font face="宋体" lang="zh-cn" size="3"><ul>

      </font><font face="book antiqua" size="3"><b>

      <li>absolute mode.</b></font></li>

    </ul>

    <font face="宋体" lang="zh-cn" size="3"><dir>

      <dir>

        </font><font face="book antiqua" size="3"><p align="justify">the first byte is zero and 

        the second byte is a value in the range 03h through ffh. the second byte represents the 

        number of bytes that follow, each of which contains the color index of a single pixel. 

        when the second byte is 2 or less, the escape has the same meaning as in encoded mode. in 

        absolute mode, each run must be aligned on a word boundary.</p>

        </font><font face="宋体" lang="zh-cn" size="3"><p align="justify"> </p>

        <p align="justify"></font> </p>

      </dir>

    </dir>

    <font face="book antiqua" size="3"><p align="justify">the following example shows the 

    hexadecimal values of an 8-bit compressed bitmap.</p>

    </font><font face="courier new" size="3"><p align="justify">03 04 05 06 00 03 45 56 67 00 

    02 78 00 02 05 01 02 78 00 00 09 1e 00 01</p>

    </font><font face="book antiqua" size="3"><p align="justify">this bitmap would expand as 

    follows (two-digit values represent a color index for a single pixel):</p>

    </font><font face="courier new" size="3"><p align="justify">04 04 04</p>

    <p align="justify">06 06 06 06 06</p>

    <p align="justify">45 56 67</p>

    <p align="justify">78 78</p>

    <p align="justify">move current position 5 right and 1 down</p>

    <p align="justify">78 78</p>

    <p align="justify">end of line</p>

    <p align="justify">1e 1e 1e 1e 1e 1e 1e 1e 1e</p>

    <p align="justify">end of rle bitmap</p>

    </font><font face="宋体" lang="zh-cn" size="3"><p align="justify"> </p>

    </font><font face="book antiqua" size="3"><p align="justify">when the compression field is 

    bi_rle4, the bitmap is compressed by using a run-length encoding format for a 4-bit 

    bitmap, which also uses encoded and absolute modes:</p>

    <ul>

      <b>

      <li>in encoded mode.</b></font></li>

    </ul>

    <font face="宋体" lang="zh-cn" size="3"><dir>

      <dir>

        </font><font face="book antiqua" size="3"><p align="justify">the first byte of the pair 

        contains the number of pixels to be drawn using the color indices in the second byte. the 

        second byte contains two color indices, one in its high-order four bits and one in its 

        low-order four bits. the first of the pixels is drawn using the color specified by the 

        high-order four bits, the second is drawn using the color in the low-order four bits, the 

        third is drawn using the color in the high-order four bits, and so on, until all the 

        pixels specified by the first byte have been drawn.</p>

        </font><font face="宋体" lang="zh-cn" size="3">

      </dir>

    </dir>

    <ul>

      </font><font face="book antiqua" size="3"><b>

      <li>in absolute mode. </b></font></li>

    </ul>

    <font face="宋体" lang="zh-cn" size="3"><dir>

      <dir>

        </font><font face="book antiqua" size="3"><p align="justify">the first byte is zero, the 

        second byte contains the number of color indices that follow, and subsequent bytes contain 

        color indices in their high- and low-order four bits, one color index for each pixel. in 

        absolute mode, each run must be aligned on a word boundary. </p>

        <p align="justify">the end-of-line, end-of-bitmap, and delta escapes described for bi_rle8 

        also apply to bi_rle4 compression.</p>

        </font><font face="宋体" lang="zh-cn" size="3"><p align="justify"></font> </p>

      </dir>

    </dir>

    <font face="book antiqua" size="3"><p align="justify">the following example shows the 

    hexadecimal values of a 4-bit compressed bitmap.</p>

    </font><font face="courier new" size="3"><p align="justify">03 04 05 06 00 06 45 56 67 00 

    04 78 00 02 05 01 04 78 00 00 09 1e 00 01</p>

    </font><font face="book antiqua" size="3"><p align="justify">this bitmap would expand as 

    follows (single-digit values represent a color index for a single pixel):</p>

    </font><font face="courier new" size="3"><p align="justify">0 4 0</p>

    <p align="justify">0 6 0 6 0</p>

    <p align="justify">4 5 5 6 6 7</p>

    <p align="justify">7 8 7 8</p>

    <p align="justify">move current position 5 right and 1 down</p>

    <p align="justify">7 8 7 8</p>

    <p align="justify">end of line</p>

    <p align="justify">1 e 1 e 1 e 1 e 1</p>

    <p align="justify">end of rle bitmap</p>

    </font><b><font face="宋体" lang="zh-cn" size="5"><p></font><font face="book antiqua"

    size="5"><a name="_toc381201089">colors field</a></p>

    </font></b><font face="book antiqua" size="3"><p align="justify">the <i>colors</i> field 

    specifies the number of color indices in the color table that are actually used by the 

    bitmap. if this value is zero, the bitmap uses the maximum number of colors corresponding 

    to the value of the <i>bbp</i> field for the compression mode specified by the <i>compression</i> 

    field. </p>

    <p align="justify">if the <i>colors</i> field is nonzero and the <i>bbp</i> field less 

    than 16, the <i>colors</i> field specifies the actual number of colors the graphics engine 

    or device driver accesses. </p>

    <p align="justify">if the <i>bbp</i> field is 16 or greater, then <i>colors</i> field 

    specifies the size of the color table used to optimize performance of windows color 

    palettes. </p>

    <p align="justify">if <i>bbp</i> equals 16 or 32, the optimal color palette starts 

    immediately following the three double word masks.</p>

    <p align="justify">if the bitmap is a packed bitmap (a bitmap in which the bitmap array 

    immediately follows the bitmap header and which is referenced by a single pointer), the <i>colors</i> 

    field must be either 0 or the actual size of the color table. </p>

    </font><b><font face="宋体" lang="zh-cn" size="5"><p></font><font face="book antiqua"

    size="5"><a name="_toc381201090">important colors field</a></p>

    </font></b><font face="arial" size="3"><p align="justify">the <i>important colors</i> 

    field s</font><font face="book antiqua" size="3">pecifies the number of color indices that 

    are considered important for displaying the bitmap. if this value is zero, all colors are 

    important. </font></td>

  </tr>

</table>

</center></div>



<p align="center"><a href="../index.htm">返回</a></p>

</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -