现在的位置: 首页 > 综合 > 正文

获取BMP每行像素的字节数!

2013年10月06日 ⁄ 综合 ⁄ 共 804字 ⁄ 字号 评论关闭
文章目录

参考: 

(biWidth* biBitCount+31)/32*4

// +31是为了凑足32位,/32 得到有多少个 32位,也就是多少个 4字节, *4 得到多少个字节

 

typedef struct tagBITMAPINFO { 
  BITMAPINFOHEADER bmiHeader; 
  RGBQUAD          bmiColors[1]; 
} BITMAPINFO, *PBITMAPINFO; 
typedef struct tagBITMAPINFOHEADER { 
  DWORD biSize; 
  LONG biWidth; 
  LONG biHeight; 
  WORD biPlanes; 
  WORD biBitCount 
  DWORD biCompression; 
  DWORD biSizeImage; 
  LONG biXPelsPerMeter; 
  LONG biYPelsPerMeter; 
  DWORD biClrUsed; 
  DWORD biClrImportant; 
} BITMAPINFOHEADER; 

(biWidth* biBitCount+31)/32*4

// +31是为了凑足32位,/32 得到有多少个 32位,也就是多少个 4字节, *4 得到多少个字节

 

typedef struct tagBITMAPINFO { 
  BITMAPINFOHEADER bmiHeader; 
  RGBQUAD          bmiColors[1]; 
} BITMAPINFO, *PBITMAPINFO; 
typedef struct tagBITMAPINFOHEADER { 
  DWORD biSize; 
  LONG biWidth; 
  LONG biHeight; 
  WORD biPlanes; 
  WORD biBitCount 
  DWORD biCompression; 
  DWORD biSizeImage; 
  LONG biXPelsPerMeter; 
  LONG biYPelsPerMeter; 
  DWORD biClrUsed; 
  DWORD biClrImportant; 
} BITMAPINFOHEADER; 

抱歉!评论已关闭.