]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/mandel/colors/colors.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / benchmark / mandel / colors / colors.factor
1 USING: math math.order kernel arrays byte-arrays sequences
2 colors.hsv benchmark.mandel.params ;
3 IN: benchmark.mandel.colors
4
5 : scale 255 * >fixnum ; inline
6
7 : scale-rgb ( r g b -- n ) [ scale ] tri@ 3byte-array ;
8
9 : sat 0.85 ; inline
10 : val 0.85 ; inline
11
12 : <color-map> ( nb-cols -- map )
13     dup [
14         360 * swap 1+ / sat val
15         3array hsv>rgb first3 scale-rgb
16     ] with map ;
17
18 : color-map ( -- map )
19     max-iterations max-color min <color-map> ; foldable