00001 #ifndef _BMPFile_H
00002 #define _BMPFile_H
00003
00004
00005
00024 #ifdef _WINDOWS_USED_
00025
00026 extern "C"
00027 {
00028 #include <windows.h>
00029 }
00030
00031
00032
00033 #define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
00034 #define BMP_HEADERSIZE (3 * 2 + 4 * 12)
00035 #define BMP_BYTESPERLINE (width, bits) ((((width) * (bits) + 31) / 32) * 4)
00036 #define BMP_PIXELSIZE(width, height, bits) (((((width) * (bits) + 31) / 32) * 4) * height)
00037
00038 #endif // #ifdef _WINDOWS_USED_
00039
00040 class BMPFile
00041 {
00042 public:
00043
00044
00045
00046 BMPFile();
00047
00048 #ifdef _WINDOWS_USED_
00049
00050 BYTE * loadBMP(const char* fileName, int *width, int *height, int* channels);
00051
00052 void saveBMP(const char* fileName,
00053 BYTE * buf,
00054 int width,
00055 int height);
00056
00057 void saveBMP(const char* fileName,
00058 BYTE * colormappedbuffer,
00059 int width,
00060 int height,
00061 int bitsperpixel,
00062 int colors,
00063 RGBQUAD *colormap);
00064
00065 public:
00066
00067 DWORD m_bytesRead;
00068
00069 #endif // #ifdef _WINDOWS_USED_
00070
00071 };
00072
00073 #endif