]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/tinyvg/tinyvg.factor
colors: using 255 * round >integer for hex conversion
[factor.git] / extra / tinyvg / tinyvg.factor
index b7fc6ebcfc2218c1ab1cebe5d04e247290397002..8500bd8830a6ca2d870c08a24ac593ae002c97c4 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2021 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: accessors colors combinators generalizations io io.binary
+USING: accessors colors combinators endian generalizations io
 io.encodings.binary io.files io.streams.byte-array kernel math
-math.bitwise namespaces sequences ;
+math.bitwise math.functions namespaces sequences ;
 
 IN: tinyvg
 
@@ -38,7 +38,7 @@ ERROR: invalid-length n ;
     [ read1 255 /f ] 4 call-n <rgba> ;
 
 : write-rgba-8888 ( rgba -- )
-    >rgba-components [ 255 * >integer write1 ] 4 napply ;
+    >rgba-components [ 255 * round >integer write1 ] 4 napply ;
 
 : read-rgb-565 ( -- rgba )
     2 read le>
@@ -406,7 +406,7 @@ TUPLE: quadratic-bezier < instruction control point1 ;
 C: <quadratic-bezier> quadratic-bezier
 
 : read-tag ( -- line-width/f tag )
-    read1 [ 4 bit? [ read-unit ] [ f ] if* ] [ 3 bits ] bi ;
+    read1 [ 4 bit? [ read-unit ] [ f ] if ] [ 3 bits ] bi ;
 
 : read-arc ( -- large-arc? sweep? )
     read1 [ 0 bit? ] [ 1 bit? ] bi ;