BMPbase 头文件

来源:互联网 发布:荷兰红灯区 知乎 编辑:程序博客网 时间:2024/06/05 08:14
/* -------------------------------------------------------------------------
// 文件名 BmpBase.h
// 创建者 冯仁昌
// 创建时间 2009-2-4 12:50:56
// 功能描述
//
// $Id: $
// -----------------------------------------------------------------------*/
#ifndef __BMPBASE_H__
#define __BMPBASE_H__


#include <stdlib.h>
#include <iostream>
#include <vector>
using namespace std;


class BmpBase  
{
public:
//图像数据指针
unsigned char * m_pImgData; 


//图像颜色表指针
LPRGBQUAD m_lpColorTable; 


//每像素占的位数
int m_nBitCount;


//文件大小
int m_nFileSize;
//数据长度
DWORD dataLen;
private:
//指向DIB的指针(包含BITMAPFILEHEADER,BITMAPINFOHEADER和颜色表)
LPBYTE m_lpDib;


//图像信息头指针
LPBITMAPINFOHEADER m_lpBmpInfoHead;  


//图像文件头
BITMAPFILEHEADER m_BmpFileHead;


//调色板句柄
HPALETTE m_hPalette;


//颜色表长度
int m_nColorTableLength;


public:
BOOL Read(CSize kSize, int nBitCount, unsigned char*pImgData);
BOOL Read(CSize kSize, int nBitCount, vector<unsigned char> &pImgData);
int GetFileSize();
//不带参数的构造函数
BmpBase();


 
//析构函数
~BmpBase();


//DIB读函数
BOOL Read(LPCTSTR lpszPathName);




//DIB写函数
BOOL Write(LPCTSTR lpszPathName);


//获取DIB的尺寸(宽高)
CSize GetDimensions();


//清理空间
void Empty();


//计算颜色表的长度
int ComputeColorTabalLength(int nBitCount);




public:


//图像的宽,像素为单位
int m_imgWidth;


//图像的高,像素为单位
int m_imgHeight;
};




// -------------------------------------------------------------------------
// $Log: $


#endif /* __BMPBASE_H__ */
0 0