On 10 Apr 2010, at 15:05, nigo wrote:

> Hi,
>
> is it possible to draw the contents of a widget hierarchy ito a  
> memory buffer?
> Grabbing screen contents after normal redraw is not good enough due  
> to potential overlapping windows over the area.

Yes, it is.

I was going to post some simplified example code, but the I  
remembered the example was made up for this STR anyway...

http://www.fltk.org/str.php?L2257

So the code that's there "offscreen-grab.cxx" shows how to redirect  
drawing of the widget hierarchy on a group, such that it is stored in  
an offscreen memory buffer, from which it can safely be read back  
without having to worry about being overlaid by other windows.

In fact, for simplicity, this example *always* draws into the  
offscreen, then blits the interesting bit from the offscreen back  
onto the real screen, but in practice what you would probably do is  
*usually* draw direct to the real screen, and only during your effect  
would you redirect via the offscreen.

Also, note that with fltk-1.3 on OSX, at present, reading back from  
the offscreen can be a little bit hosed. Works fine on X11 and win32  
though, and fltk-1.1 works fine, and AFAIK fltk2 works fine.

What fltk version, host, etc are you targeting?
-- 
Ian





_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to