00001
00002
00003
00004
00005
00006
00007
00008 #ifndef BMPFILE_H_
00009 #define BMPFILE_H_
00010
00011 #include <iostream>
00012 #include <fstream>
00013 #include <string>
00014 #include <cstdio>
00015
00016 using namespace std;
00017
00018 typedef unsigned int uint;
00019 typedef unsigned short ushort;
00020 typedef unsigned char uchar;
00021
00022 struct BMPHeader
00023 {
00024 uchar magic[2];
00025 uint fileSize;
00026 uint reserved;
00027 uint pixMapOffset;
00028 };
00029
00030 struct BMPInfo {
00031 uint headerSize;
00032 int width;
00033 int height;
00034 ushort nPlanes;
00035 ushort bitCount;
00036 uint compression;
00037 uint pixMapSize;
00038 int hRes;
00039 int vRes;
00040 uint nColors;
00041 uint nImpColors;
00042 };
00043
00044
00045
00046
00047
00048
00049
00050
00051 class BMPFile
00052 {
00053 public:
00054 BMPHeader header;
00055 BMPInfo info;
00056 char *data;
00057
00058 BMPFile(){ data=NULL;
00059 };
00060 ~BMPFile(){ if (data!=NULL) delete(data); };
00061 };
00062
00063
00064 BMPFile* loadBMPFile(std::string fileName);
00065 #endif