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.

65 lines
1.1 KiB

  1. #ifndef __DIBCLASSES_H
  2. #define __DIBCLASSES_H
  3. //
  4. // class CDibFile
  5. //
  6. class CDibFile
  7. {
  8. public:
  9. CDibFile();
  10. ~CDibFile();
  11. HRESULT GetFileHeader(IStream *);
  12. HRESULT GetInfoHeader(IStream *);
  13. DWORD HeaderSize() { return(m_headerSize); }
  14. DWORD CalcImageSize();
  15. operator BITMAPINFO * () { return(m_bmi.p); }
  16. operator BITMAPINFOHEADER * () { return(&m_bmi.p->bmiHeader); }
  17. private:
  18. DWORD m_headerSize;
  19. union
  20. {
  21. BITMAPINFO * p;
  22. unsigned char * bytes;
  23. } m_bmi;
  24. };
  25. class CDibSection
  26. {
  27. public:
  28. CDibSection();
  29. ~CDibSection();
  30. HRESULT Create ( CDibFile& );
  31. HRESULT Setup ( HDC basedOnThisDC);
  32. HRESULT ReadFrom( IStream * strm, DWORD amount );
  33. HRESULT PaintTo ( HDC hdc, int x = 0, int y = 0 );
  34. HRESULT GetSize ( SIZEL &sz);
  35. DWORD ImageSize() { return(m_imageSize); }
  36. void ImageSize(DWORD dw) { m_imageSize = dw; }
  37. operator HANDLE() { return m_handle; }
  38. unsigned char * Base() { return(m_bitsBase); }
  39. private:
  40. unsigned char * m_bitsBase;
  41. unsigned char * m_current;
  42. HDC m_memDC;
  43. HBITMAP m_handle;
  44. HBITMAP m_oldBitmap;
  45. LONG m_h;
  46. LONG m_w;
  47. DWORD m_imageSize;
  48. };
  49. #endif __DIBCLASSES_H