]> gitweb.factorcode.org Git - factor.git/commitdiff
colors: moving some color definitions from extra/ to basis/.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 10 Sep 2019 19:02:43 +0000 (12:02 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 10 Sep 2019 19:02:43 +0000 (12:02 -0700)
98 files changed:
basis/colors/cmyk/authors.txt [new file with mode: 0644]
basis/colors/cmyk/cmyk-docs.factor [new file with mode: 0644]
basis/colors/cmyk/cmyk-tests.factor [new file with mode: 0644]
basis/colors/cmyk/cmyk.factor [new file with mode: 0644]
basis/colors/cmyk/summary.txt [new file with mode: 0644]
basis/colors/hsl/authors.txt [new file with mode: 0644]
basis/colors/hsl/hsl-docs.factor [new file with mode: 0644]
basis/colors/hsl/hsl-tests.factor [new file with mode: 0644]
basis/colors/hsl/hsl.factor [new file with mode: 0644]
basis/colors/hsl/summary.txt [new file with mode: 0644]
basis/colors/lab/authors.txt [new file with mode: 0644]
basis/colors/lab/lab-docs.factor [new file with mode: 0644]
basis/colors/lab/lab-tests.factor [new file with mode: 0644]
basis/colors/lab/lab.factor [new file with mode: 0644]
basis/colors/lab/summary.txt [new file with mode: 0644]
basis/colors/lch/authors.txt [new file with mode: 0644]
basis/colors/lch/lch-tests.factor [new file with mode: 0644]
basis/colors/lch/lch.factor [new file with mode: 0644]
basis/colors/lch/summary.txt [new file with mode: 0644]
basis/colors/luv/authors.txt [new file with mode: 0644]
basis/colors/luv/luv-docs.factor [new file with mode: 0644]
basis/colors/luv/luv-tests.factor [new file with mode: 0644]
basis/colors/luv/luv.factor [new file with mode: 0644]
basis/colors/luv/summary.txt [new file with mode: 0644]
basis/colors/ryb/authors.txt [new file with mode: 0644]
basis/colors/ryb/ryb-docs.factor [new file with mode: 0644]
basis/colors/ryb/ryb-tests.factor [new file with mode: 0644]
basis/colors/ryb/ryb.factor [new file with mode: 0644]
basis/colors/ryb/summary.txt [new file with mode: 0644]
basis/colors/xyy/authors.txt [new file with mode: 0644]
basis/colors/xyy/summary.txt [new file with mode: 0644]
basis/colors/xyy/xyy-docs.factor [new file with mode: 0644]
basis/colors/xyy/xyy-tests.factor [new file with mode: 0644]
basis/colors/xyy/xyy.factor [new file with mode: 0644]
basis/colors/xyz/authors.txt [new file with mode: 0644]
basis/colors/xyz/summary.txt [new file with mode: 0644]
basis/colors/xyz/xyz-docs.factor [new file with mode: 0644]
basis/colors/xyz/xyz-tests.factor [new file with mode: 0644]
basis/colors/xyz/xyz.factor [new file with mode: 0644]
basis/colors/yiq/authors.txt [new file with mode: 0644]
basis/colors/yiq/summary.txt [new file with mode: 0644]
basis/colors/yiq/yiq-docs.factor [new file with mode: 0644]
basis/colors/yiq/yiq-tests.factor [new file with mode: 0644]
basis/colors/yiq/yiq.factor [new file with mode: 0644]
basis/colors/yuv/authors.txt [new file with mode: 0644]
basis/colors/yuv/summary.txt [new file with mode: 0644]
basis/colors/yuv/yuv-docs.factor [new file with mode: 0644]
basis/colors/yuv/yuv-tests.factor [new file with mode: 0644]
basis/colors/yuv/yuv.factor [new file with mode: 0644]
extra/colors/cmyk/authors.txt [deleted file]
extra/colors/cmyk/cmyk-docs.factor [deleted file]
extra/colors/cmyk/cmyk-tests.factor [deleted file]
extra/colors/cmyk/cmyk.factor [deleted file]
extra/colors/cmyk/summary.txt [deleted file]
extra/colors/hsl/authors.txt [deleted file]
extra/colors/hsl/hsl-docs.factor [deleted file]
extra/colors/hsl/hsl-tests.factor [deleted file]
extra/colors/hsl/hsl.factor [deleted file]
extra/colors/hsl/summary.txt [deleted file]
extra/colors/lab/authors.txt [deleted file]
extra/colors/lab/lab-docs.factor [deleted file]
extra/colors/lab/lab-tests.factor [deleted file]
extra/colors/lab/lab.factor [deleted file]
extra/colors/lab/summary.txt [deleted file]
extra/colors/lch/authors.txt [deleted file]
extra/colors/lch/lch-tests.factor [deleted file]
extra/colors/lch/lch.factor [deleted file]
extra/colors/lch/summary.txt [deleted file]
extra/colors/luv/authors.txt [deleted file]
extra/colors/luv/luv-docs.factor [deleted file]
extra/colors/luv/luv-tests.factor [deleted file]
extra/colors/luv/luv.factor [deleted file]
extra/colors/luv/summary.txt [deleted file]
extra/colors/ryb/authors.txt [deleted file]
extra/colors/ryb/ryb-docs.factor [deleted file]
extra/colors/ryb/ryb-tests.factor [deleted file]
extra/colors/ryb/ryb.factor [deleted file]
extra/colors/ryb/summary.txt [deleted file]
extra/colors/xyy/authors.txt [deleted file]
extra/colors/xyy/summary.txt [deleted file]
extra/colors/xyy/xyy-docs.factor [deleted file]
extra/colors/xyy/xyy-tests.factor [deleted file]
extra/colors/xyy/xyy.factor [deleted file]
extra/colors/xyz/authors.txt [deleted file]
extra/colors/xyz/summary.txt [deleted file]
extra/colors/xyz/xyz-docs.factor [deleted file]
extra/colors/xyz/xyz-tests.factor [deleted file]
extra/colors/xyz/xyz.factor [deleted file]
extra/colors/yiq/authors.txt [deleted file]
extra/colors/yiq/summary.txt [deleted file]
extra/colors/yiq/yiq-docs.factor [deleted file]
extra/colors/yiq/yiq-tests.factor [deleted file]
extra/colors/yiq/yiq.factor [deleted file]
extra/colors/yuv/authors.txt [deleted file]
extra/colors/yuv/summary.txt [deleted file]
extra/colors/yuv/yuv-docs.factor [deleted file]
extra/colors/yuv/yuv-tests.factor [deleted file]
extra/colors/yuv/yuv.factor [deleted file]

diff --git a/basis/colors/cmyk/authors.txt b/basis/colors/cmyk/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/cmyk/cmyk-docs.factor b/basis/colors/cmyk/cmyk-docs.factor
new file mode 100644 (file)
index 0000000..33484cf
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax ;
+IN: colors.cmyk
+
+HELP: cmyka
+{ $class-description "The class of CMYK (Cyan, Magenta, Yellow, Black) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
+
+ARTICLE: "colors.cmyk" "CMYK colors"
+"The " { $vocab-link "colors.cmyk" } " vocabulary implements colors specified by their cyan, magenta, yellow, and black components, together with an alpha channel."
+{ $subsections
+    cmyka
+    <cmyka>
+    >cmyka
+}
+{ $see-also "colors" } ;
+
+ABOUT: "colors.cmyk"
diff --git a/basis/colors/cmyk/cmyk-tests.factor b/basis/colors/cmyk/cmyk-tests.factor
new file mode 100644 (file)
index 0000000..bd9894d
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.cmyk kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >cmyka >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00000001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/cmyk/cmyk.factor b/basis/colors/cmyk/cmyk.factor
new file mode 100644 (file)
index 0000000..dc8e7dc
--- /dev/null
@@ -0,0 +1,42 @@
+! Copyright (C) 2012 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors combinators colors colors.gray kernel math
+math.order ;
+
+IN: colors.cmyk
+
+TUPLE: cmyka < color
+{ cyan read-only }
+{ magenta read-only }
+{ yellow read-only }
+{ black read-only }
+{ alpha read-only } ;
+
+C: <cmyka> cmyka
+
+M: cmyka >rgba
+    [ [ cyan>> ] [ black>> ] bi + ]
+    [ [ magenta>> ] [ black>> ] bi + ]
+    [ [ yellow>> ] [ black>> ] bi + ] tri
+    [ 1.0 min 1.0 swap - ] tri@ 1.0 <rgba> ; inline
+
+GENERIC: >cmyka ( color -- cmyka )
+
+M: object >cmyka >rgba >cmyka ;
+
+M: rgba >cmyka
+    >rgba-components [
+        [ 1 swap - ] tri@ 3dup min min
+        [ [ - 0.0 1.0 clamp ] curry tri@ ] keep
+    ] dip <cmyka> ;
+
+M: cmyka >gray
+    [
+        {
+            [ cyan>> 0.3 * ]
+            [ magenta>> 0.59 * ]
+            [ yellow>> 0.11 * ]
+            [ black>> ]
+        } cleave + + + 1.0 min 1.0 swap -
+    ] [ alpha>> ] bi <gray> ;
diff --git a/basis/colors/cmyk/summary.txt b/basis/colors/cmyk/summary.txt
new file mode 100644 (file)
index 0000000..10ca1ba
--- /dev/null
@@ -0,0 +1 @@
+CMYK colors
diff --git a/basis/colors/hsl/authors.txt b/basis/colors/hsl/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/hsl/hsl-docs.factor b/basis/colors/hsl/hsl-docs.factor
new file mode 100644 (file)
index 0000000..aec3d66
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax ;
+IN: colors.hsl
+
+HELP: hsla
+{ $class-description "The class of HSL (Hue, Saturation, Lightness) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
+
+ARTICLE: "colors.hsl" "HSL colors"
+"The " { $vocab-link "colors.hsl" } " vocabulary implements colors specified by their hue, saturation, and lightness components, together with an alpha channel."
+{ $subsections
+    hsla
+    <hsla>
+    >hsla
+}
+{ $see-also "colors" } ;
+
+ABOUT: "colors.hsl"
diff --git a/basis/colors/hsl/hsl-tests.factor b/basis/colors/hsl/hsl-tests.factor
new file mode 100644 (file)
index 0000000..09fafa6
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.hsl kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >hsla >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00000001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/hsl/hsl.factor b/basis/colors/hsl/hsl.factor
new file mode 100644 (file)
index 0000000..f61bc6e
--- /dev/null
@@ -0,0 +1,70 @@
+! Copyright (C) 2012 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors combinators kernel locals math
+math.order ;
+
+IN: colors.hsl
+
+TUPLE: hsla < color
+{ hue read-only }
+{ saturation read-only }
+{ lightness read-only }
+{ alpha read-only } ;
+
+C: <hsla> hsla
+
+<PRIVATE
+
+: value ( p q t -- value )
+    dup 0 < [ 1.0 + ] when
+    dup 1 > [ 1.0 - ] when
+    {
+        { [ dup 1/6 < ] [ [ over - ] dip * 6 * + ] }
+        { [ dup 1/2 < ] [ drop nip ] }
+        { [ dup 2/3 < ] [ [ over - ] dip 2/3 swap - * 6 * + ] }
+        [ 2drop ]
+    } cond ;
+
+PRIVATE>
+
+M: hsla >rgba
+    {
+        [ hue>> ] [ saturation>> ] [ lightness>> ] [ alpha>> ]
+    } cleave [| h s l |
+        s zero? [
+            l l l
+        ] [
+            l 0.5 < [ l s 1 + * ] [ l s + l s * - ] if :> q
+            l 2 * q - :> p
+            p q h 1/3 + value
+            p q h value
+            p q h 1/3 - value
+        ] if
+    ] dip <rgba> ; inline
+
+GENERIC: >hsla ( color -- hsla )
+
+M: object >hsla >rgba >hsla ;
+
+M: hsla >hsla ; inline
+
+M: rgba >hsla
+    >rgba-components [| r g b |
+        r g b min min :> min-c
+        r g b max max :> max-c
+        min-c max-c + 2 / :> l
+        max-c min-c - :> d
+        d zero? [ 0.0 0.0 ] [
+            max-c {
+                { r [ g b - d / g b < 6.0 0.0 ? + ] }
+                { g [ b r - d / 2.0 + ] }
+                { b [ r g - d / 4.0 + ] }
+            } case 6.0 /
+            l 0.5 > [
+                d 2 max-c - min-c - /
+            ] [
+                d max-c min-c + /
+            ] if
+        ] if l
+    ] dip <hsla> ;
diff --git a/basis/colors/hsl/summary.txt b/basis/colors/hsl/summary.txt
new file mode 100644 (file)
index 0000000..063c135
--- /dev/null
@@ -0,0 +1 @@
+HSL colors
diff --git a/basis/colors/lab/authors.txt b/basis/colors/lab/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/lab/lab-docs.factor b/basis/colors/lab/lab-docs.factor
new file mode 100644 (file)
index 0000000..4b52f8c
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax ;
+IN: colors.lab
+
+HELP: laba
+{ $class-description "The class of CIE 1976 LAB (commonly called CIELAB) colors with an alpha channel." } ;
+
+ARTICLE: "colors.lab" "CIE 1976 LAB colors"
+"The " { $vocab-link "colors.lab" } " vocabulary implements CIE 1976 LAB colors, specifying luminance (in approximately " { $snippet "[0,100]" } "), red/green, and blue/yellow components, together with an alpha channel."
+{ $subsections
+    laba
+    <laba>
+    >laba
+}
+"For more information, see " { $url "https://en.wikipedia.org/wiki/Lab_color_space" }
+{ $see-also "colors" } ;
+
+ABOUT: "colors.lab"
diff --git a/basis/colors/lab/lab-tests.factor b/basis/colors/lab/lab-tests.factor
new file mode 100644 (file)
index 0000000..3790bd2
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.lab kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >laba >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/lab/lab.factor b/basis/colors/lab/lab.factor
new file mode 100644 (file)
index 0000000..abdc066
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors colors.xyz colors.xyz.private kernel
+locals math math.functions ;
+
+IN: colors.lab
+
+TUPLE: laba l a b alpha ;
+
+C: <laba> laba
+
+M: laba >rgba >xyza >rgba ;
+
+M: laba >xyza
+    [
+        [let
+            [ l>> ] [ a>> ] [ b>> ] tri :> ( l a b )
+            l 16 + 116 / :> fy
+            a 500 / fy + :> fx
+            fy b 200 / - :> fz
+
+            fx 3 ^ :> fx3
+            fz 3 ^ :> fz3
+
+            fx3 xyz_epsilon > [
+                fx3
+            ] [
+                116 fx * 16 - xyz_kappa /
+            ] if :> x
+
+            l xyz_kappa xyz_epsilon * > [
+                l 16 + 116 / 3 ^
+            ] [
+                l xyz_kappa /
+            ] if :> y
+
+            fz3 xyz_epsilon > [
+                fz3
+            ] [
+                116 fz * 16 - xyz_kappa /
+            ] if :> z
+
+            x wp_x * y wp_y * z wp_z *
+        ]
+    ] [ alpha>> ] bi <xyza> ;
+
+GENERIC: >laba ( color -- laba )
+
+M: object >laba >rgba >laba ;
+
+M: rgba >laba >xyza >laba ;
+
+M: xyza >laba
+    [
+        [let
+            [ x>> wp_x / ] [ y>> wp_y / ] [ z>> wp_z / ] tri
+            [
+                dup xyz_epsilon >
+                [ 1/3 ^ ] [ xyz_kappa * 16 + 116 / ] if
+            ] tri@ :> ( fx fy fz )
+            116 fy * 16 -
+            500 fx fy - *
+            200 fy fz - *
+        ]
+    ] [ alpha>> ] bi <laba> ;
diff --git a/basis/colors/lab/summary.txt b/basis/colors/lab/summary.txt
new file mode 100644 (file)
index 0000000..904f605
--- /dev/null
@@ -0,0 +1 @@
+CIE 1976 LAB colors
diff --git a/basis/colors/lch/authors.txt b/basis/colors/lch/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/lch/lch-tests.factor b/basis/colors/lch/lch-tests.factor
new file mode 100644 (file)
index 0000000..6811cfb
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.lch kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >LCHuv >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >LCHab >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/lch/lch.factor b/basis/colors/lch/lch.factor
new file mode 100644 (file)
index 0000000..bdfe54b
--- /dev/null
@@ -0,0 +1,85 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors colors.lab colors.luv colors.xyz kernel
+locals math math.functions math.libm math.trig ;
+
+IN: colors.lch
+
+TUPLE: LCHuv l c h alpha ;
+
+C: <LCHuv> LCHuv
+
+M: LCHuv >rgba >luva >rgba ;
+
+M: LCHuv >xyza >luva >xyza ;
+
+M: LCHuv >luva
+    [
+        [let
+            [ l>> ] [ c>> ] [ h>> ] tri :> ( l c h )
+            h deg>rad :> hr
+
+            l
+            c hr cos *
+            c hr sin *
+        ]
+    ] [ alpha>> ] bi <luva> ;
+
+GENERIC: >LCHuv ( color -- LCHuv )
+
+M: object >LCHuv >luva >LCHuv ;
+
+M: LCHuv >LCHuv ; inline
+
+M: luva >LCHuv
+    [
+        [let
+            [ l>> ] [ u>> ] [ v>> ] tri :> ( l u v )
+            v u fatan2 rad>deg
+            [ dup 360 > ] [ 360 - ] while
+            [ dup 0 < ] [ 360 + ] while :> h
+
+            l
+            u sq v sq + sqrt
+            h
+        ]
+    ] [ alpha>> ] bi <LCHuv> ;
+
+TUPLE: LCHab l c h alpha ;
+
+C: <LCHab> LCHab
+
+M: LCHab >rgba >laba >rgba ;
+
+M: LCHab >laba
+    [
+        [let
+            [ l>> ] [ c>> ] [ h>> ] tri :> ( l c h )
+            h deg>rad :> hr
+
+            l
+            c hr cos *
+            c hr sin *
+        ]
+    ] [ alpha>> ] bi <laba> ;
+
+GENERIC: >LCHab ( color -- LCHab )
+
+M: object >LCHab >laba >LCHab ;
+
+M: LCHab >LCHab ; inline
+
+M: laba >LCHab
+    [
+        [let
+            [ l>> ] [ a>> ] [ b>> ] tri :> ( l a b )
+            b a fatan2 rad>deg
+            [ dup 360 > ] [ 360 - ] while
+            [ dup 0 < ] [ 360 + ] while :> h
+
+            l
+            a sq b sq + sqrt
+            h
+        ]
+    ] [ alpha>> ] bi <LCHab> ;
diff --git a/basis/colors/lch/summary.txt b/basis/colors/lch/summary.txt
new file mode 100644 (file)
index 0000000..bbfed8a
--- /dev/null
@@ -0,0 +1 @@
+CIELCH colors
diff --git a/basis/colors/luv/authors.txt b/basis/colors/luv/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/luv/luv-docs.factor b/basis/colors/luv/luv-docs.factor
new file mode 100644 (file)
index 0000000..5afbc53
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax ;
+IN: colors.luv
+
+HELP: luva
+{ $class-description "The class of CIE 1976 LUV (commonly called CIELUV) colors with an alpha channel." } ;
+
+ARTICLE: "colors.luv" "CIE 1976 LUV colors"
+"The " { $vocab-link "colors.luv" } " vocabulary implements CIE 1976 LUV colors, together with an alpha channel."
+{ $subsections
+    luva
+    <luva>
+    >luva
+}
+"For more information, see " { $url "https://en.wikipedia.org/wiki/CIELUV_color_space" }
+{ $see-also "colors" } ;
+
+ABOUT: "colors.luv"
diff --git a/basis/colors/luv/luv-tests.factor b/basis/colors/luv/luv-tests.factor
new file mode 100644 (file)
index 0000000..c47365a
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.luv kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >luva >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/luv/luv.factor b/basis/colors/luv/luv.factor
new file mode 100644 (file)
index 0000000..c756e82
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors colors.xyz colors.xyz.private kernel
+locals math math.functions ;
+
+IN: colors.luv
+
+TUPLE: luva l u v alpha ;
+
+C: <luva> luva
+
+<PRIVATE
+
+:: xyz-to-uv ( x y z -- u v )
+    x y 15 * z 3 * + + :> d
+    4 x * d /
+    9 y * d / ; foldable
+
+PRIVATE>
+
+M: luva >rgba >xyza >rgba ;
+
+M: luva >xyza
+    [
+        [let
+            wp_x wp_y wp_z xyz-to-uv :> ( u_wp v_wp )
+            [ l>> ] [ u>> ] [ v>> ] tri :> ( l u v )
+
+            52 l * 13 l * u_wp * u + / 1 - 3 / :> a
+            l xyz_kappa xyz_epsilon * > [
+                l 16 + 116 / 3 ^ wp_y *
+            ] [
+                l xyz_kappa / wp_y *
+            ] if :> y
+            y -5 * :> b
+            39 l * 13 l * v_wp * v + / 5 - y * :> d
+            d b - a 1/3 + / :> x
+            a x * b + :> z
+
+            x y z
+        ]
+    ] [ alpha>> ] bi <xyza> ;
+
+GENERIC: >luva ( color -- luva )
+
+M: object >luva >rgba >luva ;
+
+M: rgba >luva >xyza >luva ;
+
+M: luva >luva ; inline
+
+M: xyza >luva
+    [
+        [let
+            wp_x wp_y wp_z xyz-to-uv :> ( u_wp v_wp )
+            [ x>> ] [ y>> ] [ z>> ] tri :> ( x_ y_ z_ )
+            x_ y_ z_ xyz-to-uv :> ( u_ v_ )
+
+            y_ wp_y / :> y
+
+            y xyz_epsilon > [
+                y 1/3 ^ 116 * 16 -
+            ] [
+                xyz_kappa y *
+            ] if :> l
+            13 l * u_ u_wp - * :> u
+            13 l * v_ v_wp - * :> v
+
+            l u v
+        ]
+    ] [ alpha>> ] bi <luva> ;
diff --git a/basis/colors/luv/summary.txt b/basis/colors/luv/summary.txt
new file mode 100644 (file)
index 0000000..186c3b6
--- /dev/null
@@ -0,0 +1 @@
+CIE 1976 LUV colors
diff --git a/basis/colors/ryb/authors.txt b/basis/colors/ryb/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/ryb/ryb-docs.factor b/basis/colors/ryb/ryb-docs.factor
new file mode 100644 (file)
index 0000000..66ed783
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax ;
+IN: colors.ryb
+
+HELP: ryba
+{ $class-description "The class of RYB (Red, Yellow, Blue) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
+
+ARTICLE: "colors.ryb" "RYB colors"
+"The " { $vocab-link "colors.ryb" } " vocabulary implements colors specified by their red, yellow, and blue components, together with an alpha channel."
+{ $subsections
+    ryba
+    <ryba>
+    >ryba
+}
+{ $see-also "colors" } ;
+
+ABOUT: "colors.ryb"
diff --git a/basis/colors/ryb/ryb-tests.factor b/basis/colors/ryb/ryb-tests.factor
new file mode 100644 (file)
index 0000000..18bcd38
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.ryb kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >ryba >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00000001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/ryb/ryb.factor b/basis/colors/ryb/ryb.factor
new file mode 100644 (file)
index 0000000..d96cc15
--- /dev/null
@@ -0,0 +1,77 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors kernel locals math math.order ;
+
+IN: colors.ryb
+
+TUPLE: ryba < color
+    { red read-only }
+    { yellow read-only }
+    { blue read-only }
+    { alpha read-only } ;
+
+C: <ryba> ryba
+
+<PRIVATE
+
+: normalized ( a b c quot: ( a b c -- a' b' c' ) -- a' b' c' )
+    [ 3dup min min ] dip over
+    [ [ - ] curry tri@ ]
+    [ call ]
+    [ [ + ] curry tri@ ] tri* ; inline
+
+:: ryb>rgb ( r! y! b! -- r g b )
+    r y b max max :> my
+
+    y b min :> g!
+    y g - y!
+    b g - b!
+
+    b g [ 0 > ] both? [
+        b 2 * b!
+        g 2 * g!
+    ] when
+
+    r y + r!
+    g y + g!
+
+    r g b 3dup max max [
+        my swap / [ * ] curry tri@
+    ] unless-zero ;
+
+:: rgb>ryb ( r! g! b! -- r y b )
+    r g b max max :> mg
+
+    r g min :> y!
+    r y - r!
+    g y - g!
+
+    b g [ 0 > ] both? [
+        b 2 /f b!
+        g 2 /f g!
+    ] when
+
+    y g + y!
+    b g + b!
+
+    r y b 3dup max max [
+        mg swap / [ * ] curry tri@
+    ] unless-zero ;
+
+PRIVATE>
+
+M: ryba >rgba ( ryba -- rgba )
+    [
+        [ red>> ] [ yellow>> ] [ blue>> ] tri
+        [ ryb>rgb ] normalized
+    ] [ alpha>> ] bi <rgba> ;
+
+GENERIC: >ryba ( color -- ryba )
+
+M: object >ryba >rgba >ryba ;
+
+M: ryba >ryba ; inline
+
+M: rgba >ryba
+    >rgba-components [ [ rgb>ryb ] normalized ] [ <ryba> ] bi* ;
diff --git a/basis/colors/ryb/summary.txt b/basis/colors/ryb/summary.txt
new file mode 100644 (file)
index 0000000..8126477
--- /dev/null
@@ -0,0 +1 @@
+RYB colors
diff --git a/basis/colors/xyy/authors.txt b/basis/colors/xyy/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/xyy/summary.txt b/basis/colors/xyy/summary.txt
new file mode 100644 (file)
index 0000000..8c52adb
--- /dev/null
@@ -0,0 +1 @@
+CIE 1931 xyY colors
diff --git a/basis/colors/xyy/xyy-docs.factor b/basis/colors/xyy/xyy-docs.factor
new file mode 100644 (file)
index 0000000..b958d4f
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax ;
+IN: colors.xyy
+
+HELP: xyYa
+{ $class-description "The class of CIE 1931 xyY colors with an alpha channel." } ;
+
+ARTICLE: "colors.xyy" "CIE 1931 xyY colors"
+"The " { $vocab-link "colors.xyy" } " vocabulary implements CIE 1931 xyY colors, together with an alpha channel."
+{ $subsections
+    xyYa
+    <xyYa>
+    >xyYa
+}
+"For more information, see " { $url "https://en.wikipedia.org/wiki/CIE_1931_color_space" }
+{ $see-also "colors" } ;
+
+ABOUT: "colors.xyy"
diff --git a/basis/colors/xyy/xyy-tests.factor b/basis/colors/xyy/xyy-tests.factor
new file mode 100644 (file)
index 0000000..d4c0b3a
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.xyy kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >xyYa >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/xyy/xyy.factor b/basis/colors/xyy/xyy.factor
new file mode 100644 (file)
index 0000000..d4826bc
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors colors.xyz kernel locals math ;
+
+IN: colors.xyy
+
+TUPLE: xyYa x y Y alpha ;
+
+C: <xyYa> xyYa
+
+M: xyYa >rgba
+    >xyza >rgba ;
+
+M: xyYa >xyza
+    [
+        [let
+            [ x>> ] [ y>> ] [ Y>> ] tri :> ( x y Y )
+            x y / Y *
+            Y
+            1 x - y - y / Y *
+        ]
+    ] [ alpha>> ] bi <xyza> ;
+
+GENERIC: >xyYa ( color -- xyYa )
+
+M: object >xyYa >xyza >xyYa ;
+
+M: xyYa >xyYa ; inline
+
+M: xyza >xyYa
+    [
+        [let
+            [ x>> ] [ y>> ] [ z>> ] tri :> ( x y z )
+            x y z + +
+            [ x swap / ]
+            [ y swap / ] bi
+            y
+        ]
+    ] [ alpha>> ] bi <xyYa> ;
diff --git a/basis/colors/xyz/authors.txt b/basis/colors/xyz/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/xyz/summary.txt b/basis/colors/xyz/summary.txt
new file mode 100644 (file)
index 0000000..a0dce8c
--- /dev/null
@@ -0,0 +1 @@
+CIE 1931 XYZ colors
diff --git a/basis/colors/xyz/xyz-docs.factor b/basis/colors/xyz/xyz-docs.factor
new file mode 100644 (file)
index 0000000..20807a9
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax ;
+IN: colors.xyz
+
+HELP: xyza
+{ $class-description "The class of CIE 1931 XYZ colors with an alpha channel." } ;
+
+ARTICLE: "colors.xyz" "CIE 1931 XYZ colors"
+"The " { $vocab-link "colors.xyz" } " vocabulary implements CIE 1931 XYZ colors, together with an alpha channel."
+{ $subsections
+    xyza
+    <xyza>
+    >xyza
+}
+"For more information, see " { $url "https://en.wikipedia.org/wiki/CIE_1931_color_space" }
+{ $see-also "colors" } ;
+
+ABOUT: "colors.xyz"
diff --git a/basis/colors/xyz/xyz-tests.factor b/basis/colors/xyz/xyz-tests.factor
new file mode 100644 (file)
index 0000000..7984859
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.xyz kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >xyza >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/xyz/xyz.factor b/basis/colors/xyz/xyz.factor
new file mode 100644 (file)
index 0000000..7a60549
--- /dev/null
@@ -0,0 +1,60 @@
+! Copyright (C) 2014 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors kernel locals math math.functions
+math.order ;
+
+IN: colors.xyz
+
+TUPLE: xyza x y z alpha ;
+
+C: <xyza> xyza
+
+<PRIVATE
+
+CONSTANT: xyz_epsilon 216/24389
+CONSTANT: xyz_kappa 24389/27
+
+CONSTANT: wp_x 0.95047
+CONSTANT: wp_y 1.00000
+CONSTANT: wp_z 1.08883
+
+: srgb-compand ( v -- v' )
+    dup 0.0031308 <= [ 12.92 * ] [ 2.4 recip ^ 1.055 * 0.055 - ] if ;
+
+PRIVATE>
+
+M: xyza >rgba
+    [
+        [let
+            [ x>> ] [ y>> ] [ z>> ] tri :> ( x y z )
+            x 3.2404542 * y -1.5371385 * z -0.4985314 * + +
+            x -0.9692660 * y 1.8760108 * z 0.0415560 * + +
+            x 0.0556434 * y -0.2040259 * z 1.0572252 * + +
+            [ srgb-compand 0.0 1.0 clamp ] tri@
+        ]
+    ] [ alpha>> ] bi <rgba> ;
+
+GENERIC: >xyza ( color -- xyza )
+
+M: object >xyza >rgba >xyza ;
+
+M: xyza >xyza ; inline
+
+<PRIVATE
+
+: invert-rgb-compand ( v -- v' )
+    dup 0.04045 <= [ 12.92 / ] [ 0.055 + 1.055 / 2.4 ^ ] if ;
+
+PRIVATE>
+
+M: rgba >xyza
+    [
+        [let
+            [ red>> ] [ green>> ] [ blue>> ] tri
+            [ invert-rgb-compand ] tri@ :> ( r g b )
+            r 0.4124564 * g 0.3575761 * b 0.1804375 * + +
+            r 0.2126729 * g 0.7151522 * b 0.0721750 * + +
+            r 0.0193339 * g 0.1191920 * b 0.9503041 * + +
+        ]
+    ] [ alpha>> ] bi <xyza> ;
diff --git a/basis/colors/yiq/authors.txt b/basis/colors/yiq/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/yiq/summary.txt b/basis/colors/yiq/summary.txt
new file mode 100644 (file)
index 0000000..d91634e
--- /dev/null
@@ -0,0 +1 @@
+YIQ colors
diff --git a/basis/colors/yiq/yiq-docs.factor b/basis/colors/yiq/yiq-docs.factor
new file mode 100644 (file)
index 0000000..8a7e42b
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax ;
+IN: colors.yiq
+
+HELP: yiqa
+{ $class-description "The class of YIQ (Y, In-Place, Quadrature) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
+
+ARTICLE: "colors.yiq" "YIQ colors"
+"The " { $vocab-link "colors.yiq" } " vocabulary implements colors specified by their Y, in-place, and quadrature components, together with an alpha channel."
+{ $subsections
+    yiqa
+    <yiqa>
+    >yiqa
+}
+{ $see-also "colors" } ;
+
+ABOUT: "colors.yiq"
diff --git a/basis/colors/yiq/yiq-tests.factor b/basis/colors/yiq/yiq-tests.factor
new file mode 100644 (file)
index 0000000..dbb5b3f
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.yiq kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >yiqa >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00000001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/yiq/yiq.factor b/basis/colors/yiq/yiq.factor
new file mode 100644 (file)
index 0000000..2ab943b
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2012 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors combinators kernel locals math
+math.order ;
+
+IN: colors.yiq
+
+TUPLE: yiqa < color
+{ y read-only }
+{ in-phase read-only }
+{ quadrature read-only }
+{ alpha read-only } ;
+
+C: <yiqa> yiqa
+
+M: yiqa >rgba
+    {
+        [ y>> ] [ in-phase>> ] [ quadrature>> ] [ alpha>> ]
+    } cleave [
+        [ [ 0.9468822170900693 * ] [ 0.6235565819861433 * ] bi* + + ]
+        [ [ 0.27478764629897834 * ] [ 0.6356910791873801 * ] bi* + - ]
+        [ [ 1.1085450346420322 * ] [ 1.7090069284064666 * ] bi* - - ]
+        3tri [ 0.0 1.0 clamp ] tri@
+    ] dip <rgba> ; inline
+
+GENERIC: >yiqa ( color -- yiqa )
+
+M: object >yiqa >rgba >yiqa ;
+
+M: yiqa >yiqa ; inline
+
+M:: rgba >yiqa ( rgba -- yiqa )
+    rgba >rgba-components :> ( r g b a )
+    0.30 r *  0.59 g * 0.11 b * + + :> y
+    r y - :> r-y
+    b y - :> b-y
+    0.74 r-y * 0.27 b-y * - :> i
+    0.48 r-y * 0.41 b-y * + :> q
+    y i q a <yiqa> ;
diff --git a/basis/colors/yuv/authors.txt b/basis/colors/yuv/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/basis/colors/yuv/summary.txt b/basis/colors/yuv/summary.txt
new file mode 100644 (file)
index 0000000..7e99506
--- /dev/null
@@ -0,0 +1 @@
+YUV colors
diff --git a/basis/colors/yuv/yuv-docs.factor b/basis/colors/yuv/yuv-docs.factor
new file mode 100644 (file)
index 0000000..3f43d08
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax ;
+IN: colors.yuv
+
+HELP: yuva
+{ $class-description "The class of YUV colors with an alpha channel." } ;
+
+ARTICLE: "colors.yuv" "YUV colors"
+"The " { $vocab-link "colors.yuv" } " vocabulary implements colors specified by their Y', U, and V components, together with an alpha channel."
+{ $subsections
+    yuva
+    <yuva>
+    >yuva
+}
+{ $see-also "colors" } ;
+
+ABOUT: "colors.yuv"
diff --git a/basis/colors/yuv/yuv-tests.factor b/basis/colors/yuv/yuv-tests.factor
new file mode 100644 (file)
index 0000000..024e7d4
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: arrays colors colors.yuv kernel locals math.functions
+math.ranges sequences tools.test ;
+
+{ t } [
+    0.0 1.0 0.1 <range> [| r |
+        0.0 1.0 0.1 <range> [| g |
+            0.0 1.0 0.1 <range> [| b |
+                r g b 1.0 <rgba> dup >yuva >rgba
+                [ >rgba-components 4array ] bi@
+                [ 0.00000001 ~ ] 2all?
+            ] all?
+        ] all?
+    ] all?
+] unit-test
diff --git a/basis/colors/yuv/yuv.factor b/basis/colors/yuv/yuv.factor
new file mode 100644 (file)
index 0000000..4c06eed
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors colors combinators kernel locals math
+math.order ;
+
+IN: colors.yuv
+
+TUPLE: yuva < color
+{ y read-only }
+{ u read-only }
+{ v read-only }
+{ alpha read-only } ;
+
+C: <yuva> yuva
+
+<PRIVATE
+
+CONSTANT: Wr 0.299
+CONSTANT: Wb 0.114
+CONSTANT: Wg 0.587
+CONSTANT: Umax 0.436
+CONSTANT: Vmax 0.615
+
+PRIVATE>
+
+M: yuva >rgba
+    { [ y>> ] [ u>> ] [ v>> ] [ alpha>> ] } cleave
+    [| y u v |
+        y 1 Wr - Vmax / v * +
+
+        y
+        Wb 1 Wb - * Umax Wg * / neg u *
+        Wr 1 Wr - * Vmax Wg * / neg v * + +
+
+        y 1 Wb - Umax / u * +
+
+        [ 0.0 1.0 clamp ] tri@
+    ] dip <rgba> ; inline
+
+GENERIC: >yuva ( color -- yuva )
+
+M: object >yuva >rgba >yuva ;
+
+M: yuva >yuva ; inline
+
+M:: rgba >yuva ( rgba -- yuva )
+    rgba >rgba-components :> ( r g b a )
+    Wr r * Wg g * Wb b * + + :> y
+    Umax 1 Wb - / b y - * :> u
+    Vmax 1 Wr - / r y - * :> v
+    y u v a <yuva> ;
diff --git a/extra/colors/cmyk/authors.txt b/extra/colors/cmyk/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/cmyk/cmyk-docs.factor b/extra/colors/cmyk/cmyk-docs.factor
deleted file mode 100644 (file)
index 33484cf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.cmyk
-
-HELP: cmyka
-{ $class-description "The class of CMYK (Cyan, Magenta, Yellow, Black) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
-
-ARTICLE: "colors.cmyk" "CMYK colors"
-"The " { $vocab-link "colors.cmyk" } " vocabulary implements colors specified by their cyan, magenta, yellow, and black components, together with an alpha channel."
-{ $subsections
-    cmyka
-    <cmyka>
-    >cmyka
-}
-{ $see-also "colors" } ;
-
-ABOUT: "colors.cmyk"
diff --git a/extra/colors/cmyk/cmyk-tests.factor b/extra/colors/cmyk/cmyk-tests.factor
deleted file mode 100644 (file)
index bd9894d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.cmyk kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >cmyka >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00000001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/cmyk/cmyk.factor b/extra/colors/cmyk/cmyk.factor
deleted file mode 100644 (file)
index dc8e7dc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-! Copyright (C) 2012 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors combinators colors colors.gray kernel math
-math.order ;
-
-IN: colors.cmyk
-
-TUPLE: cmyka < color
-{ cyan read-only }
-{ magenta read-only }
-{ yellow read-only }
-{ black read-only }
-{ alpha read-only } ;
-
-C: <cmyka> cmyka
-
-M: cmyka >rgba
-    [ [ cyan>> ] [ black>> ] bi + ]
-    [ [ magenta>> ] [ black>> ] bi + ]
-    [ [ yellow>> ] [ black>> ] bi + ] tri
-    [ 1.0 min 1.0 swap - ] tri@ 1.0 <rgba> ; inline
-
-GENERIC: >cmyka ( color -- cmyka )
-
-M: object >cmyka >rgba >cmyka ;
-
-M: rgba >cmyka
-    >rgba-components [
-        [ 1 swap - ] tri@ 3dup min min
-        [ [ - 0.0 1.0 clamp ] curry tri@ ] keep
-    ] dip <cmyka> ;
-
-M: cmyka >gray
-    [
-        {
-            [ cyan>> 0.3 * ]
-            [ magenta>> 0.59 * ]
-            [ yellow>> 0.11 * ]
-            [ black>> ]
-        } cleave + + + 1.0 min 1.0 swap -
-    ] [ alpha>> ] bi <gray> ;
diff --git a/extra/colors/cmyk/summary.txt b/extra/colors/cmyk/summary.txt
deleted file mode 100644 (file)
index 10ca1ba..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CMYK colors
diff --git a/extra/colors/hsl/authors.txt b/extra/colors/hsl/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/hsl/hsl-docs.factor b/extra/colors/hsl/hsl-docs.factor
deleted file mode 100644 (file)
index aec3d66..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.hsl
-
-HELP: hsla
-{ $class-description "The class of HSL (Hue, Saturation, Lightness) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
-
-ARTICLE: "colors.hsl" "HSL colors"
-"The " { $vocab-link "colors.hsl" } " vocabulary implements colors specified by their hue, saturation, and lightness components, together with an alpha channel."
-{ $subsections
-    hsla
-    <hsla>
-    >hsla
-}
-{ $see-also "colors" } ;
-
-ABOUT: "colors.hsl"
diff --git a/extra/colors/hsl/hsl-tests.factor b/extra/colors/hsl/hsl-tests.factor
deleted file mode 100644 (file)
index 09fafa6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.hsl kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >hsla >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00000001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/hsl/hsl.factor b/extra/colors/hsl/hsl.factor
deleted file mode 100644 (file)
index f61bc6e..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-! Copyright (C) 2012 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors combinators kernel locals math
-math.order ;
-
-IN: colors.hsl
-
-TUPLE: hsla < color
-{ hue read-only }
-{ saturation read-only }
-{ lightness read-only }
-{ alpha read-only } ;
-
-C: <hsla> hsla
-
-<PRIVATE
-
-: value ( p q t -- value )
-    dup 0 < [ 1.0 + ] when
-    dup 1 > [ 1.0 - ] when
-    {
-        { [ dup 1/6 < ] [ [ over - ] dip * 6 * + ] }
-        { [ dup 1/2 < ] [ drop nip ] }
-        { [ dup 2/3 < ] [ [ over - ] dip 2/3 swap - * 6 * + ] }
-        [ 2drop ]
-    } cond ;
-
-PRIVATE>
-
-M: hsla >rgba
-    {
-        [ hue>> ] [ saturation>> ] [ lightness>> ] [ alpha>> ]
-    } cleave [| h s l |
-        s zero? [
-            l l l
-        ] [
-            l 0.5 < [ l s 1 + * ] [ l s + l s * - ] if :> q
-            l 2 * q - :> p
-            p q h 1/3 + value
-            p q h value
-            p q h 1/3 - value
-        ] if
-    ] dip <rgba> ; inline
-
-GENERIC: >hsla ( color -- hsla )
-
-M: object >hsla >rgba >hsla ;
-
-M: hsla >hsla ; inline
-
-M: rgba >hsla
-    >rgba-components [| r g b |
-        r g b min min :> min-c
-        r g b max max :> max-c
-        min-c max-c + 2 / :> l
-        max-c min-c - :> d
-        d zero? [ 0.0 0.0 ] [
-            max-c {
-                { r [ g b - d / g b < 6.0 0.0 ? + ] }
-                { g [ b r - d / 2.0 + ] }
-                { b [ r g - d / 4.0 + ] }
-            } case 6.0 /
-            l 0.5 > [
-                d 2 max-c - min-c - /
-            ] [
-                d max-c min-c + /
-            ] if
-        ] if l
-    ] dip <hsla> ;
diff --git a/extra/colors/hsl/summary.txt b/extra/colors/hsl/summary.txt
deleted file mode 100644 (file)
index 063c135..0000000
+++ /dev/null
@@ -1 +0,0 @@
-HSL colors
diff --git a/extra/colors/lab/authors.txt b/extra/colors/lab/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/lab/lab-docs.factor b/extra/colors/lab/lab-docs.factor
deleted file mode 100644 (file)
index 4b52f8c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.lab
-
-HELP: laba
-{ $class-description "The class of CIE 1976 LAB (commonly called CIELAB) colors with an alpha channel." } ;
-
-ARTICLE: "colors.lab" "CIE 1976 LAB colors"
-"The " { $vocab-link "colors.lab" } " vocabulary implements CIE 1976 LAB colors, specifying luminance (in approximately " { $snippet "[0,100]" } "), red/green, and blue/yellow components, together with an alpha channel."
-{ $subsections
-    laba
-    <laba>
-    >laba
-}
-"For more information, see " { $url "https://en.wikipedia.org/wiki/Lab_color_space" }
-{ $see-also "colors" } ;
-
-ABOUT: "colors.lab"
diff --git a/extra/colors/lab/lab-tests.factor b/extra/colors/lab/lab-tests.factor
deleted file mode 100644 (file)
index 3790bd2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.lab kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >laba >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/lab/lab.factor b/extra/colors/lab/lab.factor
deleted file mode 100644 (file)
index abdc066..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors colors.xyz colors.xyz.private kernel
-locals math math.functions ;
-
-IN: colors.lab
-
-TUPLE: laba l a b alpha ;
-
-C: <laba> laba
-
-M: laba >rgba >xyza >rgba ;
-
-M: laba >xyza
-    [
-        [let
-            [ l>> ] [ a>> ] [ b>> ] tri :> ( l a b )
-            l 16 + 116 / :> fy
-            a 500 / fy + :> fx
-            fy b 200 / - :> fz
-
-            fx 3 ^ :> fx3
-            fz 3 ^ :> fz3
-
-            fx3 xyz_epsilon > [
-                fx3
-            ] [
-                116 fx * 16 - xyz_kappa /
-            ] if :> x
-
-            l xyz_kappa xyz_epsilon * > [
-                l 16 + 116 / 3 ^
-            ] [
-                l xyz_kappa /
-            ] if :> y
-
-            fz3 xyz_epsilon > [
-                fz3
-            ] [
-                116 fz * 16 - xyz_kappa /
-            ] if :> z
-
-            x wp_x * y wp_y * z wp_z *
-        ]
-    ] [ alpha>> ] bi <xyza> ;
-
-GENERIC: >laba ( color -- laba )
-
-M: object >laba >rgba >laba ;
-
-M: rgba >laba >xyza >laba ;
-
-M: xyza >laba
-    [
-        [let
-            [ x>> wp_x / ] [ y>> wp_y / ] [ z>> wp_z / ] tri
-            [
-                dup xyz_epsilon >
-                [ 1/3 ^ ] [ xyz_kappa * 16 + 116 / ] if
-            ] tri@ :> ( fx fy fz )
-            116 fy * 16 -
-            500 fx fy - *
-            200 fy fz - *
-        ]
-    ] [ alpha>> ] bi <laba> ;
diff --git a/extra/colors/lab/summary.txt b/extra/colors/lab/summary.txt
deleted file mode 100644 (file)
index 904f605..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CIE 1976 LAB colors
diff --git a/extra/colors/lch/authors.txt b/extra/colors/lch/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/lch/lch-tests.factor b/extra/colors/lch/lch-tests.factor
deleted file mode 100644 (file)
index 6811cfb..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.lch kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >LCHuv >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >LCHab >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/lch/lch.factor b/extra/colors/lch/lch.factor
deleted file mode 100644 (file)
index bdfe54b..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors colors.lab colors.luv colors.xyz kernel
-locals math math.functions math.libm math.trig ;
-
-IN: colors.lch
-
-TUPLE: LCHuv l c h alpha ;
-
-C: <LCHuv> LCHuv
-
-M: LCHuv >rgba >luva >rgba ;
-
-M: LCHuv >xyza >luva >xyza ;
-
-M: LCHuv >luva
-    [
-        [let
-            [ l>> ] [ c>> ] [ h>> ] tri :> ( l c h )
-            h deg>rad :> hr
-
-            l
-            c hr cos *
-            c hr sin *
-        ]
-    ] [ alpha>> ] bi <luva> ;
-
-GENERIC: >LCHuv ( color -- LCHuv )
-
-M: object >LCHuv >luva >LCHuv ;
-
-M: LCHuv >LCHuv ; inline
-
-M: luva >LCHuv
-    [
-        [let
-            [ l>> ] [ u>> ] [ v>> ] tri :> ( l u v )
-            v u fatan2 rad>deg
-            [ dup 360 > ] [ 360 - ] while
-            [ dup 0 < ] [ 360 + ] while :> h
-
-            l
-            u sq v sq + sqrt
-            h
-        ]
-    ] [ alpha>> ] bi <LCHuv> ;
-
-TUPLE: LCHab l c h alpha ;
-
-C: <LCHab> LCHab
-
-M: LCHab >rgba >laba >rgba ;
-
-M: LCHab >laba
-    [
-        [let
-            [ l>> ] [ c>> ] [ h>> ] tri :> ( l c h )
-            h deg>rad :> hr
-
-            l
-            c hr cos *
-            c hr sin *
-        ]
-    ] [ alpha>> ] bi <laba> ;
-
-GENERIC: >LCHab ( color -- LCHab )
-
-M: object >LCHab >laba >LCHab ;
-
-M: LCHab >LCHab ; inline
-
-M: laba >LCHab
-    [
-        [let
-            [ l>> ] [ a>> ] [ b>> ] tri :> ( l a b )
-            b a fatan2 rad>deg
-            [ dup 360 > ] [ 360 - ] while
-            [ dup 0 < ] [ 360 + ] while :> h
-
-            l
-            a sq b sq + sqrt
-            h
-        ]
-    ] [ alpha>> ] bi <LCHab> ;
diff --git a/extra/colors/lch/summary.txt b/extra/colors/lch/summary.txt
deleted file mode 100644 (file)
index bbfed8a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CIELCH colors
diff --git a/extra/colors/luv/authors.txt b/extra/colors/luv/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/luv/luv-docs.factor b/extra/colors/luv/luv-docs.factor
deleted file mode 100644 (file)
index 5afbc53..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.luv
-
-HELP: luva
-{ $class-description "The class of CIE 1976 LUV (commonly called CIELUV) colors with an alpha channel." } ;
-
-ARTICLE: "colors.luv" "CIE 1976 LUV colors"
-"The " { $vocab-link "colors.luv" } " vocabulary implements CIE 1976 LUV colors, together with an alpha channel."
-{ $subsections
-    luva
-    <luva>
-    >luva
-}
-"For more information, see " { $url "https://en.wikipedia.org/wiki/CIELUV_color_space" }
-{ $see-also "colors" } ;
-
-ABOUT: "colors.luv"
diff --git a/extra/colors/luv/luv-tests.factor b/extra/colors/luv/luv-tests.factor
deleted file mode 100644 (file)
index c47365a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.luv kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >luva >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/luv/luv.factor b/extra/colors/luv/luv.factor
deleted file mode 100644 (file)
index c756e82..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors colors.xyz colors.xyz.private kernel
-locals math math.functions ;
-
-IN: colors.luv
-
-TUPLE: luva l u v alpha ;
-
-C: <luva> luva
-
-<PRIVATE
-
-:: xyz-to-uv ( x y z -- u v )
-    x y 15 * z 3 * + + :> d
-    4 x * d /
-    9 y * d / ; foldable
-
-PRIVATE>
-
-M: luva >rgba >xyza >rgba ;
-
-M: luva >xyza
-    [
-        [let
-            wp_x wp_y wp_z xyz-to-uv :> ( u_wp v_wp )
-            [ l>> ] [ u>> ] [ v>> ] tri :> ( l u v )
-
-            52 l * 13 l * u_wp * u + / 1 - 3 / :> a
-            l xyz_kappa xyz_epsilon * > [
-                l 16 + 116 / 3 ^ wp_y *
-            ] [
-                l xyz_kappa / wp_y *
-            ] if :> y
-            y -5 * :> b
-            39 l * 13 l * v_wp * v + / 5 - y * :> d
-            d b - a 1/3 + / :> x
-            a x * b + :> z
-
-            x y z
-        ]
-    ] [ alpha>> ] bi <xyza> ;
-
-GENERIC: >luva ( color -- luva )
-
-M: object >luva >rgba >luva ;
-
-M: rgba >luva >xyza >luva ;
-
-M: luva >luva ; inline
-
-M: xyza >luva
-    [
-        [let
-            wp_x wp_y wp_z xyz-to-uv :> ( u_wp v_wp )
-            [ x>> ] [ y>> ] [ z>> ] tri :> ( x_ y_ z_ )
-            x_ y_ z_ xyz-to-uv :> ( u_ v_ )
-
-            y_ wp_y / :> y
-
-            y xyz_epsilon > [
-                y 1/3 ^ 116 * 16 -
-            ] [
-                xyz_kappa y *
-            ] if :> l
-            13 l * u_ u_wp - * :> u
-            13 l * v_ v_wp - * :> v
-
-            l u v
-        ]
-    ] [ alpha>> ] bi <luva> ;
diff --git a/extra/colors/luv/summary.txt b/extra/colors/luv/summary.txt
deleted file mode 100644 (file)
index 186c3b6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CIE 1976 LUV colors
diff --git a/extra/colors/ryb/authors.txt b/extra/colors/ryb/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/ryb/ryb-docs.factor b/extra/colors/ryb/ryb-docs.factor
deleted file mode 100644 (file)
index 66ed783..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.ryb
-
-HELP: ryba
-{ $class-description "The class of RYB (Red, Yellow, Blue) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
-
-ARTICLE: "colors.ryb" "RYB colors"
-"The " { $vocab-link "colors.ryb" } " vocabulary implements colors specified by their red, yellow, and blue components, together with an alpha channel."
-{ $subsections
-    ryba
-    <ryba>
-    >ryba
-}
-{ $see-also "colors" } ;
-
-ABOUT: "colors.ryb"
diff --git a/extra/colors/ryb/ryb-tests.factor b/extra/colors/ryb/ryb-tests.factor
deleted file mode 100644 (file)
index 18bcd38..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.ryb kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >ryba >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00000001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/ryb/ryb.factor b/extra/colors/ryb/ryb.factor
deleted file mode 100644 (file)
index d96cc15..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors kernel locals math math.order ;
-
-IN: colors.ryb
-
-TUPLE: ryba < color
-    { red read-only }
-    { yellow read-only }
-    { blue read-only }
-    { alpha read-only } ;
-
-C: <ryba> ryba
-
-<PRIVATE
-
-: normalized ( a b c quot: ( a b c -- a' b' c' ) -- a' b' c' )
-    [ 3dup min min ] dip over
-    [ [ - ] curry tri@ ]
-    [ call ]
-    [ [ + ] curry tri@ ] tri* ; inline
-
-:: ryb>rgb ( r! y! b! -- r g b )
-    r y b max max :> my
-
-    y b min :> g!
-    y g - y!
-    b g - b!
-
-    b g [ 0 > ] both? [
-        b 2 * b!
-        g 2 * g!
-    ] when
-
-    r y + r!
-    g y + g!
-
-    r g b 3dup max max [
-        my swap / [ * ] curry tri@
-    ] unless-zero ;
-
-:: rgb>ryb ( r! g! b! -- r y b )
-    r g b max max :> mg
-
-    r g min :> y!
-    r y - r!
-    g y - g!
-
-    b g [ 0 > ] both? [
-        b 2 /f b!
-        g 2 /f g!
-    ] when
-
-    y g + y!
-    b g + b!
-
-    r y b 3dup max max [
-        mg swap / [ * ] curry tri@
-    ] unless-zero ;
-
-PRIVATE>
-
-M: ryba >rgba ( ryba -- rgba )
-    [
-        [ red>> ] [ yellow>> ] [ blue>> ] tri
-        [ ryb>rgb ] normalized
-    ] [ alpha>> ] bi <rgba> ;
-
-GENERIC: >ryba ( color -- ryba )
-
-M: object >ryba >rgba >ryba ;
-
-M: ryba >ryba ; inline
-
-M: rgba >ryba
-    >rgba-components [ [ rgb>ryb ] normalized ] [ <ryba> ] bi* ;
diff --git a/extra/colors/ryb/summary.txt b/extra/colors/ryb/summary.txt
deleted file mode 100644 (file)
index 8126477..0000000
+++ /dev/null
@@ -1 +0,0 @@
-RYB colors
diff --git a/extra/colors/xyy/authors.txt b/extra/colors/xyy/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/xyy/summary.txt b/extra/colors/xyy/summary.txt
deleted file mode 100644 (file)
index 8c52adb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CIE 1931 xyY colors
diff --git a/extra/colors/xyy/xyy-docs.factor b/extra/colors/xyy/xyy-docs.factor
deleted file mode 100644 (file)
index b958d4f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.xyy
-
-HELP: xyYa
-{ $class-description "The class of CIE 1931 xyY colors with an alpha channel." } ;
-
-ARTICLE: "colors.xyy" "CIE 1931 xyY colors"
-"The " { $vocab-link "colors.xyy" } " vocabulary implements CIE 1931 xyY colors, together with an alpha channel."
-{ $subsections
-    xyYa
-    <xyYa>
-    >xyYa
-}
-"For more information, see " { $url "https://en.wikipedia.org/wiki/CIE_1931_color_space" }
-{ $see-also "colors" } ;
-
-ABOUT: "colors.xyy"
diff --git a/extra/colors/xyy/xyy-tests.factor b/extra/colors/xyy/xyy-tests.factor
deleted file mode 100644 (file)
index d4c0b3a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.xyy kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >xyYa >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/xyy/xyy.factor b/extra/colors/xyy/xyy.factor
deleted file mode 100644 (file)
index d4826bc..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors colors.xyz kernel locals math ;
-
-IN: colors.xyy
-
-TUPLE: xyYa x y Y alpha ;
-
-C: <xyYa> xyYa
-
-M: xyYa >rgba
-    >xyza >rgba ;
-
-M: xyYa >xyza
-    [
-        [let
-            [ x>> ] [ y>> ] [ Y>> ] tri :> ( x y Y )
-            x y / Y *
-            Y
-            1 x - y - y / Y *
-        ]
-    ] [ alpha>> ] bi <xyza> ;
-
-GENERIC: >xyYa ( color -- xyYa )
-
-M: object >xyYa >xyza >xyYa ;
-
-M: xyYa >xyYa ; inline
-
-M: xyza >xyYa
-    [
-        [let
-            [ x>> ] [ y>> ] [ z>> ] tri :> ( x y z )
-            x y z + +
-            [ x swap / ]
-            [ y swap / ] bi
-            y
-        ]
-    ] [ alpha>> ] bi <xyYa> ;
diff --git a/extra/colors/xyz/authors.txt b/extra/colors/xyz/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/xyz/summary.txt b/extra/colors/xyz/summary.txt
deleted file mode 100644 (file)
index a0dce8c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CIE 1931 XYZ colors
diff --git a/extra/colors/xyz/xyz-docs.factor b/extra/colors/xyz/xyz-docs.factor
deleted file mode 100644 (file)
index 20807a9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.xyz
-
-HELP: xyza
-{ $class-description "The class of CIE 1931 XYZ colors with an alpha channel." } ;
-
-ARTICLE: "colors.xyz" "CIE 1931 XYZ colors"
-"The " { $vocab-link "colors.xyz" } " vocabulary implements CIE 1931 XYZ colors, together with an alpha channel."
-{ $subsections
-    xyza
-    <xyza>
-    >xyza
-}
-"For more information, see " { $url "https://en.wikipedia.org/wiki/CIE_1931_color_space" }
-{ $see-also "colors" } ;
-
-ABOUT: "colors.xyz"
diff --git a/extra/colors/xyz/xyz-tests.factor b/extra/colors/xyz/xyz-tests.factor
deleted file mode 100644 (file)
index 7984859..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.xyz kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >xyza >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/xyz/xyz.factor b/extra/colors/xyz/xyz.factor
deleted file mode 100644 (file)
index 7a60549..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-! Copyright (C) 2014 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors kernel locals math math.functions
-math.order ;
-
-IN: colors.xyz
-
-TUPLE: xyza x y z alpha ;
-
-C: <xyza> xyza
-
-<PRIVATE
-
-CONSTANT: xyz_epsilon 216/24389
-CONSTANT: xyz_kappa 24389/27
-
-CONSTANT: wp_x 0.95047
-CONSTANT: wp_y 1.00000
-CONSTANT: wp_z 1.08883
-
-: srgb-compand ( v -- v' )
-    dup 0.0031308 <= [ 12.92 * ] [ 2.4 recip ^ 1.055 * 0.055 - ] if ;
-
-PRIVATE>
-
-M: xyza >rgba
-    [
-        [let
-            [ x>> ] [ y>> ] [ z>> ] tri :> ( x y z )
-            x 3.2404542 * y -1.5371385 * z -0.4985314 * + +
-            x -0.9692660 * y 1.8760108 * z 0.0415560 * + +
-            x 0.0556434 * y -0.2040259 * z 1.0572252 * + +
-            [ srgb-compand 0.0 1.0 clamp ] tri@
-        ]
-    ] [ alpha>> ] bi <rgba> ;
-
-GENERIC: >xyza ( color -- xyza )
-
-M: object >xyza >rgba >xyza ;
-
-M: xyza >xyza ; inline
-
-<PRIVATE
-
-: invert-rgb-compand ( v -- v' )
-    dup 0.04045 <= [ 12.92 / ] [ 0.055 + 1.055 / 2.4 ^ ] if ;
-
-PRIVATE>
-
-M: rgba >xyza
-    [
-        [let
-            [ red>> ] [ green>> ] [ blue>> ] tri
-            [ invert-rgb-compand ] tri@ :> ( r g b )
-            r 0.4124564 * g 0.3575761 * b 0.1804375 * + +
-            r 0.2126729 * g 0.7151522 * b 0.0721750 * + +
-            r 0.0193339 * g 0.1191920 * b 0.9503041 * + +
-        ]
-    ] [ alpha>> ] bi <xyza> ;
diff --git a/extra/colors/yiq/authors.txt b/extra/colors/yiq/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/yiq/summary.txt b/extra/colors/yiq/summary.txt
deleted file mode 100644 (file)
index d91634e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-YIQ colors
diff --git a/extra/colors/yiq/yiq-docs.factor b/extra/colors/yiq/yiq-docs.factor
deleted file mode 100644 (file)
index 8a7e42b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.yiq
-
-HELP: yiqa
-{ $class-description "The class of YIQ (Y, In-Place, Quadrature) colors with an alpha channel. All slots store values in the interval " { $snippet "[0,1]" } "." } ;
-
-ARTICLE: "colors.yiq" "YIQ colors"
-"The " { $vocab-link "colors.yiq" } " vocabulary implements colors specified by their Y, in-place, and quadrature components, together with an alpha channel."
-{ $subsections
-    yiqa
-    <yiqa>
-    >yiqa
-}
-{ $see-also "colors" } ;
-
-ABOUT: "colors.yiq"
diff --git a/extra/colors/yiq/yiq-tests.factor b/extra/colors/yiq/yiq-tests.factor
deleted file mode 100644 (file)
index dbb5b3f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.yiq kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >yiqa >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00000001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/yiq/yiq.factor b/extra/colors/yiq/yiq.factor
deleted file mode 100644 (file)
index 2ab943b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2012 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors combinators kernel locals math
-math.order ;
-
-IN: colors.yiq
-
-TUPLE: yiqa < color
-{ y read-only }
-{ in-phase read-only }
-{ quadrature read-only }
-{ alpha read-only } ;
-
-C: <yiqa> yiqa
-
-M: yiqa >rgba
-    {
-        [ y>> ] [ in-phase>> ] [ quadrature>> ] [ alpha>> ]
-    } cleave [
-        [ [ 0.9468822170900693 * ] [ 0.6235565819861433 * ] bi* + + ]
-        [ [ 0.27478764629897834 * ] [ 0.6356910791873801 * ] bi* + - ]
-        [ [ 1.1085450346420322 * ] [ 1.7090069284064666 * ] bi* - - ]
-        3tri [ 0.0 1.0 clamp ] tri@
-    ] dip <rgba> ; inline
-
-GENERIC: >yiqa ( color -- yiqa )
-
-M: object >yiqa >rgba >yiqa ;
-
-M: yiqa >yiqa ; inline
-
-M:: rgba >yiqa ( rgba -- yiqa )
-    rgba >rgba-components :> ( r g b a )
-    0.30 r *  0.59 g * 0.11 b * + + :> y
-    r y - :> r-y
-    b y - :> b-y
-    0.74 r-y * 0.27 b-y * - :> i
-    0.48 r-y * 0.41 b-y * + :> q
-    y i q a <yiqa> ;
diff --git a/extra/colors/yuv/authors.txt b/extra/colors/yuv/authors.txt
deleted file mode 100644 (file)
index e091bb8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-John Benediktsson
diff --git a/extra/colors/yuv/summary.txt b/extra/colors/yuv/summary.txt
deleted file mode 100644 (file)
index 7e99506..0000000
+++ /dev/null
@@ -1 +0,0 @@
-YUV colors
diff --git a/extra/colors/yuv/yuv-docs.factor b/extra/colors/yuv/yuv-docs.factor
deleted file mode 100644 (file)
index 3f43d08..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USING: help.markup help.syntax ;
-IN: colors.yuv
-
-HELP: yuva
-{ $class-description "The class of YUV colors with an alpha channel." } ;
-
-ARTICLE: "colors.yuv" "YUV colors"
-"The " { $vocab-link "colors.yuv" } " vocabulary implements colors specified by their Y', U, and V components, together with an alpha channel."
-{ $subsections
-    yuva
-    <yuva>
-    >yuva
-}
-{ $see-also "colors" } ;
-
-ABOUT: "colors.yuv"
diff --git a/extra/colors/yuv/yuv-tests.factor b/extra/colors/yuv/yuv-tests.factor
deleted file mode 100644 (file)
index 024e7d4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: arrays colors colors.yuv kernel locals math.functions
-math.ranges sequences tools.test ;
-
-{ t } [
-    0.0 1.0 0.1 <range> [| r |
-        0.0 1.0 0.1 <range> [| g |
-            0.0 1.0 0.1 <range> [| b |
-                r g b 1.0 <rgba> dup >yuva >rgba
-                [ >rgba-components 4array ] bi@
-                [ 0.00000001 ~ ] 2all?
-            ] all?
-        ] all?
-    ] all?
-] unit-test
diff --git a/extra/colors/yuv/yuv.factor b/extra/colors/yuv/yuv.factor
deleted file mode 100644 (file)
index 4c06eed..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-! Copyright (C) 2013 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
-USING: accessors colors combinators kernel locals math
-math.order ;
-
-IN: colors.yuv
-
-TUPLE: yuva < color
-{ y read-only }
-{ u read-only }
-{ v read-only }
-{ alpha read-only } ;
-
-C: <yuva> yuva
-
-<PRIVATE
-
-CONSTANT: Wr 0.299
-CONSTANT: Wb 0.114
-CONSTANT: Wg 0.587
-CONSTANT: Umax 0.436
-CONSTANT: Vmax 0.615
-
-PRIVATE>
-
-M: yuva >rgba
-    { [ y>> ] [ u>> ] [ v>> ] [ alpha>> ] } cleave
-    [| y u v |
-        y 1 Wr - Vmax / v * +
-
-        y
-        Wb 1 Wb - * Umax Wg * / neg u *
-        Wr 1 Wr - * Vmax Wg * / neg v * + +
-
-        y 1 Wb - Umax / u * +
-
-        [ 0.0 1.0 clamp ] tri@
-    ] dip <rgba> ; inline
-
-GENERIC: >yuva ( color -- yuva )
-
-M: object >yuva >rgba >yuva ;
-
-M: yuva >yuva ; inline
-
-M:: rgba >yuva ( rgba -- yuva )
-    rgba >rgba-components :> ( r g b a )
-    Wr r * Wg g * Wb b * + + :> y
-    Umax 1 Wb - / b y - * :> u
-    Vmax 1 Wr - / r y - * :> v
-    y u v a <yuva> ;