2011年3月22日 星期二

Bitmap Format

Note how to read bitmap data
Reference from http://crazycat1130.pixnet.net/blog/post/1345538

-----------------------------
Overview Bitmap Byte File

bitmap file make up of four parts
  • Bitmap File Header
  • Bitmap Info Header
  • Color Table (Palette)
  • Bitmap Array
All words was shown in little-endian mode.
It's mean if value is 0x1234, you will look it display 0x3412.
example shown as a 8X8 pixels all fill red color bitmap file


Bitmap File Header
0000h - 0001h : Identifier  ('BM') [1]
0002h - 0005h : File Size (byte)
0006h - 0009h : Reserved
000Ah - 000Dh : Bitmap Data Offset

Example: 
 
 
  
0000
42

Identifier BM
42H=66D='B' , 4DH=77D='M'
0001
4D
0002
F6

because Little-Endian, so writing F6000000H

File Size 246 byte
F6H=246D
Header 54 + Content 192 (8 X 8 X 3) = 246
0003
00
0004
00
0005
00
0006
00
Reserved

0007
00
0008
00
0009
00
000A
36
Bitmap Data Offset 54 byte
It's also mean the size of file header
000B
00
000C
00
000D
00



 

Annotations
【1】This field includes verious code for identify type of bitmap:
    '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


to be continue...



沒有留言:

張貼留言