📄 chp1.htm
字号:
inter-ideograph;line-height:18.0pt'><span style='font-size:10.5pt;font-family:
"Times New Roman"'>LONG
biXPelsPerMeter; <o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span style='font-size:10.5pt;font-family:
"Times New Roman"'>LONG
biYPelsPerMeter; <o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span style='font-size:10.5pt;font-family:
"Times New Roman"'>DWORD biClrUsed; <o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span style='font-size:10.5pt;font-family:
"Times New Roman"'>DWORD biClrImportant; <o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span style='font-size:10.5pt;font-family:
"Times New Roman"'>} BITMAPINFOHEADER; <o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>这个结构的长度是固定的,为</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>40</span><span
lang=ZH-CN style='font-size:10.5pt'>个字节</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(LONG</span><span lang=ZH-CN style='font-size:
10.5pt'>为</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>32</span><span
lang=ZH-CN style='font-size:10.5pt'>位整数</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>)</span><span lang=ZH-CN style='font-size:10.5pt'>,各个域的说明如下:</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biSize</span></b><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定这个结构的长度,为</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>40</span><span
lang=ZH-CN style='font-size:10.5pt'>。</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biWidth</span></b><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定图象的宽度,单位是象素。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biHeight</span></b><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定图象的高度,单位是象素。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biPlanes</span></b><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>必须是</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>1</span><span
lang=ZH-CN style='font-size:10.5pt'>,不用考虑。</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biBitCount </span></b><span style='font-size:
10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定表示颜色时要用到的位数,常用的值为</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>1(</span><span
lang=ZH-CN style='font-size:10.5pt'>黑白二色图</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>), 4(16</span><span lang=ZH-CN style='font-size:
10.5pt'>色图</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>),
8(256</span><span lang=ZH-CN style='font-size:10.5pt'>色</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>), 24(</span><span
lang=ZH-CN style='font-size:10.5pt'>真彩色图</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>)(</span><span lang=ZH-CN style='font-size:10.5pt'>新的</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>.bmp</span><span
lang=ZH-CN style='font-size:10.5pt'>格式支持</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>32</span><span lang=ZH-CN style='font-size:10.5pt'>位色,这里就不做讨论了</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>)</span><span
lang=ZH-CN style='font-size:10.5pt'>。</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biCompression</span></b><span style='font-size:
10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定位图是否压缩,有效的值为</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>BI_RGB</span><span
lang=ZH-CN style='font-size:10.5pt'>,</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>BI_RLE8</span><span lang=ZH-CN style='font-size:
10.5pt'>,</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>BI_RLE4</span><span
lang=ZH-CN style='font-size:10.5pt'>,</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>BI_BITFIELDS(</span><span lang=ZH-CN
style='font-size:10.5pt'>都是一些</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'>Windows</span><span lang=ZH-CN style='font-size:10.5pt'>定义好的常量</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>)</span><span
lang=ZH-CN style='font-size:10.5pt'>。要说明的是,</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>Windows</span><span lang=ZH-CN style='font-size:
10.5pt'>位图可以采用</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>RLE4</span><span
lang=ZH-CN style='font-size:10.5pt'>,和</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>RLE8</span><span lang=ZH-CN style='font-size:
10.5pt'>的压缩格式,但用的不多。我们今后所讨论的只有第一种不压缩的情况,即</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biCompression</span><span lang=ZH-CN
style='font-size:10.5pt'>为</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'>BI_RGB</span><span lang=ZH-CN style='font-size:10.5pt'>的情况。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biSizeImage</span></b><span style='font-size:
10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定实际的位图数据占用的字节数,其实也可以从以下的公式中计算出来:</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p class=a style='margin:0cm;margin-bottom:.0001pt;line-height:18.0pt'>biSizeImage=biWidth’
× biHeight</p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>要注意的是:上述公式中的</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>biWidth’</span><span
lang=ZH-CN style='font-size:10.5pt'>必须是</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>4</span><span lang=ZH-CN style='font-size:10.5pt'>的整倍数</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(</span><span
lang=ZH-CN style='font-size:10.5pt'>所以不是</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biWidth</span><span lang=ZH-CN style='font-size:
10.5pt'>,而是</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>biWidth’</span><span
lang=ZH-CN style='font-size:10.5pt'>,表示大于或等于</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biWidth</span><span lang=ZH-CN style='font-size:
10.5pt'>的,最接近</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>4</span><span
lang=ZH-CN style='font-size:10.5pt'>的整倍数。举个例子,如果</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>biWidth=240</span><span lang=ZH-CN
style='font-size:10.5pt'>,则</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'>biWidth’=240</span><span lang=ZH-CN style='font-size:10.5pt'>;如果</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>biWidth=241</span><span
lang=ZH-CN style='font-size:10.5pt'>,</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biWidth’=244)</span><span lang=ZH-CN
style='font-size:10.5pt'>。</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>如果</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>biCompression</span><span
lang=ZH-CN style='font-size:10.5pt'>为</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>BI_RGB</span><span lang=ZH-CN style='font-size:
10.5pt'>,则该项可能为零</span><span style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biXPelsPerMeter</span></b><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定目标设备的水平分辨率,单位是每米的象素个数,关于分辨率的概念,我们将在第</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>4</span><span
lang=ZH-CN style='font-size:10.5pt'>章详细介绍。</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biYPelsPerMeter</span></b><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定目标设备的垂直分辨率,单位同上。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biClrUsed</span></b><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定本图象实际用到的颜色数,如果该值为零,则用到的颜色数为</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>2<sup>biBitCount</sup></span><span
lang=ZH-CN style='font-size:10.5pt'>。</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>biClrImportant</span></b><span style='font-size:
10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>指定本图象中重要的颜色数,如果该值为零,则认为所有的颜色都是重要的。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>第三部分为调色板</span><b><span
style='font-size:10.5pt;font-family:"Times New Roman"'>Palette</span></b><span
lang=ZH-CN style='font-size:10.5pt'>,当然,这里是对那些需要调色板的位图文件而言的。有些位图,如真彩色图,前面已经讲过,是不需要调色板的,</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>BITMAPINFOHEADER</span><span
lang=ZH-CN style='font-size:10.5pt'>后直接是位图数据。</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>调色板实际上是一个数组,共有</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>biClrUsed</span><span
lang=ZH-CN style='font-size:10.5pt'>个元素</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(</span><span lang=ZH-CN style='font-size:10.5pt'>如果该值为零,则有</span><span
style='font-si
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -