1 ! Copyright (C) 2012 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: accessors colors combinators kernel locals math
11 { in-phase read-only }
12 { quadrature read-only }
21 [ y>> ] [ in-phase>> ] [ quadrature>> ] [ alpha>> ]
23 [ [ 0.9468822170900693 * ] [ 0.6235565819861433 * ] bi* + + ]
24 [ [ 0.27478764629897834 * ] [ 0.6356910791873801 * ] bi* + - ]
25 [ [ 1.1085450346420322 * ] [ 1.7090069284064666 * ] bi* - - ]
26 3tri [ 0.0 1.0 clamp ] tri@
29 GENERIC: >yiqa ( color -- yiqa )
31 M: object >yiqa >rgba >yiqa ;
33 M: yiqa >yiqa ; inline
35 M:: rgba >yiqa ( rgba -- yiqa )
36 rgba >rgba-components :> ( r g b a )
37 0.30 r * 0.59 g * 0.11 b * + + :> y
40 0.74 r-y * 0.27 b-y * - :> i
41 0.48 r-y * 0.41 b-y * + :> q