]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/windows/types/types.factor
colors: using 255 * round >integer for hex conversion
[factor.git] / basis / windows / types / types.factor
index 780be34e89f6b34eedcecfac5622a41be4461431..e6edc14dd178138d577507b777d321b0198647d4 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types alien.syntax classes.struct colors
 io.encodings.utf16n io.encodings.utf8 kernel math math.bitwise
-math.vectors sequences ;
+math.functions math.vectors sequences ;
 FROM: alien.c-types => float short ;
 IN: windows.types
 
@@ -379,9 +379,9 @@ TYPEDEF: DWORD* LPCOLORREF
     [ -16 shift 0xff bitand ] tri ;
 
 : color>RGB ( color -- COLORREF )
-    >rgba-components drop [ 255 * >integer ] tri@ RGB ;
+    >rgba-components drop [ 255 round * >integer ] tri@ RGB ;
 : RGB>color ( COLORREF -- color )
-    >RGB< [ 1/255. * >float ] tri@ 1.0 <rgba> ;
+    >RGB< [ 255 /f ] tri@ 1.0 <rgba> ;
 
 STRUCT: TEXTMETRICW
     { tmHeight LONG }