]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/pens/image/image.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / ui / pens / image / image.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel accessors sequences fry math
4 opengl ui.pens ui.images io.pathnames ;
5 IN: ui.pens.image
6
7 ! Image pen
8 TUPLE: image-pen image fill? ;
9
10 : <image-pen> ( image-name -- pen ) f image-pen boa ;
11
12 M: image-pen draw-interior
13     [ dim>> ] [ [ image>> ] [ fill?>> ] bi ] bi*
14     [ draw-scaled-image ] [
15         [ image-dim [ - 2 /i ] 2map ] keep
16         '[ _ draw-image ] with-translation
17     ] if ;
18
19 M: image-pen pen-pref-dim nip image>> image-dim ;