00001 00008 #ifndef CBITMAP_H 00009 #define CBITMAP_H 00010 00011 #include <stdint.h> 00012 #include <map> 00013 #include "cfile.h" 00014 #include "cpixelformat.h" 00015 00026 class CBitmap : public CFile 00027 { 00028 public: 00038 CBitmap() 00039 : m_pixeldata(NULL), m_pixelformat(NULL), m_rowsize(0) 00040 {} 00041 00042 00052 virtual ~CBitmap(); 00053 00065 virtual void read(std::ifstream& in) = 0; 00066 00077 virtual void write(std::ofstream& out) = 0; 00078 00088 uint8_t *getPixelData() 00089 { 00090 return m_pixeldata; 00091 } 00092 00102 std::map<uint32_t, CPixelFormat::RGBPIXEL *>& getColorTable() 00103 { 00104 return m_colortable; 00105 } 00106 00116 uint32_t getRowSize() 00117 { 00118 return m_rowsize; 00119 } 00120 00130 virtual const uint32_t getPixelDataSize() = 0; 00131 00141 virtual const uint32_t getHeight() = 0; 00142 00152 virtual const uint32_t getWidth() = 0; 00153 00163 virtual const bool isMirrored() = 0; 00164 00175 virtual const bool hasColorTable() = 0; 00176 00177 protected: 00189 void callFunc(const std::string& func, const std::list<std::string>& params); 00190 00203 void fillrect(std::list<std::string> params); 00204 00216 void invert(std::list<std::string> params); 00217 00229 void brightness(std::list<std::string> params); 00230 00242 void mirror_y(std::list<std::string> params); 00243 00255 void mirror_x(std::list<std::string> params); 00256 00257 /* members */ 00259 uint8_t *m_pixeldata; 00261 std::map<uint32_t, CPixelFormat::RGBPIXEL *> m_colortable; 00263 std::set<CPixelFormat *> m_handlers; 00265 CPixelFormat *m_pixelformat; 00267 uint32_t m_rowsize; 00268 }; 00269 00270 #endif 00271 00272 /* vim: set et sw=2 ts=2: */
1.5.3