Want to learn the reading and writing and display of a bitmap, or you have to write a CDIB class yourself.

xiaoxiao2021-03-06  76

I want to write a CDIB class to inherit from the COBJECT class.

class CDIB: public CObject {DECLARE_SERIAL (CDIB); public: virtual void Serialize (CArchive & ar); virtual BOOL DrawDib (CDC * pDC, int xDest, int yDest); // ÏÔʾΠ»Í¼ BOOL CloseFile (); // ¹Ø ± Õõ »í4îä1/// '' '1/1 ððμμäî» í4îä1/4 £ £ ¬ ¬¾ ¾2îêêwidth, Height, Nbitcounts · öåääú'æ¿ Õ¼ä BOOL Create (int width, int height, int nBitCounts); CDIB (); virtual ~ CDIB (); CDIB (int width, int height, int nBitCounts); BOOL ReadFile (CFile * pFile); //'ÓBMPÎļþÖжÁÈëDIBÐÅÏ ¢ //'ÓBMPÎļþÖжÁÈëDIBÐÅÏ ¢, ÓëReadFile² »Í¬μÄÊÇʹÓÃCreateSection''½¨Î» ͼΠ»BOOL ReadSection (CFile * pFile, CDC * pDC = NULL); // ½« DIBÐ'ÈëÎļþ £ ¬ ± £'æ³ÉBMPͼƬ ¸ñê1/2 bool writefile (cfile * pfile);

BITMAPINFO * GetBitmapInfoAddress () {return m_pBMI;} BYTE * GetBitsAddress () {return m_pDIBits;} RGBQUAD * GetClrTabAdress () {return (LPRGBQUAD) (((BYTE *) (m_pBMI)) sizeof (BITMAPINFOHEADER));}

protected: void FreeStuff (); BITMAPINFO * m_pBMI; // BYTE * m_pDIBits; // Ö¸ÏòÊý¾ÝÎ »private: int DibHeight () {return m_pBMI-> bmiHeader.biHeight;} int DibWidth () {return m_pBMI-> bmiHeader. BiWidth;}}

CDIB :: CDIB () {m_pbmi = null; m_pdibits = null;}

CDIB :: CDIB (int width, int hotht, int nbitcounts) {

}

CDIB :: ~ cdib () {freeestuff ();

BOOL CDIB :: ReadFile (CFILE * PFILE) {

}

Bool CDIB :: Readsection (cfile * pfile, cdc * pdc) {

}

Bool CDIB :: Writefile (cfile * pfile) {

}

Bool CDIB :: Create (int Width, int Height, int nbitcounts) {

}

Bool CDIB :: Closefile () {

}

Bool CDIB :: DrawDIB (CDC * PDC, INT XDEST, INT YDEST) {:: StretchDibits (PDC-> GetsafeHDC (), XDest, YDEST, M_DESTSIZE.CX, M_Destsize.cy, 0, 0, Dibwidth (), Dibheight ( ), M_pdibits, (lpbitmapInfo) m_pbmi, dib_rgb_colors, srccopy;

}

Void CDIB :: Serialize (CARCHIVE & AR) {}

Void cdib :: freestuff () {// çå3ý3éô ± Äá¿ Ö¸òμμää'æ, êí · åäú'æ if (m_pbmi! = Null) free (m_pbmi); if (m_pdibits! = Null) free (m_pdibits);

}

转载请注明原文地址:https://www.9cbs.com/read-121889.html

New Post(0)