]> gitweb.factorcode.org Git - factor.git/commitdiff
move images.processing to unmaintained for now
authorDoug Coleman <erg@jobim.local>
Wed, 10 Jun 2009 02:48:19 +0000 (22:48 -0400)
committerDoug Coleman <erg@jobim.local>
Wed, 10 Jun 2009 02:48:19 +0000 (22:48 -0400)
16 files changed:
extra/images/processing/rotation/authors.txt [deleted file]
extra/images/processing/rotation/rotation-tests.factor [deleted file]
extra/images/processing/rotation/rotation.factor [deleted file]
extra/images/processing/rotation/test-bitmaps/PastedImage.bmp [deleted file]
extra/images/processing/rotation/test-bitmaps/PastedImage90.bmp [deleted file]
extra/images/processing/rotation/test-bitmaps/lake.bmp [deleted file]
extra/images/processing/rotation/test-bitmaps/small-rotated.bmp [deleted file]
extra/images/processing/rotation/test-bitmaps/small.bmp [deleted file]
unmaintained/images/processing/rotation/authors.txt [new file with mode: 0644]
unmaintained/images/processing/rotation/rotation-tests.factor [new file with mode: 0755]
unmaintained/images/processing/rotation/rotation.factor [new file with mode: 0644]
unmaintained/images/processing/rotation/test-bitmaps/PastedImage.bmp [new file with mode: 0755]
unmaintained/images/processing/rotation/test-bitmaps/PastedImage90.bmp [new file with mode: 0755]
unmaintained/images/processing/rotation/test-bitmaps/lake.bmp [new file with mode: 0755]
unmaintained/images/processing/rotation/test-bitmaps/small-rotated.bmp [new file with mode: 0755]
unmaintained/images/processing/rotation/test-bitmaps/small.bmp [new file with mode: 0755]

