> Is there a special way to connect fl_read_image() to offscreen buffer?
> Maybe the real problem comes from this function? Do I need some
> make_current()? But I'm using the offscreen inside of draw(), so drawing
> should work.
You need to "begin" the offscreen just before you call fl_read_image() and
"end" it once the read is complete. You can do that pretty much anywhere, not
just in a draw method, and that's one of the "advantages" of using the
offscreen approach...
/*****************************************************************************/
uchar *data_p = NULL;
static void cb_bt_grab(Fl_Button*, void*)
{
if(oscr) { // offscreen exists, grab something
if(data_p){
delete[] data_p;
data_p = NULL;
}
fl_begin_offscreen(oscr); /* Open the offscreen context for
drawing */
data_p = fl_read_image(data_p, 0, 0, os_w, os_h, 0);
write_png("Test1.png", data_p, os_w, os_h, 3, "SS7K-imageV2",
"Fixed Text String");
fl_end_offscreen(); // close the offscreen context
}
} // cb_bt_grab
/*****************************************************************************/
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk