remove math.blas.syntax and merge parsing words into math.blas.vectors/matrices
[factor/jcg.git] / extra / ui / offscreen / offscreen.factor
blob89c1c7f860940ec06fb152806c888e6c72f894dc
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
4 destructors ;
5 IN: ui.offscreen
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*
16     [ (ungraft-world) ]
17     [ handle>> (close-offscreen-buffer) ]
18     [ reset-world ] tri ;
20 : open-offscreen ( gadget -- world )
21     "" f <offscreen-world>
22     [ open-world-window dup relayout-1 ] keep
23     notify-queued ;
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 ;