18 struct timeval *date,
const TVector2 xy)
22 mjd += t.GetMjd()-52000;
23 mjd = mjd.Strip(TString::kBoth);
25 mjd.Append(
'0', 10-mjd.Length());
29 pos = pos.Strip(TString::kBoth);
33 posy = posy.Strip(TString::kBoth);
43 cout <<
"Writing PNG '" << name <<
"'" << endl;
48 FILE *fd = fopen(name,
"w");
51 cout <<
"Warning: Cannot open file for writing." << endl;
58 png_structp fPng = png_create_write_struct(PNG_LIBPNG_VER_STRING,
63 cout <<
"Warning: Unable to create PNG structure" << endl;
69 png_infop fInfo = png_create_info_struct(fPng);
73 cout <<
"Warning: Unable to create PNG info structure" << endl;
74 png_destroy_write_struct (&fPng, NULL);
82 fInfo->color_type = PNG_COLOR_TYPE_GRAY;
87 if (setjmp(fPng->jmpbuf))
89 cout <<
"longjmp Warning: PNG encounterd an error!" << endl;
90 png_destroy_write_struct (&fPng, &fInfo);
98 png_init_io(fPng, fd);
105 png_write_info (fPng, fInfo);
126 for (
unsigned int y=0; y<768*576; y+=768)
127 png_write_row (fPng, (png_byte*)buf+y);
132 png_write_end (fPng, fInfo);
137 png_destroy_write_struct (&fPng, &fInfo);
142 void Writer::Ppm(
const char *fname,
const byte *img,
struct timeval *date,
const TVector2 xy)
144 TString
name = fname;
150 pos = pos.Strip(TString::kBoth);
154 posy = posy.Strip(TString::kBoth);
158 name += t.GetMjd()-52000;
163 cout <<
"Writing PPM '" << name <<
"'" << endl;
171 cout <<
"Warning: Cannot open file for writing." << endl;
178 fout <<
"P6\n768 576\n255\n";
179 for (
byte const *buf = img; buf < img+768*576; buf++)
180 fout << *buf << *buf << *buf;
static void Ppm(const char *fname, const byte *img, struct timeval *date, const TVector2 xy)
static void Png(const char *fname, const byte *buf, struct timeval *date, const TVector2 xy)