00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _CANVAS_H_
00012 #define _CANVAS_H_
00013
00014 #include "Point.h"
00015 #include "color.h"
00016
00017 #include <string>
00018
00019
00020 using namespace std;
00021
00022 class Canvas
00023 {
00024 public:
00025 Canvas(int resoH = 512, int resoV = 512) : hReso(resoH), vReso(resoV), filename("tmp.ppm"), rgbs(0) { init(); }
00026
00027 ~Canvas() { delete [] rgbs; }
00028
00029 RGB& Pixel(int row, int col) { }
00030
00031 void WritePPM(const char* = 0) const;
00032 void ReadPPM(const string&);
00033
00034 int hReso, vReso;
00035 std::string filename;
00036 RGB* rgbs;
00037 private:
00038 void init();
00039 RGB& pixel(int row, int col) { return *(rgbs + row * hReso + col); }
00040 };
00041
00042 #endif