use common colorMap helper when converting to rgb-device form
authorClaus Gittinger <cg@exept.de>
Wed, 29 Jul 1998 13:18:14 +0200
changeset 2203 49d06f1c9fe2
parent 2202 03d4cf38f4a5
child 2204 d58ed106b422
use common colorMap helper when converting to rgb-device form
Depth4Image.st
--- a/Depth4Image.st	Wed Jul 29 13:17:25 1998 +0200
+++ b/Depth4Image.st	Wed Jul 29 13:18:14 1998 +0200
@@ -174,9 +174,7 @@
      Supports true color devices with depths: 8, 16, 24 and 32"
 
     |depth 
-     nColors "{ Class: SmallInteger }"
      colorValues 
-     scaleRed scaleGreen scaleBlue redShift greenShift blueShift
      form imageBits bestFormat usedDeviceDepth usedDeviceBitsPerPixel 
      usedDevicePadding usedDeviceBytesPerRow padd n|
 
@@ -184,38 +182,7 @@
 
     "/ gather r/g/b values for all colors in the map ...
 
-    nColors := 1 bitShift:(self depth).
-
-    "/ precompute scales to map from 0..100 into devices range
-    "/ (this may be different for the individual components)
-
-    scaleRed := ((1 bitShift:aDevice bitsRed) - 1) / 100.
-    scaleGreen := ((1 bitShift:aDevice bitsGreen) - 1) / 100.
-    scaleBlue := ((1 bitShift:aDevice bitsBlue) - 1) / 100.
-    redShift := aDevice shiftRed.
-    greenShift := aDevice shiftGreen.
-    blueShift := aDevice shiftBlue.
-
-    colorValues := Array uninitializedNew:nColors.
-
-    0 to:nColors-1 do:[:pixel |
-        |clr rv gv bv v "{ Class: SmallInteger }" |
-
-        clr := self colorFromValue:pixel.
-
-        rv := (clr red * scaleRed) rounded.
-        gv := (clr green * scaleGreen) rounded.
-        bv := (clr blue * scaleBlue) rounded.
-
-        v := rv bitShift:redShift.
-        v := v bitOr:(gv bitShift:greenShift).
-        v := v bitOr:(bv bitShift:blueShift).
-
-        colorValues at:(pixel+1) put:v.
-"/ clr print. ' ' print.
-"/ rv print. ' ' print. gv print. ' ' print. bv print. ' ' print.
-"/ ' -> ' print. v printNL.
-    ].
+    colorValues := self rgbColormapFor:aDevice.
 
     bestFormat := self bestSupportedImageFormatFor:aDevice.
     usedDeviceDepth := bestFormat at:#depth.
@@ -1009,5 +976,5 @@
 !Depth4Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.31 1998-07-28 19:45:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.32 1998-07-29 11:18:14 cg Exp $'
 ! !