class CDib : public CObject
{
protected:
///use pointer
BITMAPFILEHEADER* m_pFileinfo;//value type?
BITMAPINFOHEADER* m_pBitinfo;//value type
BYTE *m_pImage;//reference type
//the width and height of the image
int W;
int H;
//public:
//set a tag indicates that the data have been readed in.
enum Read{noRead, crtRead};
Read m_pFileinfoRead;
Read m_pBitinfoRead;
Read m_pImageRead;
// const BITMAPINFOHEADER *m_lpBitinfo;
public:
/* BITMAPFILEHEADER* GetFileinfo(){return m_pFileinfo;}
BITMAPINFOHEADER* GetBitinfo(){return m_pBitinfo;}
BYTE* GetpImage(){return m_pImage;}
*/
int GetWidth(){return W;}
int GetHeight(){return H;}
public:
// BOOL LoadDib(LPCTSTR lpszPathName);
BOOL ReadDib(CFile *pFile);
BOOL WriteDib(CFile *pFile);
BOOL DrawDib(CDC* pDC,CPoint origin, CSize size);
BOOL GetRGB(BYTE *m_pR, BYTE *m_pG, BYTE *m_pB);
BOOL UpdataImage(BYTE *m_pR, BYTE *m_pG, BYTE *m_pB);
virtual void Serialize(CArchive &ar);
public:
//default constructor
DECLARE_SERIAL(CDib)
//CDib(){};//not to be used
CDib();//it doesnot matter the constructor is before or behind the DECLARE_SERIAL()
virtual ~CDib();
};
CDib::CDib()
{
m_pBitinfo=NULL;
m_pFileinfo=NULL;
m_pImage=NULL;
//AfxMessageBox("cdib structr");