1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel accessors opengl math colors ui.pens ui.pens.caching ;
6 TUPLE: solid < caching-pen color interior-vertices boundary-vertices ;
8 : <solid> ( color -- solid ) solid new swap >>color ;
10 M: solid recompute-pen
12 [ [ { 0 0 } ] dip (fill-rect-vertices) >>interior-vertices ]
13 [ [ { 0 0 } ] dip (rect-vertices) >>boundary-vertices ]
18 : (solid) ( gadget pen -- )
19 [ compute-pen ] [ color>> gl-color ] bi ;
23 M: solid draw-interior
24 [ (solid) ] [ interior-vertices>> gl-vertex-pointer ] bi
27 M: solid draw-boundary
28 [ (solid) ] [ boundary-vertices>> gl-vertex-pointer ] bi
31 M: solid pen-background
32 nip color>> dup alpha>> 1 number= [ drop transparent ] unless ;