Go to the documentation of this file.00001 #include <fstream>
00002 #include <iostream>
00003 #include <sstream>
00004 #include <unistd.h>
00005
00006
00007 using namespace std;
00008 ostream& printpgm(ostream& os, int xsize, int ysize, const double * const * matrix){
00009 if (!os)
00010 return os;
00011 os<< "P5" << endl << xsize << endl << ysize << endl << 255 << endl;
00012 for (int y=ysize-1; y>=0; y--){
00013 for (int x=0;x<xsize; x++){
00014 unsigned char c=(unsigned char)(255*fabs(1.-matrix[x][y]));
00015 os.put(c);
00016 }
00017 }
00018 return os;
00019 }