--- a/TIFFRdr.st Sat Feb 18 16:31:28 1995 +0100
+++ b/TIFFRdr.st Sat Feb 18 16:32:43 1995 +0100
@@ -27,7 +27,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.15 1995-02-15 10:36:16 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.16 1995-02-18 15:32:43 claus Exp $
'!
!TIFFReader class methodsFor:'documentation'!
@@ -48,7 +48,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.15 1995-02-15 10:36:16 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.16 1995-02-18 15:32:43 claus Exp $
"
!
@@ -109,8 +109,8 @@
!TIFFReader methodsFor:'reading from file'!
-fromFile:aFileName
- "read an image from aFileName"
+fromStream:aStream
+ "read an image from aStream"
|char1 char2 version
numberOfTags "{ Class: SmallInteger }"
@@ -119,14 +119,12 @@
length "{ Class: SmallInteger }"
result offset ok msb|
- inStream := self class streamReadingFile:aFileName.
- inStream isNil ifTrue:[^ nil].
+ inStream := aStream.
- char1 := inStream next.
- char2 := inStream next.
+ char1 := aStream next.
+ char2 := aStream next.
(char1 ~~ char2) ifTrue:[
'TIFFReader: not a tiff file' errorPrintNL.
- inStream close.
^ nil
].
(char1 == $I) ifTrue:[
@@ -138,17 +136,15 @@
msb := true.
] ifFalse:[
'TIFFReader: not a tiff file' errorPrintNL.
- inStream close.
^ nil
]
].
- inStream binary.
+ aStream binary.
version := self readShort.
(version ~~ 42) ifTrue:[
'TIFFReader: version of tiff-file not supported' errorPrintNL.
- inStream close.
^ nil
].
@@ -167,18 +163,18 @@
"resolutionUnit := 2."
predictor := 1.
- offset := inStream nextLongMSB:msb.
- inStream position:offset + 1.
+ offset := aStream nextLongMSB:msb.
+ aStream position:offset + 1.
numberOfTags := self readShort.
1 to:numberOfTags do:[:index |
tagType := self readShort.
numberType := self readShort.
- length := inStream nextLongMSB:msb.
+ length := aStream nextLongMSB:msb.
self decodeTiffTag:tagType numberType:numberType length:length
].
- offset := inStream nextLongMSB:msb.
+ offset := aStream nextLongMSB:msb.
(offset ~~ 0) ifTrue:[
'TIFFReader: more tags ignored' errorPrintNL
].
@@ -206,7 +202,6 @@
].
ok ifFalse:[
- inStream close.
^ nil
].
@@ -262,7 +257,6 @@
compression errorPrint.
' not known' errorPrintNL
].
- inStream close.
^ result
! !
@@ -444,10 +438,8 @@
decodeTiffTag:tagType numberType:numberType length:length
|offset value valueArray
- val map scaleFactor rV gV bV
- n "{ Class: SmallInteger }"
- i "{ Class: SmallInteger }"
- i1 "{ Class: SmallInteger }"
+ val scaleFactor rV gV bV
+ n "{ Class: SmallInteger }"
i2 "{ Class: SmallInteger }"
i3 "{ Class: SmallInteger }" |
@@ -888,19 +880,6 @@
our colormap expects 8bit values
"
n := valueArray size // 3.
-"/ colorMap := Array new:3.
-"/ colorMap at:1 put:(valueArray copyFrom:1 to:n).
-"/ colorMap at:2 put:(valueArray copyFrom:n+1 to:2*n).
-"/ colorMap at:3 put:(valueArray copyFrom:2*n+1 to:3*n).
-"/ scaleFactor := 255.0 / 16rFFFF.
-"/ 1 to:3 do:[:c |
-"/ map := colorMap at:c.
-"/ 1 to:n do:[:e |
-"/ val := map at:e.
-"/ val := (val * scaleFactor) rounded.
-"/ map at:e put:val
-"/ ]
-"/ ].
rV := ByteArray uninitializedNew:n.
gV := ByteArray uninitializedNew:n.
--- a/TIFFReader.st Sat Feb 18 16:31:28 1995 +0100
+++ b/TIFFReader.st Sat Feb 18 16:32:43 1995 +0100
@@ -27,7 +27,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.15 1995-02-15 10:36:16 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.16 1995-02-18 15:32:43 claus Exp $
'!
!TIFFReader class methodsFor:'documentation'!
@@ -48,7 +48,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.15 1995-02-15 10:36:16 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.16 1995-02-18 15:32:43 claus Exp $
"
!
@@ -109,8 +109,8 @@
!TIFFReader methodsFor:'reading from file'!
-fromFile:aFileName
- "read an image from aFileName"
+fromStream:aStream
+ "read an image from aStream"
|char1 char2 version
numberOfTags "{ Class: SmallInteger }"
@@ -119,14 +119,12 @@
length "{ Class: SmallInteger }"
result offset ok msb|
- inStream := self class streamReadingFile:aFileName.
- inStream isNil ifTrue:[^ nil].
+ inStream := aStream.
- char1 := inStream next.
- char2 := inStream next.
+ char1 := aStream next.
+ char2 := aStream next.
(char1 ~~ char2) ifTrue:[
'TIFFReader: not a tiff file' errorPrintNL.
- inStream close.
^ nil
].
(char1 == $I) ifTrue:[
@@ -138,17 +136,15 @@
msb := true.
] ifFalse:[
'TIFFReader: not a tiff file' errorPrintNL.
- inStream close.
^ nil
]
].
- inStream binary.
+ aStream binary.
version := self readShort.
(version ~~ 42) ifTrue:[
'TIFFReader: version of tiff-file not supported' errorPrintNL.
- inStream close.
^ nil
].
@@ -167,18 +163,18 @@
"resolutionUnit := 2."
predictor := 1.
- offset := inStream nextLongMSB:msb.
- inStream position:offset + 1.
+ offset := aStream nextLongMSB:msb.
+ aStream position:offset + 1.
numberOfTags := self readShort.
1 to:numberOfTags do:[:index |
tagType := self readShort.
numberType := self readShort.
- length := inStream nextLongMSB:msb.
+ length := aStream nextLongMSB:msb.
self decodeTiffTag:tagType numberType:numberType length:length
].
- offset := inStream nextLongMSB:msb.
+ offset := aStream nextLongMSB:msb.
(offset ~~ 0) ifTrue:[
'TIFFReader: more tags ignored' errorPrintNL
].
@@ -206,7 +202,6 @@
].
ok ifFalse:[
- inStream close.
^ nil
].
@@ -262,7 +257,6 @@
compression errorPrint.
' not known' errorPrintNL
].
- inStream close.
^ result
! !
@@ -444,10 +438,8 @@
decodeTiffTag:tagType numberType:numberType length:length
|offset value valueArray
- val map scaleFactor rV gV bV
- n "{ Class: SmallInteger }"
- i "{ Class: SmallInteger }"
- i1 "{ Class: SmallInteger }"
+ val scaleFactor rV gV bV
+ n "{ Class: SmallInteger }"
i2 "{ Class: SmallInteger }"
i3 "{ Class: SmallInteger }" |
@@ -888,19 +880,6 @@
our colormap expects 8bit values
"
n := valueArray size // 3.
-"/ colorMap := Array new:3.
-"/ colorMap at:1 put:(valueArray copyFrom:1 to:n).
-"/ colorMap at:2 put:(valueArray copyFrom:n+1 to:2*n).
-"/ colorMap at:3 put:(valueArray copyFrom:2*n+1 to:3*n).
-"/ scaleFactor := 255.0 / 16rFFFF.
-"/ 1 to:3 do:[:c |
-"/ map := colorMap at:c.
-"/ 1 to:n do:[:e |
-"/ val := map at:e.
-"/ val := (val * scaleFactor) rounded.
-"/ map at:e put:val
-"/ ]
-"/ ].
rV := ByteArray uninitializedNew:n.
gV := ByteArray uninitializedNew:n.