From: John Benediktsson Date: Mon, 7 Dec 2020 22:51:17 +0000 (-0800) Subject: images.processing.rotation: moving to extra/ X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor-unmaintained.git;a=commitdiff_plain;h=3979dd03e5ea7370d38cae390679198b0a2e3730 images.processing.rotation: moving to extra/ --- diff --git a/images/processing/rotation/authors.txt b/images/processing/rotation/authors.txt deleted file mode 100644 index 0980144..0000000 --- a/images/processing/rotation/authors.txt +++ /dev/null @@ -1,2 +0,0 @@ -Kobi Lurie -Doug Coleman diff --git a/images/processing/rotation/rotation-tests.factor b/images/processing/rotation/rotation-tests.factor deleted file mode 100644 index 8f65362..0000000 --- a/images/processing/rotation/rotation-tests.factor +++ /dev/null @@ -1,71 +0,0 @@ -! Copyright (C) 2009 Kobi Lurie, Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: accessors fry images.loader -images.processing.rotation kernel literals math sequences -tools.test images.processing.rotation.private ; -IN: images.processing.rotation.tests - -: first-row ( seq^2 -- seq ) first ; -: first-col ( seq^2 -- item ) harvest [ first ] map ; -: last-row ( seq^2 -- item ) last ; -: last-col ( seq^2 -- item ) harvest [ last ] map ; -: end-of-first-row ( seq^2 -- item ) first-row last ; -: first-of-first-row ( seq^2 -- item ) first-row first ; -: end-of-last-row ( seq^2 -- item ) last-row last ; -: first-of-last-row ( seq^2 -- item ) last-row first ; - -<< - -: clone-image ( image -- new-image ) - clone [ clone ] change-bitmap ; - ->> - -: pasted-image ( -- image ) - "vocab:images/processing/rotation/test-bitmaps/PastedImage.bmp" - load-image clone-image ; - -: pasted-image90 ( -- image ) - "vocab:images/processing/rotation/test-bitmaps/PastedImage90.bmp" - load-image clone-image ; - -: lake-image ( -- image ) - "vocab:images/processing/rotation/test-bitmaps/lake.bmp" - load-image clone-image image>pixel-rows ; - -[ t ] [ pasted-image dup clone-image 4 [ 90 rotate ] times = ] unit-test -[ t ] [ pasted-image dup clone-image 2 [ 180 rotate ] times = ] unit-test -[ t ] [ pasted-image dup clone-image 270 rotate 90 rotate = ] unit-test -[ t ] [ - pasted-image dup clone-image dup { 90 180 90 } [ rotate drop ] with each = -] unit-test - -[ t ] [ - pasted-image 90 rotate - pasted-image90 = -] unit-test - -[ t ] [ - "vocab:images/processing/rotation/test-bitmaps/small.bmp" - load-image 90 rotate - "vocab:images/processing/rotation/test-bitmaps/small-rotated.bmp" - load-image = -] unit-test - -[ t ] [ - lake-image - [ first-of-first-row ] - [ 90 (rotate) end-of-first-row ] bi = -] unit-test - -[ t ] -[ lake-image [ first-row ] [ 90 (rotate) last-col ] bi = ] unit-test - -[ t ] -[ lake-image [ last-col ] [ 90 (rotate) last-row reverse ] bi = ] unit-test - -[ t ] -[ lake-image [ last-row ] [ 90 (rotate) first-col ] bi = ] unit-test - -[ t ] -[ lake-image [ first-col ] [ 90 (rotate) first-row reverse ] bi = ] unit-test diff --git a/images/processing/rotation/rotation.factor b/images/processing/rotation/rotation.factor deleted file mode 100644 index 863fa2e..0000000 --- a/images/processing/rotation/rotation.factor +++ /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 ; - -> 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/images/processing/rotation/test-bitmaps/PastedImage.bmp b/images/processing/rotation/test-bitmaps/PastedImage.bmp deleted file mode 100644 index 8edfedd..0000000 Binary files a/images/processing/rotation/test-bitmaps/PastedImage.bmp and /dev/null differ diff --git a/images/processing/rotation/test-bitmaps/PastedImage90.bmp b/images/processing/rotation/test-bitmaps/PastedImage90.bmp deleted file mode 100644 index 2aa6ef1..0000000 Binary files a/images/processing/rotation/test-bitmaps/PastedImage90.bmp and /dev/null differ diff --git a/images/processing/rotation/test-bitmaps/lake.bmp b/images/processing/rotation/test-bitmaps/lake.bmp deleted file mode 100644 index 431e4ef..0000000 Binary files a/images/processing/rotation/test-bitmaps/lake.bmp and /dev/null differ diff --git a/images/processing/rotation/test-bitmaps/small-rotated.bmp b/images/processing/rotation/test-bitmaps/small-rotated.bmp deleted file mode 100644 index 571ea83..0000000 Binary files a/images/processing/rotation/test-bitmaps/small-rotated.bmp and /dev/null differ diff --git a/images/processing/rotation/test-bitmaps/small.bmp b/images/processing/rotation/test-bitmaps/small.bmp deleted file mode 100644 index 7274857..0000000 Binary files a/images/processing/rotation/test-bitmaps/small.bmp and /dev/null differ