]> gitweb.factorcode.org Git - factor.git/commitdiff
use clamp
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 14 Jan 2010 17:18:10 +0000 (11:18 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 14 Jan 2010 17:18:10 +0000 (11:18 -0600)
basis/images/processing/processing.factor

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