allow #usedColors for small 24-bit images
authorClaus Gittinger <cg@exept.de>
Mon, 17 Aug 1998 10:20:17 +0200
changeset 2249 61b9cc611488
parent 2248 20fc22184ef5
child 2250 281f9fafdbe0
allow #usedColors for small 24-bit images
Image.st
--- a/Image.st	Mon Aug 17 10:18:15 1998 +0200
+++ b/Image.st	Mon Aug 17 10:20:17 1998 +0200
@@ -10756,8 +10756,14 @@
         "/ too many to be returned here (think of the mass of
         "/ data to be returned by a 24bit image ... ;-)
 
-        self error:'query not allowed for this image'.
-        ^ nil
+        width * height > 10000 ifTrue:[
+            self error:'query not allowed for this image'.
+            ^ nil
+        ].
+        colors := Set new.
+        self colorsFromX:0 y:0 toX:(width-1) y:(height-1)
+             do:[:x :y :clr | colors add:clr].
+        ^ colors.                
     ].
 
     usedValues := self usedValues asArray.
@@ -10778,7 +10784,7 @@
      (Image fromFile:'ttt.tiff') usedColors  
     "
 
-    "Modified: / 28.7.1998 / 21:50:35 / cg"
+    "Modified: / 17.8.1998 / 10:19:10 / cg"
 !
 
 usedValues
@@ -11443,6 +11449,6 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.253 1998-08-08 11:41:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.254 1998-08-17 08:20:17 cg Exp $'
 ! !
 Image initialize!