1 ! (c) 2008 Joe Groff, see license for details
2 USING: accessors continuations graphics.bitmap kernel math
3 sequences ui.gadgets ui.gadgets.worlds ui ui.backend
7 TUPLE: offscreen-world < world ;
9 : <offscreen-world> ( gadget title status -- world )
10 offscreen-world new-world ;
12 M: offscreen-world graft*
13 (open-offscreen-buffer) ;
15 M: offscreen-world ungraft*
17 [ handle>> (close-offscreen-buffer) ]
20 : open-offscreen ( gadget -- world )
21 "" f <offscreen-world>
22 [ open-world-window dup relayout-1 ] keep
25 : close-offscreen ( world -- )
26 ungraft notify-queued ;
28 : offscreen-world>bitmap ( world -- bitmap )
29 offscreen-pixels bgra>bitmap ;
31 : do-offscreen ( gadget quot: ( offscreen-world -- ) -- )
32 [ open-offscreen ] dip
33 over [ slip ] [ close-offscreen ] [ ] cleanup ; inline
35 : gadget>bitmap ( gadget -- bitmap )
36 [ offscreen-world>bitmap ] do-offscreen ;