+redShort:greenShort:blueShort:
authorClaus Gittinger <cg@exept.de>
Wed, 19 Nov 2003 20:16:59 +0100
changeset 3956 74f5434f3e38
parent 3955 6f48b9693fe5
child 3957 ffe8a76fae45
+redShort:greenShort:blueShort:
Color.st
--- a/Color.st	Wed Nov 19 16:27:48 2003 +0100
+++ b/Color.st	Wed Nov 19 20:16:59 2003 +0100
@@ -1085,6 +1085,19 @@
            scaledBlue:(b * MaxValue // 100)
 !
 
+redShort:r greenShort:g blueShort:b
+    "return a color from red, green and blue short values;
+     the arguments, r, g and b are interpreted as unsigned short values (0..16rFFFF)"
+
+    ^ here scaledRed:(r * MaxValue // 16rFFFF)
+           scaledGreen:(g * MaxValue // 16rFFFF)
+           scaledBlue:(b * MaxValue // 16rFFFF)
+
+    "
+     (Color redShort:16rFFFF greenShort:0 blueShort:0) inspect
+    "
+!
+
 rgbValue:rgb
     "return a color from a 24bit RGB value;
      The value is composed of r<<16 + g<<8 + b."
@@ -4898,6 +4911,14 @@
     "do nothing here, for compatibility with Image/Form"
 ! !
 
+!Color methodsFor:'printing'!
+
+hex
+	^(self red * 255) asInteger asCharacter hex,
+	(self green * 255) asInteger asCharacter hex,
+	(self blue * 255) asInteger asCharacter hex
+! !
+
 !Color methodsFor:'printing & storing'!
 
 encodingVectorFor:aspect
@@ -5265,7 +5286,7 @@
 !Color class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.185 2003-09-25 14:42:10 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.186 2003-11-19 19:16:59 cg Exp $'
 ! !
 
 Color initialize!