USING: math math.order kernel arrays byte-arrays sequences
-colors.hsv benchmark.mandel.params ;
+colors.hsv benchmark.mandel.params accessors colors ;
IN: benchmark.mandel.colors
-: scale 255 * >fixnum ; inline
+: scale ( x -- y ) 255 * >fixnum ; inline
-: scale-rgb ( r g b -- n ) [ scale ] tri@ 3byte-array ;
+: scale-rgb ( rgba -- n )
+ [ red>> scale ] [ green>> scale ] [ blue>> scale ] tri 3byte-array ;
-: sat 0.85 ; inline
-: val 0.85 ; inline
+CONSTANT: sat 0.85
+CONSTANT: val 0.85
: <color-map> ( nb-cols -- map )
dup [
- 360 * swap 1+ / sat val
- 3array hsv>rgb first3 scale-rgb
+ 360 * swap 1 + / sat val
+ 1 <hsva> >rgba scale-rgb
] with map ;
: color-map ( -- map )
- nb-iter max-color min <color-map> ; foldable
+ max-iterations max-color min <color-map> ; foldable