Rodrigo Morante wrote:
> 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();
// move ...
// fl_end_offscreen(); from here ...
> // ...to here.
>
> fl_read_image(buf, 0, 0, win->w(), win->h());
// to here, _after_ fl_read_image():
fl_end_offscreen();
Does this work better? If I'm right, your modification didn't change anything,
because fl_end_offscreen switches the context back to the normal window
context.
However, you want to read the _offscreen_ image.
I didn't test your program, but this seemed to be wrong.
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk