Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.4 KiB

  1. /*************************************************
  2. * dib.h *
  3. * *
  4. * Copyright (C) 1995-1999 Microsoft Inc. *
  5. * *
  6. *************************************************/
  7. // dib.h : header file
  8. //
  9. // CDIB class
  10. //
  11. #ifndef __DIB__
  12. #define __DIB__
  13. class CDIB : public CObject
  14. {
  15. DECLARE_SERIAL(CDIB)
  16. public:
  17. CDIB();
  18. ~CDIB();
  19. int DibHeight()
  20. {return m_pBMI->bmiHeader.biHeight;}
  21. int DibWidth()
  22. {return m_pBMI->bmiHeader.biWidth;}
  23. int StorageWidth()
  24. {return (m_pBMI->bmiHeader.biWidth + 3) & ~3;}
  25. BITMAPINFO *GetBitmapInfoAddress()
  26. {return m_pBMI;} // ptr to bitmap info
  27. void *GetBitsAddress()
  28. {return m_pBits;} // ptr to the bits
  29. RGBQUAD *GetClrTabAddress()
  30. {return (LPRGBQUAD)(((BYTE *)(m_pBMI))
  31. + sizeof(BITMAPINFOHEADER));} // ptr to color table
  32. int GetNumClrEntries(); // number of color table entries
  33. BOOL Create(int width, int height); // create a new DIB
  34. BOOL Create(BITMAPINFO *pBMI, BYTE *pBits); // create from existing mem,
  35. void Inverse();
  36. void *GetPixelAddress(int x, int y);
  37. virtual BOOL Load(CBitmap* pBitmap);
  38. virtual BOOL Load(CFile *fp); // load from file
  39. virtual BOOL Load(char *pszFileName = NULL);// load DIB from disk file
  40. virtual BOOL Save(char *pszFileName = NULL);// save DIB to disk file
  41. virtual BOOL Save(CFile *fp); // save to file
  42. virtual void Serialize(CArchive& ar);
  43. virtual void Draw(CDC *pDC, int x, int y);
  44. virtual int GetWidth() {return DibWidth();} // image width
  45. virtual int GetHeight() {return DibHeight();} // image height
  46. virtual BOOL MapColorsToPalette(CPalette *pPal);
  47. virtual void GetRect(CRect* pRect);
  48. virtual void CopyBits(CDIB* pDIB,
  49. int xd, int yd,
  50. int w, int h,
  51. int xs, int ys,
  52. COLORREF clrTrans = 0xFFFFFFFF);
  53. protected:
  54. BITMAPINFO *m_pBMI; // pointer to BITMAPINFO struct
  55. BYTE *m_pBits; // pointer to the bits
  56. BOOL m_bMyBits; // TRUE if DIB owns Bits memory
  57. private:
  58. };
  59. #endif // __DIB__