00001 00008 #ifndef CBITMAP_H 00009 #define CBITMAP_H 00010 00011 #include "cfile.h" 00012 00013 class CPixelFormat; 00014 #include "cpixelformat.h" 00015 00026 class CBitmap : public CFile 00027 { 00028 public: 00038 CBitmap() 00039 : m_pixeldata(NULL), m_pixelformat(NULL) 00040 { 00041 m_types.insert("BMP"); 00042 } 00043 00053 ~CBitmap(); 00054 00066 void read(std::ifstream& in); 00067 00078 void write(std::ofstream& out); 00079 00091 void callFunc(const std::string& func, const std::list<std::string>& params); 00092 00093 #ifdef DEBUG 00094 00103 void dump(std::ostream& out); 00104 #endif 00105 00109 #pragma pack(push,1) 00110 typedef struct 00111 { 00113 uint8_t bfType[2]; 00115 uint32_t bfSize; 00117 uint32_t bfReserved; 00119 uint32_t bfOffBits; 00120 } BITMAP_FILEHEADER; 00121 #pragma pack(pop) 00122 00126 #pragma pack(push,1) 00127 typedef struct 00128 { 00130 uint32_t biSize; 00132 int32_t biWidth; 00134 int32_t biHeight; 00136 uint16_t biPlanes; 00138 uint16_t biBitCount; 00140 uint32_t biCompression; 00142 uint32_t biSizeImage; 00144 int32_t biXPelsPerMeter; 00146 int32_t biYPelsPerMeter; 00148 uint32_t biClrUsed; 00151 uint32_t biClrImportant; 00152 } BITMAP_INFOHEADER; 00153 #pragma pack(pop) 00154 00164 BITMAP_FILEHEADER &getFileHeader() 00165 { 00166 return m_fileheader; 00167 } 00168 00178 BITMAP_INFOHEADER &getInfoHeader() 00179 { 00180 return m_infoheader; 00181 } 00182 00192 uint8_t *getPixelData() 00193 { 00194 return m_pixeldata; 00195 } 00196 00197 protected: 00210 void fillrect(std::list<std::string> params); 00211 00212 /* members */ 00214 BITMAP_FILEHEADER m_fileheader; 00216 BITMAP_INFOHEADER m_infoheader; 00218 uint8_t *m_pixeldata; 00220 CPixelFormat *m_pixelformat; 00221 }; 00222 00223 #endif 00224 00225 /* vim: set et sw=2 ts=2: */
1.5.3