]> gitweb.factorcode.org Git - factor.git/blobdiff - 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
index 7bbb25a47d532a5be1c16628610b2524cd54592a..0300538ce101d0f9d3b07df6039a1fc47ccc3345 100644 (file)
@@ -1,18 +1,19 @@
 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 )