]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/images/processing/processing.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / images / processing / processing.factor
index aa6434743f4a17eaf4ed25f9efc8ff87fbad0d73..4d33f4c26021a26a89da311a342cdfe177028001 100644 (file)
@@ -1,40 +1,40 @@
-! Copyright (C) 2009 Marc Fauconneau.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors arrays byte-arrays combinators grouping images\r
-kernel locals math math.order\r
-math.ranges math.vectors sequences sequences.deep fry ;\r
-IN: images.processing\r
-\r
-: coord-matrix ( dim -- m )\r
-    [ iota ] map first2 cartesian-product ;\r
-\r
-: map^2 ( m quot -- m' ) '[ _ map ] map ; inline\r
-: each^2 ( m quot -- m' ) '[ _ each ] each ; inline\r
-\r
-: matrix-dim ( m -- dim ) [ length ] [ first length ] bi 2array ;\r
-    \r
-: matrix>image ( m -- image )\r
-    <image> over matrix-dim >>dim\r
-    swap flip flatten\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
-    m matrix-dim f v*n coord-matrix\r
-    [ [ f /i ] map first2 swap m nth nth ] map^2 ;\r
-\r
-:: image-offset ( x,y image -- xy )\r
-    image dim>> first\r
-    x,y second * x,y first + ;\r
-        \r
-:: draw-grey ( value x,y image -- )\r
-    x,y image image-offset 3 * { 0 1 2 }\r
-    [\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
-    x,y image image-offset 3 * color-id + value >fixnum\r
-    swap image bitmap>> set-nth ;\r
-\r
-! : matrix. ( m -- ) 10 matrix-zoom matrix>image image. ;\r
+! Copyright (C) 2009 Marc Fauconneau.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays byte-arrays combinators grouping images
+kernel locals math math.order
+math.ranges math.vectors sequences sequences.deep fry ;
+IN: images.processing
+
+: coord-matrix ( dim -- m )
+    [ iota ] map first2 cartesian-product ;
+
+: map^2 ( m quot -- m' ) '[ _ map ] map ; inline
+: each^2 ( m quot -- m' ) '[ _ each ] each ; inline
+
+: matrix-dim ( m -- dim ) [ length ] [ first length ] bi 2array ;
+
+: matrix>image ( m -- image )
+    <image> over matrix-dim >>dim
+    swap flip flatten
+    [ 128 * 128 + 0 255 clamp >fixnum ] map
+    >byte-array >>bitmap L >>component-order ubyte-components >>component-type ;
+
+:: matrix-zoom ( m f -- m' )
+    m matrix-dim f v*n coord-matrix
+    [ [ f /i ] map first2 swap m nth nth ] map^2 ;
+
+:: image-offset ( x,y image -- xy )
+    image dim>> first
+    x,y second * x,y first + ;
+
+:: draw-grey ( value x,y image -- )
+    x,y image image-offset 3 * { 0 1 2 }
+    [
+        + value 128 + >fixnum 0 255 clamp swap image bitmap>> set-nth
+    ] with each ;
+
+:: draw-color ( value x,y color-id image -- )
+    x,y image image-offset 3 * color-id + value >fixnum
+    swap image bitmap>> set-nth ;
+
+! : matrix. ( m -- ) 10 matrix-zoom matrix>image image. ;