--- a/Colormap.st Fri Apr 25 02:11:27 2003 +0200
+++ b/Colormap.st Mon Apr 28 12:14:49 2003 +0200
@@ -112,8 +112,8 @@
"Modified: 23.4.1996 / 22:16:00 / cg"
!
-rgbVector:rgbVector
- "given a single vector containing r-g-b values,
+rgbBytesVector:rgbVector
+ "given a single vector containing r-g-b byte values,
return a new instance of myself.
The values must be in the range 0..255."
@@ -151,6 +151,44 @@
"
!
+rgbValueVector:rgbValueVector
+ "given a single vector containing r-g-b pixel-values,
+ return a new instance of myself.
+ The values must be of the rgb-form i.e. 16rRRGGBB"
+
+ |rV gV bV nColors|
+
+ nColors := rgbValueVector size.
+ rV := ByteArray new:nColors.
+ gV := ByteArray new:nColors.
+ bV := ByteArray new:nColors.
+
+ 1 to:nColors do:[:index |
+ |rgb r g b|
+
+ rgb := rgbValueVector at:index.
+ r := (rgb bitShift:-16) bitAnd:16rFF.
+ g := (rgb bitShift:-8) bitAnd:16rFF.
+ b := rgb bitAnd:16rFF.
+
+ rV at:index put:r.
+ gV at:index put:g.
+ bV at:index put:b.
+ ].
+
+ ^ self
+ redVector:rV
+ greenVector:gV
+ blueVector:bV
+
+ "
+ |map|
+
+ map := Colormap rgbValueVector:#(16r000000 16r7F7F7F 16r800000 16rFFFFFF).
+ map atPixelValue:2
+ "
+!
+
withColors:aColorArray
"given a sequenceable collection of colors, return a new instance
of myself. Renamed from #fromColors: for ST-80 compatibility."
@@ -478,5 +516,5 @@
!Colormap class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.34 2003-04-10 14:45:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.35 2003-04-28 10:14:49 cg Exp $'
! !