]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/mandel/colors/colors.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / extra / benchmark / mandel / colors / colors.factor
1 USING: math math.order kernel arrays byte-arrays sequences
2 colors.hsv benchmark.mandel.params accessors colors ;
3 IN: benchmark.mandel.colors
4
5 : scale ( x -- y ) 255 * >fixnum ; inline
6
7 : scale-rgb ( rgba -- n )
8     [ red>> scale ] [ green>> scale ] [ blue>> scale ] tri 3byte-array ;
9
10 CONSTANT: sat 0.85
11 CONSTANT: val 0.85
12
13 : <color-map> ( nb-cols -- map )
14     dup [
15         360 * swap 1 + / sat val
16         1 <hsva> >rgba scale-rgb
17     ] with map ;
18
19 : color-map ( -- map )
20     max-iterations max-color min <color-map> ; foldable