M: object v= [ = ] 2map ; inline
GENERIC: v? ( mask true false -- result )
-M: object v?
+M: object v?
[ vand ] [ vandn ] bi-curry* bi vor ; inline
: vif ( mask true-quot: ( -- vector ) false-quot: ( -- vector ) -- result )
[ [ call ] dip call v? ]
} cond ; inline
+: v>integer ( u -- v ) [ >integer ] map ;
: vfloor ( u -- v ) [ floor ] map ;
: vceiling ( u -- v ) [ ceiling ] map ;
: vtruncate ( u -- v ) [ truncate ] map ;
M: pango-renderer string-dim
[ " " string-dim { 0 1 } v* ]
- [ cached-layout logical-rect>> dim>> [ >integer ] map ] if-empty ;
+ [ cached-layout logical-rect>> dim>> v>integer ] if-empty ;
M: pango-renderer flush-layout-cache
cached-layouts get-global purge-cache ;
] "ui.text.pango" add-startup-hook
pango-renderer font-renderer set-global
-
! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors colors formatting kernel math math.functions
-models models.arrow models.product models.range sequences ui
-ui.gadgets ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders
+math.vectors models models.arrow models.product models.range sequences
+ui ui.gadgets ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders
ui.gadgets.tracks ui.pens.solid ;
IN: color-picker
[ <color-model> <color-preview> 1 track-add ]
[
[
- [ truncate >integer ] map
+ [ truncate ] map v>integer
first3 3dup "%d %d %d #%02x%02x%02x" sprintf
] <arrow> <label-control>
f track-add
[ key-5 keys nth 10000 f ? ]
} 0|| player reverse-time<<
- key-w keys nth [ player walk-forward ] when
- key-s keys nth [ player walk-backward ] when
- key-a keys nth [ player walk-leftward ] when
- key-d keys nth [ player walk-rightward ] when
- key-q keys nth [ player -1 look-horizontally ] when
- key-e keys nth [ player 1 look-horizontally ] when
- key-left-arrow keys nth [ player -1 look-horizontally ] when
- key-right-arrow keys nth [ player 1 look-horizontally ] when
- key-down-arrow keys nth [ player 1 look-vertically ] when
- key-up-arrow keys nth [ player -1 look-vertically ] when
- key-space keys nth [ player jump ] when
+ key-w keys nth [ player walk-forward ] when
+ key-s keys nth [ player walk-backward ] when
+ key-a keys nth [ player walk-leftward ] when
+ key-d keys nth [ player walk-rightward ] when
+ key-q keys nth [ player -1 look-horizontally ] when
+ key-e keys nth [ player 1 look-horizontally ] when
+ key-left-arrow keys nth [ player -1 look-horizontally ] when
+ key-right-arrow keys nth [ player 1 look-horizontally ] when
+ key-down-arrow keys nth [ player 1 look-vertically ] when
+ key-up-arrow keys nth [ player -1 look-vertically ] when
+ key-space keys nth [ player jump ] when
key-escape keys nth [ world close-window ] when
player read-mouse rotate-with-mouse
reset-mouse ;
[ { 0 0 } vmax ] dip { 2 2 } v- vmin ;
:: pixel-indices ( coords dim -- indices )
- coords vfloor [ >integer ] map dim clamp-coords :> floor-coords
+ coords vfloor v>integer dim clamp-coords :> floor-coords
floor-coords first2 dim first * + :> base-index
base-index dim first + :> next-row-index
pixel dup vfloor v- :> pixel-mantissa
segment bitmap>> 4 <groups> :> pixels
pixel dim pixel-indices :> indices
-
+
indices [ pixels nth COMPONENT-SCALE v. 255.0 / ] map
first4 pixel-mantissa bilerp ;