colors: adding linear-gradient.
parent
4fe22de451
commit
ac5c9a5d91
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2003, 2009 Slava Pestov.
|
||||
! Copyright (C) 2008 Eduardo Cavazos.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel accessors combinators math ;
|
||||
USING: accessors combinators kernel math locals ;
|
||||
IN: colors
|
||||
|
||||
TUPLE: color ;
|
||||
|
@ -27,4 +27,9 @@ M: color blue>> ( color -- blue ) >rgba blue>> ;
|
|||
|
||||
: opaque? ( color -- ? ) alpha>> 1 number= ;
|
||||
|
||||
CONSTANT: transparent T{ rgba f 0.0 0.0 0.0 0.0 }
|
||||
CONSTANT: transparent T{ rgba f 0.0 0.0 0.0 0.0 }
|
||||
|
||||
:: linear-gradient ( color1 color2 percent -- color )
|
||||
color1 >rgba-components drop [ 1.0 percent - * ] tri@
|
||||
color2 >rgba-components drop [ percent * ] tri@
|
||||
[ + ] tri-curry@ tri* 1.0 <rgba> ;
|
||||
|
|
Loading…
Reference in New Issue