Color.st
changeset 1859 b483006c48f5
parent 1856 50a92c932fbd
child 1907 61fdff318175
--- a/Color.st	Wed Aug 13 17:30:50 1997 +0200
+++ b/Color.st	Wed Aug 13 20:25:56 1997 +0200
@@ -882,6 +882,27 @@
            scaledBlue:(b * MaxValue // 100)
 !
 
+rgbValue:rgb
+    "return a color from an rgb (24 bit) value;
+     The value is composed of r<<16 + g<<8 + b."
+
+    |r g b|
+
+    r := (rgb bitShift:-16) bitAnd:16rFF.
+    g := (rgb bitShift:-8) bitAnd:16rFF.
+    b := (rgb) bitAnd:16rFF.
+    ^ self redByte:r greenByte:g blueByte:b
+
+    "
+     (Color rgbValue:16rFF0000) inspect
+     (Color rgbValue:16r00FF00) inspect
+     (Color rgbValue:16r0000FF) inspect
+     (Color rgbValue:16rFF00FF) inspect
+    "
+
+    "Modified: 13.8.1997 / 20:24:37 / cg"
+!
+
 scaledGray:aGrayValue
     "return a gray color with a scaled gray value (0..MaxValue)"
 
@@ -4329,6 +4350,6 @@
 !Color class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.100 1997-08-13 13:26:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.101 1997-08-13 18:25:56 cg Exp $'
 ! !
 Color initialize!