--- a/TIFFReader.st Tue May 21 10:11:50 2002 +0200
+++ b/TIFFReader.st Sun Jun 09 16:47:23 2002 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+"{ Package: 'stx:libview2' }"
+
ImageReader subclass:#TIFFReader
instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip
fillOrder compression group3options predictor stripByteCounts
@@ -2108,7 +2110,23 @@
save:image onFile:aFileName
"save image as (uncompressed) TIFF file on aFileName"
- |pos1 pos|
+ outStream := FileStream newFileNamed:aFileName.
+ outStream isNil ifTrue:[
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
+ ].
+ [
+ self save:image onStream:outStream.
+ ] ensure:[
+ outStream close.
+ ].
+!
+
+save:image onStream:aStream
+ "save image as (uncompressed) TIFF file on aFileName"
+
+ |pos1 pos indicator|
image mask notNil ifTrue:[
Image informationLostQuerySignal
@@ -2116,12 +2134,8 @@
errorString:('TIFF writer does not (yet) support an imageMask').
].
- outStream := FileStream newFileNamed:aFileName.
- outStream isNil ifTrue:[
- ^ Image fileCreationErrorSignal
- raiseWith:image
- errorString:('file creation error: ' , aFileName asString).
- ].
+ outStream := aStream.
+ outStream binary.
"save as msb"
@@ -2143,14 +2157,13 @@
currentOffset := 0.
(byteOrder == #msb) ifTrue:[
- outStream nextPut:$M. outStream nextPut:$M.
+ indicator := $M asciiValue.
] ifFalse:[
- outStream nextPut:$I. outStream nextPut:$I.
+ indicator := $I asciiValue.
].
+ outStream nextPut:indicator; nextPut:indicator.
currentOffset := currentOffset + 2.
- outStream binary.
-
self writeShort:42.
currentOffset := currentOffset + 2.
@@ -2197,14 +2210,11 @@
self writeTag:320 "colorMap"
].
self writeLong:0. "end of tags mark"
- outStream close
-
- "Modified: / 30.9.1998 / 23:30:18 / cg"
! !
!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.64 1999-09-08 16:30:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.65 2002-06-09 14:47:23 stefan Exp $'
! !
TIFFReader initialize!