--- a/Depth1Image.st Tue Apr 29 20:45:23 2003 +0200
+++ b/Depth1Image.st Tue Apr 29 20:49:19 2003 +0200
@@ -671,10 +671,15 @@
pixels are used ...
... which is not really true - it could be all-white or all-black"
- photometric ~~ #palette ifTrue:[
- ^ Array with:Color white with:Color black.
+ (photometric == #whiteIs0 or:[photometric == #blackIs0]) ifTrue:[
+ ^ Array
+ with:(Color black)
+ with:(Color white).
].
- ^ colorMap
+ photometric == #palette ifTrue:[
+ ^ colorMap
+ ].
+ ^ super usedColors
"
(Image fromFile:'bitmaps/garfield.gif') usedColors
@@ -731,5 +736,5 @@
!Depth1Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.49 2003-04-29 18:44:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.50 2003-04-29 18:49:14 cg Exp $'
! !
--- a/Depth2Image.st Tue Apr 29 20:45:23 2003 +0200
+++ b/Depth2Image.st Tue Apr 29 20:49:19 2003 +0200
@@ -964,13 +964,16 @@
pixels are used ...
... which is not really true - it could use not all colors"
- photometric ~~ #palette ifTrue:[
- ^ Array with:Color black
+ (photometric == #whiteIs0 or:[photometric == #blackIs0]) ifTrue:[
+ ^ Array with:(Color black)
with:(Color gray:33)
with:(Color gray:67)
- with:Color white.
+ with:(Color white).
].
- ^ colorMap
+ photometric == #palette ifTrue:[
+ ^ colorMap
+ ].
+ ^ super usedColors
"Modified: / 24.8.1998 / 18:38:08 / cg"
!
@@ -992,5 +995,5 @@
!Depth2Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Depth2Image.st,v 1.44 2003-04-29 18:45:16 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Depth2Image.st,v 1.45 2003-04-29 18:49:19 cg Exp $'
! !
--- a/Image.st Tue Apr 29 20:45:23 2003 +0200
+++ b/Image.st Tue Apr 29 20:49:19 2003 +0200
@@ -11726,40 +11726,39 @@
|usedValues max colors|
photometric == #rgb 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
- ]
- ].
- "/ code below is slightly faster ...
- "/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
- colors := usedValues collect:[:pixel | |r g b|
- r := self redBitsOf:pixel.
- g := self greenBitsOf:pixel.
- b := self blueBitsOf:pixel.
- "/ must scale to byte value...
- r := r bitShift:(8 - (bitsPerSample at:1)).
- g := g bitShift:(8 - (bitsPerSample at:2)).
- b := b bitShift:(8 - (bitsPerSample at:3)).
- Color redByte:r greenByte:g blueByte:b
- ].
- ^ colors.
+ 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
+ ]
+ ].
+ "/ code below is slightly faster ...
+ "/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
+ colors := usedValues collect:[:pixel | |r g b|
+ r := self redBitsOf:pixel.
+ g := self greenBitsOf:pixel.
+ b := self blueBitsOf:pixel.
+ "/ must scale to byte value...
+ r := r bitShift:(8 - (bitsPerSample at:1)).
+ g := g bitShift:(8 - (bitsPerSample at:2)).
+ b := b bitShift:(8 - (bitsPerSample at:3)).
+ Color redByte:r greenByte:g blueByte:b
+ ].
+ ^ colors.
].
usedValues := self usedValues asArray.
photometric == #palette ifTrue:[
- colors := usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])].
+ 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 ))].
+ "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
+
+ max := (1 bitShift:self depth) - 1.
+ colors := usedValues collect:[:val | (Color gray:(100 * val / max ))].
].
^ colors asSet
@@ -12464,7 +12463,7 @@
!Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.337 2003-04-29 18:45:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.338 2003-04-29 18:49:17 cg Exp $'
! !
Image initialize!