colors.yiq: expanded the number of digits in the coefficients for the rgba>yiqa conversions so that they match the FCC NTSC versions.
parent
183508b852
commit
a3e669aab3
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2012 John Benediktsson
|
! Copyright (C) 2012 John Benediktsson
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
|
|
||||||
USING: accessors colors combinators kernel math math.order ;
|
USING: accessors colors combinators kernel locals math
|
||||||
|
math.order ;
|
||||||
|
|
||||||
IN: colors.yiq
|
IN: colors.yiq
|
||||||
|
|
||||||
|
@ -17,16 +18,17 @@ M: yiqa >rgba
|
||||||
{
|
{
|
||||||
[ y>> ] [ in-phase>> ] [ quadrature>> ] [ alpha>> ]
|
[ y>> ] [ in-phase>> ] [ quadrature>> ] [ alpha>> ]
|
||||||
} cleave [
|
} cleave [
|
||||||
[ [ 0.948262 * ] [ 0.624013 * ] bi* + + ]
|
[ [ 0.9468822170900693 * ] [ 0.6235565819861433 * ] bi* + + ]
|
||||||
[ [ 0.276066 * ] [ 0.639810 * ] bi* + - ]
|
[ [ 0.27478764629897834 * ] [ 0.6356910791873801 * ] bi* + - ]
|
||||||
[ [ 1.105450 * ] [ 1.729860 * ] bi* - - ]
|
[ [ 1.1085450346420322 * ] [ 1.7090069284064666 * ] bi* - - ]
|
||||||
3tri [ 0.0 1.0 clamp ] tri@
|
3tri [ 0.0 1.0 clamp ] tri@
|
||||||
] dip <rgba> ; inline
|
] dip <rgba> ; inline
|
||||||
|
|
||||||
: rgba>yiqa ( rgba -- yiqa )
|
:: rgba>yiqa ( rgba -- yiqa )
|
||||||
>rgba-components [
|
rgba >rgba-components :> ( r g b a )
|
||||||
[ [ 0.30 * ] [ 0.59 * ] [ 0.11 * ] tri* + + ]
|
0.30 r * 0.59 g * 0.11 b * + + :> y
|
||||||
[ [ 0.60 * ] [ 0.28 * ] [ 0.32 * ] tri* + - ]
|
r y - :> r-y
|
||||||
[ [ 0.21 * ] [ 0.52 * ] [ 0.31 * ] tri* - - ]
|
b y - :> b-y
|
||||||
3tri
|
0.74 r-y * 0.27 b-y * - :> i
|
||||||
] dip <yiqa> ;
|
0.48 r-y * 0.41 b-y * + :> q
|
||||||
|
y i q a <yiqa> ;
|
||||||
|
|
Loading…
Reference in New Issue