diff --git a/extra/images/processing/rotation/authors.txt b/extra/images/processing/rotation/authors.txt
deleted file mode 100644 (file)
index 0980144..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Kobi Lurie
-Doug Coleman
diff --git a/extra/images/processing/rotation/rotation-tests.factor b/extra/images/processing/rotation/rotation-tests.factor
deleted file mode 100755 (executable)
index 390e6de..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-! Copyright (C) 2009 Kobi Lurie, Doug Coleman.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors fry images.loader\r
-images.processing.rotation kernel literals math sequences\r
-tools.test images.processing.rotation.private ;\r
-IN: images.processing.rotation.tests\r
-\r
-: first-row ( seq^2 -- seq ) first ;\r
-: first-col ( seq^2 -- item ) harvest [ first ] map ;\r
-: last-row ( seq^2 -- item ) last ;\r
-: last-col ( seq^2 -- item ) harvest [ last ] map ;\r
-: end-of-first-row ( seq^2 -- item ) first-row last ;\r
-: first-of-first-row ( seq^2 -- item ) first-row first ;\r
-: end-of-last-row ( seq^2 -- item ) last-row last ;\r
-: first-of-last-row ( seq^2 -- item ) last-row first ;\r
-\r
-<<\r
-\r
-: clone-image ( image -- new-image )\r
-    clone [ clone ] change-bitmap ;\r
-\r
->>\r
-\r
-: pasted-image ( -- image )\r
-    "vocab:images/processing/rotation/test-bitmaps/PastedImage.bmp"\r
-    load-image clone-image ;\r
-\r
-: pasted-image90 ( -- image )\r
-    "vocab:images/processing/rotation/test-bitmaps/PastedImage90.bmp"\r
-    load-image clone-image ;\r
-\r
-: lake-image ( -- image )\r
-    "vocab:images/processing/rotation/test-bitmaps/lake.bmp"\r
-    load-image clone-image image>pixel-rows ;\r
-\r
-[ t ] [ pasted-image dup clone-image 4 [ 90 rotate ] times = ] unit-test\r
-[ t ] [ pasted-image dup clone-image 2 [ 180 rotate ] times = ] unit-test\r
-[ t ] [ pasted-image dup clone-image 270 rotate 90 rotate = ] unit-test\r
-[ t ] [\r
-    pasted-image dup clone-image dup { 90 180 90 } [ rotate drop ] with each =\r
-] unit-test\r
-\r
-[ t ] [\r
-    pasted-image 90 rotate\r
-    pasted-image90 = \r
-] unit-test\r
-\r
-[ t ] [\r
-    "vocab:images/processing/rotation/test-bitmaps/small.bmp"\r
-    load-image 90 rotate \r
-    "vocab:images/processing/rotation/test-bitmaps/small-rotated.bmp"\r
-    load-image =\r
-] unit-test\r
-    \r
-[ t ] [\r
-    lake-image\r
-    [ first-of-first-row ]\r
-    [ 90 (rotate) end-of-first-row ] bi =\r
-] unit-test\r
-\r
-[ t ]\r
-[ lake-image [ first-row ] [ 90 (rotate) last-col ] bi = ] unit-test\r
-\r
-[ t ]\r
-[ lake-image [ last-col ] [ 90 (rotate) last-row reverse ] bi = ] unit-test\r
-\r
-[ t ]\r
-[ lake-image [ last-row ] [ 90 (rotate) first-col ] bi = ] unit-test\r
-\r
-[ t ]\r
-[ lake-image [ first-col ] [ 90 (rotate) first-row reverse ] bi = ] unit-test\r
diff --git a/extra/images/processing/rotation/rotation.factor b/extra/images/processing/rotation/rotation.factor
deleted file mode 100644 (file)
index 87cea5f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-! Copyright (C) 2009 Kobi Lurie.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays colors combinators
-combinators.short-circuit fry grouping images images.bitmap
-images.loader images.normalization kernel locals math sequences ;
-IN: images.processing.rotation
-
-ERROR: unsupported-rotation degrees ;
-
-<PRIVATE
-
-: rotate-90 ( seq^3 -- seq^3 ) flip [ reverse ] map ;
-: rotate-180 ( seq^3 -- seq^3 ) reverse [ reverse ] map ;
-: rotate-270 ( seq^3 -- seq^3 ) flip reverse ;
-
-: (rotate) ( seq n -- seq' )
-    {
-        { 0 [ ] }
-        { 90 [ rotate-90 ] }
-        { 180 [ rotate-180 ] }
-        { 270 [ rotate-270 ] }
-        [ unsupported-rotation ]
-    } case ;
-
-: rows-remove-pad ( byte-rows -- pixels' )
-    [ dup length 4 mod head* ] map ; 
-
-: row-length ( image -- n ) 
-    [ bitmap>> length ] [ dim>> second ] bi /i ;
-
-: image>byte-rows ( image -- byte-rows )
-    [ bitmap>> ] [ row-length ] bi group rows-remove-pad ;
-
-: (seperate-to-pixels) ( byte-rows image -- pixel-rows )
-    component-order>> bytes-per-pixel '[ _ group ] map ;
-
-: image>pixel-rows ( image -- pixel-rows )
-    [ image>byte-rows ] keep (seperate-to-pixels) ;
-: flatten-table ( seq^3 -- seq )
-    [ concat ] map concat ;
-
-: ?reverse-dimensions ( image n -- )
-    { 270 90 } member? [ [ reverse ] change-dim ] when drop ;
-
-:  normalize-degree ( n -- n' ) 360 rem ;
-
-: processing-effect ( image quot -- image' )
-    '[ image>pixel-rows @ flatten-table ] [ (>>bitmap) ] [ ] tri ; inline
-
-:: rotate' ( image n -- image )
-    n normalize-degree :> n'
-    image image>pixel-rows :> pixel-table
-    image n' ?reverse-dimensions
-    pixel-table n' (rotate) :> table-rotated
-    image table-rotated flatten-table >>bitmap ;
-
-PRIVATE>
-
-: rotate ( image n -- image' )
-    normalize-degree
-    [ '[ _ (rotate) ] processing-effect ] [ ?reverse-dimensions ] 2bi ;
-
-: reflect-y-axis ( image -- image ) 
-    [ [ reverse ] map ] processing-effect ;
-
-: reflect-x-axis ( image -- image ) 
-    [ reverse ] processing-effect ;
diff --git a/extra/images/processing/rotation/test-bitmaps/PastedImage.bmp b/extra/images/processing/rotation/test-bitmaps/PastedImage.bmp
deleted file mode 100755 (executable)
index 8edfedd..0000000
Binary files a/extra/images/processing/rotation/test-bitmaps/PastedImage.bmp and /dev/null differ
diff --git a/extra/images/processing/rotation/test-bitmaps/PastedImage90.bmp b/extra/images/processing/rotation/test-bitmaps/PastedImage90.bmp
deleted file mode 100755 (executable)
index 2aa6ef1..0000000
Binary files a/extra/images/processing/rotation/test-bitmaps/PastedImage90.bmp and /dev/null differ
diff --git a/extra/images/processing/rotation/test-bitmaps/lake.bmp b/extra/images/processing/rotation/test-bitmaps/lake.bmp
deleted file mode 100755 (executable)
index 431e4ef..0000000
Binary files a/extra/images/processing/rotation/test-bitmaps/lake.bmp and /dev/null differ
diff --git a/extra/images/processing/rotation/test-bitmaps/small-rotated.bmp b/extra/images/processing/rotation/test-bitmaps/small-rotated.bmp
deleted file mode 100755 (executable)
index 571ea83..0000000
Binary files a/extra/images/processing/rotation/test-bitmaps/small-rotated.bmp and /dev/null differ
diff --git a/extra/images/processing/rotation/test-bitmaps/small.bmp b/extra/images/processing/rotation/test-bitmaps/small.bmp
deleted file mode 100755 (executable)
index 7274857..0000000
Binary files a/extra/images/processing/rotation/test-bitmaps/small.bmp and /dev/null differ
diff --git a/unmaintained/images/processing/rotation/authors.txt b/unmaintained/images/processing/rotation/authors.txt
new file mode 100644 (file)
index 0000000..0980144
--- /dev/null
@@ -0,0 +1,2 @@
+Kobi Lurie
+Doug Coleman
diff --git a/unmaintained/images/processing/rotation/rotation-tests.factor b/unmaintained/images/processing/rotation/rotation-tests.factor
new file mode 100755 (executable)
index 0000000..390e6de
--- /dev/null
@@ -0,0 +1,71 @@
+! Copyright (C) 2009 Kobi Lurie, Doug Coleman.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: accessors fry images.loader\r
+images.processing.rotation kernel literals math sequences\r
+tools.test images.processing.rotation.private ;\r
+IN: images.processing.rotation.tests\r
+\r
+: first-row ( seq^2 -- seq ) first ;\r
+: first-col ( seq^2 -- item ) harvest [ first ] map ;\r
+: last-row ( seq^2 -- item ) last ;\r
+: last-col ( seq^2 -- item ) harvest [ last ] map ;\r
+: end-of-first-row ( seq^2 -- item ) first-row last ;\r
+: first-of-first-row ( seq^2 -- item ) first-row first ;\r
+: end-of-last-row ( seq^2 -- item ) last-row last ;\r
+: first-of-last-row ( seq^2 -- item ) last-row first ;\r
+\r
+<<\r
+\r
+: clone-image ( image -- new-image )\r
+    clone [ clone ] change-bitmap ;\r
+\r
+>>\r
+\r
+: pasted-image ( -- image )\r
+    "vocab:images/processing/rotation/test-bitmaps/PastedImage.bmp"\r
+    load-image clone-image ;\r
+\r
+: pasted-image90 ( -- image )\r
+    "vocab:images/processing/rotation/test-bitmaps/PastedImage90.bmp"\r
+    load-image clone-image ;\r
+\r
+: lake-image ( -- image )\r
+    "vocab:images/processing/rotation/test-bitmaps/lake.bmp"\r
+    load-image clone-image image>pixel-rows ;\r
+\r
+[ t ] [ pasted-image dup clone-image 4 [ 90 rotate ] times = ] unit-test\r
+[ t ] [ pasted-image dup clone-image 2 [ 180 rotate ] times = ] unit-test\r
+[ t ] [ pasted-image dup clone-image 270 rotate 90 rotate = ] unit-test\r
+[ t ] [\r
+    pasted-image dup clone-image dup { 90 180 90 } [ rotate drop ] with each =\r
+] unit-test\r
+\r
+[ t ] [\r
+    pasted-image 90 rotate\r
+    pasted-image90 = \r
+] unit-test\r
+\r
+[ t ] [\r
+    "vocab:images/processing/rotation/test-bitmaps/small.bmp"\r
+    load-image 90 rotate \r
+    "vocab:images/processing/rotation/test-bitmaps/small-rotated.bmp"\r
+    load-image =\r
+] unit-test\r
+    \r
+[ t ] [\r
+    lake-image\r
+    [ first-of-first-row ]\r
+    [ 90 (rotate) end-of-first-row ] bi =\r
+] unit-test\r
+\r
+[ t ]\r
+[ lake-image [ first-row ] [ 90 (rotate) last-col ] bi = ] unit-test\r
+\r
+[ t ]\r
+[ lake-image [ last-col ] [ 90 (rotate) last-row reverse ] bi = ] unit-test\r
+\r
+[ t ]\r
+[ lake-image [ last-row ] [ 90 (rotate) first-col ] bi = ] unit-test\r
+\r
+[ t ]\r
+[ lake-image [ first-col ] [ 90 (rotate) first-row reverse ] bi = ] unit-test\r
diff --git a/unmaintained/images/processing/rotation/rotation.factor b/unmaintained/images/processing/rotation/rotation.factor
new file mode 100644 (file)
index 0000000..87cea5f
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2009 Kobi Lurie.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays colors combinators
+combinators.short-circuit fry grouping images images.bitmap
+images.loader images.normalization kernel locals math sequences ;
+IN: images.processing.rotation
+
+ERROR: unsupported-rotation degrees ;
+
+<PRIVATE
+
+: rotate-90 ( seq^3 -- seq^3 ) flip [ reverse ] map ;
+: rotate-180 ( seq^3 -- seq^3 ) reverse [ reverse ] map ;
+: rotate-270 ( seq^3 -- seq^3 ) flip reverse ;
+
+: (rotate) ( seq n -- seq' )
+    {
+        { 0 [ ] }
+        { 90 [ rotate-90 ] }
+        { 180 [ rotate-180 ] }
+        { 270 [ rotate-270 ] }
+        [ unsupported-rotation ]
+    } case ;
+
+: rows-remove-pad ( byte-rows -- pixels' )
+    [ dup length 4 mod head* ] map ; 
+
+: row-length ( image -- n ) 
+    [ bitmap>> length ] [ dim>> second ] bi /i ;
+
+: image>byte-rows ( image -- byte-rows )
+    [ bitmap>> ] [ row-length ] bi group rows-remove-pad ;
+
+: (seperate-to-pixels) ( byte-rows image -- pixel-rows )
+    component-order>> bytes-per-pixel '[ _ group ] map ;
+
+: image>pixel-rows ( image -- pixel-rows )
+    [ image>byte-rows ] keep (seperate-to-pixels) ;
+: flatten-table ( seq^3 -- seq )
+    [ concat ] map concat ;
+
+: ?reverse-dimensions ( image n -- )
+    { 270 90 } member? [ [ reverse ] change-dim ] when drop ;
+
+:  normalize-degree ( n -- n' ) 360 rem ;
+
+: processing-effect ( image quot -- image' )
+    '[ image>pixel-rows @ flatten-table ] [ (>>bitmap) ] [ ] tri ; inline
+
+:: rotate' ( image n -- image )
+    n normalize-degree :> n'
+    image image>pixel-rows :> pixel-table
+    image n' ?reverse-dimensions
+    pixel-table n' (rotate) :> table-rotated
+    image table-rotated flatten-table >>bitmap ;
+
+PRIVATE>
+
+: rotate ( image n -- image' )
+    normalize-degree
+    [ '[ _ (rotate) ] processing-effect ] [ ?reverse-dimensions ] 2bi ;
+
+: reflect-y-axis ( image -- image ) 
+    [ [ reverse ] map ] processing-effect ;
+
+: reflect-x-axis ( image -- image ) 
+    [ reverse ] processing-effect ;
diff --git a/unmaintained/images/processing/rotation/test-bitmaps/PastedImage.bmp b/unmaintained/images/processing/rotation/test-bitmaps/PastedImage.bmp
new file mode 100755 (executable)
index 0000000..8edfedd
Binary files /dev/null and b/unmaintained/images/processing/rotation/test-bitmaps/PastedImage.bmp differ
diff --git a/unmaintained/images/processing/rotation/test-bitmaps/PastedImage90.bmp b/unmaintained/images/processing/rotation/test-bitmaps/PastedImage90.bmp
new file mode 100755 (executable)
index 0000000..2aa6ef1
Binary files /dev/null and b/unmaintained/images/processing/rotation/test-bitmaps/PastedImage90.bmp differ
diff --git a/unmaintained/images/processing/rotation/test-bitmaps/lake.bmp b/unmaintained/images/processing/rotation/test-bitmaps/lake.bmp
new file mode 100755 (executable)
index 0000000..431e4ef
Binary files /dev/null and b/unmaintained/images/processing/rotation/test-bitmaps/lake.bmp differ
diff --git a/unmaintained/images/processing/rotation/test-bitmaps/small-rotated.bmp b/unmaintained/images/processing/rotation/test-bitmaps/small-rotated.bmp
new file mode 100755 (executable)
index 0000000..571ea83
Binary files /dev/null and b/unmaintained/images/processing/rotation/test-bitmaps/small-rotated.bmp differ
diff --git a/unmaintained/images/processing/rotation/test-bitmaps/small.bmp b/unmaintained/images/processing/rotation/test-bitmaps/small.bmp
new file mode 100755 (executable)
index 0000000..7274857
Binary files /dev/null and b/unmaintained/images/processing/rotation/test-bitmaps/small.bmp differ