Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

template<class ArrayT>
void Impala::Core::Array::WritePgm ( ArrayT *  src,
std::string  fileName 
) [inline]

Definition at line 20 of file WritePgm.h.

Referenced by Impala::Application::Src::WindowSrc::HandleNewFrame().

00021 {
00022     typedef typename ArrayT::StorType StorT;
00023 
00024     int width = src->CW();
00025     int height = src->CH();
00026     int elemSize = ArrayT::ElemSize();
00027     FILE* fp = fopen(fileName.c_str(), "wb");
00028     fprintf(fp, "P5\n%d %d\n255\n", width, height);
00029     std::string fs = NativeTypeFormat<StorT>(0) + std::string(" ");
00030     for (int i=0 ; i<height ; i++)
00031     {
00032         StorT* srcPtr = src->CPB(0, i);
00033         for(int j=0 ; j<width ; j++)
00034         {
00035             fputc(*srcPtr, fp);
00036             for (int k=0 ; k<elemSize ; k++)
00037                 srcPtr++;
00038         }
00039     }
00040     fclose(fp);
00041 }


Generated on Fri Mar 19 10:58:52 2010 for ImpalaSrc by  doxygen 1.5.1