图形包括哪两个方面的要素?在计算机中如何表示它们?

如题所述

1、位图文件由4个部分组成:位图文件头(bitmap-file
header)、位图信息头(bitmap-information
header)、彩色表(color
table)和定义位图的字节阵列,位图文件结构内容摘要表1所示。
表1
位图文件结构内容摘要
偏移量
域的名称
大小
内容
位图文件头
0000h
标识符(identifier)
2
bytes
两字节的内容用来识别位图的类型:
‘bm’

windows
3.1x,
95,
nt,

‘ba’
:os/2
bitmap
array
‘ci’
:os/2
color
icon
‘cp’
:os/2
color
pointer
‘ic’

os/2
icon
‘pt’
:os/2
pointer
0002h
file
size
1
dword
用字节表示的整个文件的大小
0006h
reserved
1
dword
保留,设置为0
000ah
bitmap
data
offset
1
dword
从文件开始到位图数据开始之间的数据(bitmap
data)之间的偏移量
000eh
bitmap
header
size
1
dword
位图信息头(bitmap
info
header)的长度,用来描述位图的颜色、压缩方法等。下面的长度表示:
28h
-
windows
3.1x,
95,
nt,

0ch
-
os/2
1.x
f0h
-
os/2
2.x
0012h
width
1
dword
位图的宽度,以像素为单位
0016h
height
1
dword
位图的高度,以像素为单位
001ah
planes
1
word
位图的位面数
位图信息头
001ch
bits
per
pixel
1
word
每个像素的位数
1
-
monochrome
bitmap
4
-
16
color
bitmap
8
-
256
color
bitmap
16
-
16bit
(high
color)
bitmap
24
-
24bit
(true
color)
bitmap
32
-
32bit
(true
color)
bitmap
001eh
compression
1
dword
压缩说明:
0
-
none
(也使用bi_rgb表示)
1
-
rle
8-bit
/
pixel
(也使用bi_rle4表示)
2
-
rle
4-bit
/
pixel
(也使用bi_rle8表示)
3
-
bitfields
(也使用bi_bitfields表示)
0022h
bitmap
data
size
1
dword
用字节数表示的位图数据的大小。该数必须是4的倍数
0026h
hresolution
1
dword
用像素/米表示的水平分辨率
002ah
vresolution
1
dword
用像素/米表示的垂直分辨率
002eh
colors
1
dword
位图使用的颜色数。如8-位/像素表示为100h或者
256.
0032h
important
colors
1
dword
指定重要的颜色数。当该域的值等于颜色数时,表示所有颜色都一样重要
调色板数据
0036h
palette
n
*
4
byte
调色板规范。对于调色板中的每个表项,这4个字节用下述方法来描述rgb的值:

1字节用于蓝色分量

1字节用于绿色分量

1字节用于红色分量

1字节用于填充符(设置为0)
位图数据
0436h
bitmap
data
x
bytes
该域的大小取决于压缩方法,它包含所有的位图数据字节,这些数据实际就是彩色调色板的索引号
在这里需要注意的是以上所介绍的是8位bmp文件结构,对于24位bmp文件来说,它是由3个部分组成:位图文件头、位图信息头和位图数据,并没有调色板数据。所以位图数据的偏移量是0036h。而且位图数据区的大小是n*4
bytes,n表示位图中像素点的数目,4个字节对应像素点的红、绿、蓝分量和填充符。
温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