00001 #ifndef PNGIMAGE_H 00002 #define PNGIMAGE_H 00003 00004 #include<exception> 00005 00006 #include "Image.h" 00007 00008 00013 class PNGImage : public Image 00014 { 00015 public: 00021 PNGImage(int resX, int resY); 00022 00025 virtual ~PNGImage(); 00026 00032 virtual bool read(const std::string & fileName); 00033 00038 virtual void write(const std::string & fileName) const; 00039 00040 00041 00042 private: 00043 00047 class PNGFileOpenException : public std::exception 00048 { 00049 public: 00050 00053 PNGFileOpenException(const std::string filename) : mFileName(filename) 00054 {} 00055 00056 virtual ~PNGFileOpenException() throw() {} 00057 00060 const char* what() const throw() 00061 { 00062 std::string error = "Exception in PNGParser\n This file returned a bad status: \""; 00063 error += mFileName; 00064 error += "\""; 00065 return error.c_str(); 00066 } 00067 00068 private: 00069 const std::string mFileName; 00070 }; 00071 }; 00072 00073 00074 #endif 00075