1 ! Copyright (C) 2007 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays kernel math math.functions namespaces opengl
4 ui.gadgets ui.render accessors ;
7 TUPLE: graphics-gadget < gadget image ;
9 GENERIC: draw-image ( image -- )
10 GENERIC: width ( image -- w )
11 GENERIC: height ( image -- h )
13 M: graphics-gadget pref-dim*
14 image>> [ width ] keep height abs 2array ;
16 M: graphics-gadget draw-gadget* ( gadget -- )
17 origin get [ image>> draw-image ] with-translation ;
19 : <graphics-gadget> ( bitmap -- gadget )
20 \ graphics-gadget new-gadget