factor/basis/ui/pens/image/image.factor

22 lines
650 B
Factor
Raw Normal View History

2009-02-12 04:58:42 -05:00
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors sequences fry math
2009-02-14 20:50:22 -05:00
opengl ui.pens ui.images io.pathnames ;
2009-02-12 04:58:42 -05:00
IN: ui.pens.image
! Image pen
TUPLE: image-pen image fill? ;
: <image-pen> ( image -- pen ) f image-pen boa ;
M: image-pen draw-interior
[ dim>> ] [ [ image>> ] [ fill?>> ] bi ] bi*
[ draw-scaled-image ] [
2009-02-15 03:15:51 -05:00
[ image-dim [ - 2 /i ] 2map ] keep
2009-02-12 04:58:42 -05:00
'[ _ draw-image ] with-translation
] if ;
2009-02-14 20:50:22 -05:00
M: image-pen pen-pref-dim nip image>> image-dim ;
: theme-image ( name -- image-name )
2009-02-15 22:09:09 -05:00
"vocab:ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ;