ui.pens.gradient: update for iota
parent
4bab2ba807
commit
816b47561a
|
@ -1,4 +1,24 @@
|
|||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: tools.test ui.pens.gradient ;
|
||||
USING: tools.test ui.pens.gradient ui.pens.gradient.private
|
||||
colors.constants specialized-arrays alien.c-types ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: ui.pens.gradient.tests
|
||||
|
||||
[
|
||||
float-array{
|
||||
0.0
|
||||
0.0
|
||||
0.0
|
||||
100.0
|
||||
50.0
|
||||
0.0
|
||||
50.0
|
||||
100.0
|
||||
100.0
|
||||
0.0
|
||||
100.0
|
||||
100.0
|
||||
}
|
||||
] [
|
||||
{ 1 0 } { 100 100 } { COLOR: red COLOR: green COLOR: blue }
|
||||
gradient-vertices
|
||||
] unit-test
|
||||
|
|
|
@ -16,7 +16,7 @@ TUPLE: gradient < caching-pen colors last-vertices last-colors ;
|
|||
|
||||
:: gradient-vertices ( direction dim colors -- seq )
|
||||
direction dim v* dim over v- swap
|
||||
colors length dup 1 - v/n [ v*n ] with map
|
||||
colors length [ iota ] [ 1 - ] bi v/n [ v*n ] with map
|
||||
swap [ over v+ 2array ] curry map
|
||||
concat concat >float-array ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue