checkin from browser
authorClaus Gittinger <cg@exept.de>
Tue, 28 Jul 1998 21:55:25 +0200
changeset 2199 ac56b54c59a5
parent 2198 122ff0da86d6
child 2200 4e3c5b30b2c1
checkin from browser
Image.st
--- a/Image.st	Tue Jul 28 21:47:39 1998 +0200
+++ b/Image.st	Tue Jul 28 21:55:25 1998 +0200
@@ -10666,7 +10666,7 @@
 usedColors
     "return a collection of colors used in the receiver."
 
-    |usedValues max|
+    |usedValues max colors|
 
     photometric == #rgb ifTrue:[
         "/ too many to be returned here (think of the mass of
@@ -10678,13 +10678,15 @@
 
     usedValues := self usedValues asArray.
     photometric == #palette ifTrue:[
-        ^ usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])]
-    ].
-
-    "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
-
-    max := (1 bitShift:self depth) - 1.
-    ^ usedValues collect:[:val | (Color gray:(100 * val / max ))]
+        colors := usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])].
+    ] ifFalse:[
+
+        "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
+
+        max := (1 bitShift:self depth) - 1.
+        colors :=  usedValues collect:[:val | (Color gray:(100 * val / max ))].
+    ].
+    ^ colors asSet
 
     "
      (Image fromFile:'bitmaps/garfield.gif') usedColors
@@ -10692,7 +10694,7 @@
      (Image fromFile:'ttt.tiff') usedColors  
     "
 
-    "Modified: 8.6.1996 / 09:04:56 / cg"
+    "Modified: / 28.7.1998 / 21:50:35 / cg"
 !
 
 usedValues
@@ -11352,6 +11354,6 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.248 1998-07-27 08:13:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.249 1998-07-28 19:55:25 cg Exp $'
 ! !
 Image initialize!