Depth1Image.st
changeset 3869 cd40d1912c03
parent 3868 e47cf114c824
child 4117 eedeb5ed8e91
--- a/Depth1Image.st	Tue Apr 29 21:20:22 2003 +0200
+++ b/Depth1Image.st	Tue Apr 29 21:42:44 2003 +0200
@@ -643,26 +643,28 @@
     ^ nbytes
 !
 
-colorFromValue:colorValue
+colorFromValue:pixelValue
     "given a pixel value, return the corresponding color.
      Pixel values start with 0."
 
     photometric == #blackIs0 ifTrue:[
-        (colorValue == 0) ifTrue:[
+        (pixelValue == 0) ifTrue:[
             ^ Color black
         ].
         ^ Color white
     ].
     photometric == #whiteIs0 ifTrue:[
-        (colorValue == 0) ifTrue:[
+        (pixelValue == 0) ifTrue:[
             ^ Color white
         ].
         ^ Color black
     ].
     photometric == #palette ifTrue:[
-        ^ colorMap at:(colorValue+1).
+        pixelValue < colorMap size ifTrue:[
+            ^ colorMap at:(pixelValue+1).
+        ]
     ].
-    ^ super colorFromValue:colorValue.
+    ^ super colorFromValue:pixelValue.
 !
 
 usedColors
@@ -736,5 +738,5 @@
 !Depth1Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.51 2003-04-29 19:19:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.52 2003-04-29 19:42:36 cg Exp $'
 ! !