00001 00008 #ifndef CWINDOWSBITMAP_H 00009 #define CWINDOWSBITMAP_H 00010 00011 #include <stdint.h> 00012 #include "cbitmap.h" 00013 00020 class CWindowsBitmap : public CBitmap 00021 { 00022 public: 00032 CWindowsBitmap(); 00033 00043 ~CWindowsBitmap() 00044 {} 00045 00057 void read(std::ifstream& in); 00058 00069 void write(std::ofstream& out); 00070 00071 #ifdef DEBUG 00072 00081 void dump(std::ostream& out); 00082 #endif 00083 00093 const uint32_t getPixelDataSize() 00094 { 00095 return m_infoheader.biSizeImage; 00096 } 00097 00107 const uint32_t getHeight() 00108 { 00109 /* width and height can be negativ */ 00110 return static_cast<uint32_t>(abs(m_infoheader.biHeight)); 00111 } 00112 00122 const uint32_t getWidth() 00123 { 00124 /* width and height can be negativ */ 00125 return static_cast<uint32_t>(abs(m_infoheader.biWidth)); 00126 } 00127 00137 const bool isMirrored() 00138 { 00139 /* if height is positive the y-coordinates are mirrored */ 00140 return (m_infoheader.biHeight > 0) ? true : false; 00141 } 00142 00153 const bool hasColorTable() 00154 { 00155 return false; 00156 } 00157 00158 protected: 00162 #pragma pack(push,1) 00163 typedef struct 00164 { 00166 uint8_t bfType[2]; 00168 uint32_t bfSize; 00170 uint32_t bfReserved; 00172 uint32_t bfOffBits; 00173 } BITMAP_FILEHEADER; 00174 #pragma pack(pop) 00175 00179 #pragma pack(push,1) 00180 typedef struct 00181 { 00183 uint32_t biSize; 00185 int32_t biWidth; 00187 int32_t biHeight; 00189 uint16_t biPlanes; 00191 uint16_t biBitCount; 00193 uint32_t biCompression; 00195 uint32_t biSizeImage; 00197 int32_t biXPelsPerMeter; 00199 int32_t biYPelsPerMeter; 00201 uint32_t biClrUsed; 00204 uint32_t biClrImportant; 00205 } BITMAP_INFOHEADER; 00206 #pragma pack(pop) 00207 00208 /* members */ 00210 BITMAP_FILEHEADER m_fileheader; 00212 BITMAP_INFOHEADER m_infoheader; 00213 }; 00214 00215 #endif 00216 00217 /* vim: set et sw=2 ts=2: */
1.5.3