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.

112 lines
1.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: bmpfile.hxx
  7. //
  8. // Contents: CBitmapFile
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 4-23-94 KirtD Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #if !defined(__BMPFILE_HXX__)
  18. #define __BMPFILE_HXX__
  19. //
  20. // Data structures and definitions
  21. //
  22. #define BMP_24_BITSPERPIXEL 24
  23. #define BMP_16_BITSPERPIXEL 16
  24. #define BMP_32_BITSPERPIXEL 32
  25. typedef BITMAPINFO *LPBITMAPINFO;
  26. //
  27. // Class definition
  28. //
  29. class CBitmapFile
  30. {
  31. public:
  32. //
  33. // Constructor
  34. //
  35. CBitmapFile ();
  36. //
  37. // Destructor
  38. //
  39. ~CBitmapFile ();
  40. //
  41. // Load and related methods
  42. //
  43. HRESULT LoadBitmapFile (LPSTR pszFile);
  44. HRESULT GetBitmapFileName (LPSTR pszFile, ULONG cChar) const;
  45. ULONG GetBitmapFileNameLength () const;
  46. //
  47. // Data access methods
  48. //
  49. LONG GetDIBHeight () const;
  50. LONG GetDIBWidth () const;
  51. HRESULT GetLogicalPalette (LPLOGPALETTE *pplogpal) const;
  52. HRESULT CreateDIBInHGlobal (HGLOBAL *phGlobal) const;
  53. BOOL HasPaletteData () const;
  54. //
  55. // Member access
  56. //
  57. LPBITMAPINFO GetBitmapInfo ();
  58. LPBYTE GetDIBBits ();
  59. private:
  60. //
  61. // Private data
  62. //
  63. //
  64. // The file name
  65. //
  66. CHAR _pszBitmapFile[MAX_PATH];
  67. ULONG _cBitmapFile;
  68. //
  69. // The bitmap info structure
  70. //
  71. ULONG _cbi;
  72. BITMAPINFO *_pbi;
  73. //
  74. // The bits
  75. //
  76. ULONG _cbData;
  77. LPBYTE _pbData;
  78. //
  79. // Private methods
  80. //
  81. HRESULT _GetBitmapDataFromBuffer (LPBYTE pbuffer, ULONG cbLow);
  82. HRESULT _ValidateBitmapFileHeader (BITMAPFILEHEADER *pbmfh, ULONG cbFile);
  83. };
  84. #endif