extra/cap: clean up cap:screenshot, move non-public API to cap.private

factor-shell
Cat Stevens 2018-01-04 22:49:20 -05:00 committed by John Benediktsson
parent b436d4af96
commit 2d084c3178
1 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,8 @@ models namespaces opengl opengl.gl sequences ui ui.gadgets
ui.gadgets.worlds ;
IN: cap
<PRIVATE
: screenshot-array ( world -- byte-array )
dim>> [ first 4 * ] [ second ] bi
[ gl-scale ] bi@ * >fixnum <byte-array> ;
@ -23,10 +25,11 @@ IN: cap
[ screenshot-array ] bi
[ glReadPixels ] keep ;
PRIVATE>
: screenshot ( window -- bitmap )
[ <image>
gl-scale-factor get-global
[ >integer 2 = [ >>2x? ] when* ] when*
gl-scale-factor get-global [ 2.0 = >>2x? ] when*
] dip
[ gl-screenshot >>bitmap ]
[ dim>> [ gl-scale >fixnum ] map >>dim ] bi