--- a/Image.st Sun Feb 19 15:10:45 2017 +0100
+++ b/Image.st Mon Feb 20 11:02:27 2017 +0100
@@ -14275,17 +14275,29 @@
|usedValues max colors|
- photometric == #rgb ifTrue:[
+ (photometric == #rgb or:[photometric == #rgba]) ifTrue:[
usedValues := IdentitySet new.
- self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
- do:[:x :y :pixel |
- usedValues add:pixel.
- usedValues size > nMax ifTrue:[
- "/ too many to be returned here (think of the mass of
- "/ data to be returned by a 24bit image ... ;-)
- ^ nil
- ]
- ].
+ (photometric == #rgb) ifTrue:[
+ self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
+ do:[:x :y :pixel |
+ usedValues add:pixel.
+ usedValues size > nMax ifTrue:[
+ "/ too many to be returned here (think of the mass of
+ "/ data to be returned by a 24bit image ... ;-)
+ ^ nil
+ ]
+ ].
+ ] ifFalse:[
+ self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
+ do:[:x :y :pixel |
+ usedValues add:(pixel bitShift:-8).
+ usedValues size > nMax ifTrue:[
+ "/ too many to be returned here (think of the mass of
+ "/ data to be returned by a 24bit image ... ;-)
+ ^ nil
+ ]
+ ].
+ ].
"/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
"/ this code is slightly faster (but wrong for 16-bit images)...
colors := usedValues collect:[:pixel |
@@ -14318,8 +14330,8 @@
(Image fromFile:'libtool/bitmaps/SBrowser.xbm') usedColors
"
- "Created: / 7.9.1998 / 17:54:17 / cg"
- "Modified: / 7.9.1998 / 17:56:21 / cg"
+ "Created: / 07-09-1998 / 17:54:17 / cg"
+ "Modified: / 20-02-2017 / 10:57:17 / cg"
!
usedValues