Brian and Ian:
I also thought of the offscreen. I did a slight modification of the
save_pnm function, but to no avail. I am adding the code here:
int save_pnm(const char *name, Fl_Double_Window *win){
Fl_Offscreen off = fl_create_offscreen(win->w(), win->h());
FILE *fp;
if ((fp = fopen(name, "w+")) == 0) {
perror("open");
exit(1);
}
uchar *buf = (uchar*)malloc(3*win->w()*win->h()*sizeof(uchar));
// Added from here...
fl_begin_offscreen(off);
win->make_current();
win->redraw();
Fl::check();
fl_end_offscreen();
// ...to here.
fl_read_image(buf, 0, 0, win->w(), win->h());
fprintf(fp, "P6\n%d %d\n255\n", win->w(), win->h());
fwrite((unsigned char *)buf, win->w() * win->h() * 3, 1, fp);
fclose(fp);
free(buf);
fl_delete_offscreen(off); // Release the offscreen
return 0;
}
It's so weird. Thanks again,
Rodrigo
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk