use clamp

db4
Doug Coleman 2010-01-14 11:18:10 -06:00
parent 2aa4d3d432
commit f7f67c57a3
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ IN: images.processing
: matrix>image ( m -- image )
<image> over matrix-dim >>dim
swap flip flatten
[ 128 * 128 + 0 max 255 min >fixnum ] map
[ 128 * 128 + 0 255 clamp >fixnum ] map
>byte-array >>bitmap L >>component-order ubyte-components >>component-type ;
:: matrix-zoom ( m f -- m' )
@ -30,7 +30,7 @@ IN: images.processing
:: draw-grey ( value x,y image -- )
x,y image image-offset 3 * { 0 1 2 }
[
+ value 128 + >fixnum 0 max 255 min swap image bitmap>> set-nth
+ value 128 + >fixnum 0 255 clamp swap image bitmap>> set-nth
] with each ;
:: draw-color ( value x,y color-id image -- )