--- a/Depth1Image.st Wed Mar 30 03:25:26 1994 +0200
+++ b/Depth1Image.st Wed Mar 30 12:13:08 1994 +0200
@@ -23,7 +23,7 @@
this class represents bilevel (1 bit / pixel) images
-$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.4 1994-02-25 13:10:17 claus Exp $
+$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.5 1994-03-30 10:11:25 claus Exp $
written summer 93 by claus
'!
@@ -109,7 +109,10 @@
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel"
- |lineIndex byte shift value|
+ |lineIndex "{ Class: SmallInteger }"
+ byte "{ Class: SmallInteger }"
+ shift "{ Class: SmallInteger }"
+ value "{ Class: SmallInteger }"|
lineIndex := (self bytesPerRow * y) + 1.
@@ -133,9 +136,10 @@
self error:'format not supported'.
^ nil
].
- ^ Color red:(((colorMap at:1) at:(value + 1)) * 100 / 255)
- green:(((colorMap at:2) at:(value + 1)) * 100 / 255)
- blue:(((colorMap at:3) at:(value + 1)) * 100 / 255)
+ value := value + 1.
+ ^ Color red:(((colorMap at:1) at:value) * (100.0 / 255.0))
+ green:(((colorMap at:2) at:value) * (100.0 / 255.0))
+ blue:(((colorMap at:3) at:value) * (100.0 / 255.0))
!
atX:x y:y putValue:aPixelValue
@@ -193,46 +197,37 @@
in the image; i.e. for b/w images, the color MUST be black
or white; for palette images it must be present in the palette."
- |value|
+ |clr0 clr1|
photometric == #whiteIs0 ifTrue:[
- aColor = Color white ifTrue:[
- value := 0
- ] ifFalse:[
- aColor = Color black ifTrue:[
- value := 1
- ] ifFalse:[
- self error:'invalid color'
- ]
- ]
+ clr0 := Color whilte.
+ clr1 := Color black.
] ifFalse:[
photometric == #blackIs0 ifTrue:[
- aColor = Color black ifTrue:[
- value := 0
- ] ifFalse:[
- aColor = Color white ifTrue:[
- value := 1
- ] ifFalse:[
- self error:'invalid color'
- ]
- ]
+ clr0 := Color black.
+ clr1 := Color whilte.
] ifFalse:[
photometric ~~ #palette ifTrue:[
self error:'format not supported'.
^ nil
].
- (aColor = colorMap at:1) ifTrue:[
- value := 0
- ] ifFalse:[
- (aColor = colorMap at:2) ifTrue:[
- value := 0
- ] ifFalse:[
- self error:'invalid color'
- ]
- ]
+ clr0 := colorMap at:1.
+ clr1 := colorMap at:2.
]
].
- self atX:x y:y putValue:value
+ aColor = clr0 ifTrue:[
+ self atX:x y:y putValue:0.
+ ^ self
+ ].
+ aColor = clr1 ifTrue:[
+ self atX:x y:y putValue:1.
+ ^ self
+ ].
+ "
+ the color to be stored is not in the images
+ colormap
+ "
+ self error:'invalid color'
!
atY:y from:xLow to:xHigh do:aBlock