home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c12 / lab01 / ex02 / dib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  1.7 KB  |  66 lines

  1. // CDIB.h : header file
  2. //
  3.  
  4. #ifndef __CDIB__
  5. #define __CDIB__
  6.  
  7.  
  8. BOOL IsWinDIB(BITMAPINFOHEADER* pBIH);
  9. int NumDIBColorBits(LPBITMAPINFO pBmpInfo);
  10. int NumDIBColorEntries(LPBITMAPINFO pBmpInfo);
  11.  
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CDIB Class
  14.  
  15. class CDIB : public CObject
  16. {
  17. // Construction
  18. public:
  19.     CDIB();
  20.     DECLARE_SERIAL(CDIB)
  21.  
  22. // Attributes
  23. public:
  24.     BITMAPINFO* GetBitmapInfoAddress() const
  25.             {return m_pBMI;}                        // Pointer to bitmap info
  26.     BYTE* GetBitsAddress() const
  27.             {return m_pBits;}                       // Pointer to the bits
  28.     RGBQUAD* GetClrTabAddress() const
  29.             {return (LPRGBQUAD)(((BYTE*)(m_pBMI)) +
  30.                      sizeof(BITMAPINFOHEADER));}    // Pointer to color table
  31.     int    DibWidth() const 
  32.             {return m_pBMI->bmiHeader.biWidth;}
  33.     int    DibHeight() const 
  34.             {return m_pBMI->bmiHeader.biHeight;}
  35.     int GetNumClrEntries();                    // Number of color table entries
  36.     LONG ScanLineWidth() const;
  37.     
  38.                                              
  39. // Operations
  40. public:
  41.     virtual BOOL Create(int width, int height);        // Create a new DIB
  42.     virtual BOOL Load(CFile* fp);                    // Load from file
  43.     virtual BOOL Save(CFile* fp);                    // Save to file
  44.  
  45. // Overrides
  46.     // ClassWizard generated virtual function overrides
  47.     //{{AFX_VIRTUAL(CDIB)
  48.     virtual void Serialize(CArchive& ar);
  49.     //}}AFX_VIRTUAL
  50.  
  51. // Implementation
  52. public:
  53.     virtual ~CDIB();
  54. #ifdef _DEBUG
  55.     virtual void AssertValid() const;
  56.     virtual void Dump(CDumpContext& dc) const;
  57. #endif
  58. protected:
  59.     BITMAPINFO*    m_pBMI;
  60.     BYTE*        m_pBits;
  61. };
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64.  
  65. #endif
  66.