--- a/TIFFRdr.st Fri Jul 05 23:09:05 1996 +0200
+++ b/TIFFRdr.st Thu Jul 11 21:15:48 1996 +0200
@@ -20,7 +20,7 @@
category:'Graphics-Images-Support'
!
-!TIFFReader class methodsFor:'documentation'!
+!TIFFReader class methodsFor:'documentation'!
copyright
"
@@ -67,7 +67,7 @@
"
! !
-!TIFFReader class methodsFor:'initialization'!
+!TIFFReader class methodsFor:'initialization'!
initialize
"install myself in the Image classes fileFormat table
@@ -80,7 +80,7 @@
"Modified: 23.4.1996 / 12:28:57 / cg"
! !
-!TIFFReader class methodsFor:'testing'!
+!TIFFReader class methodsFor:'testing'!
canRepresent:anImage
"return true, if anImage can be represented in my file format.
@@ -962,39 +962,39 @@
or rgb - if non separate planes and no alpha"
(nPlanes == 2) ifTrue:[
- (planarConfiguration ~~ 2) ifTrue:[
- self error:'with alpha, only separate planes supported'.
- ^ nil
- ].
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
- nPlanes := 1.
- bitsPerPixel := bitsPerSample at:1.
- bitsPerSample := Array with:bitsPerPixel.
- samplesPerPixel := 1.
+ (planarConfiguration ~~ 2) ifTrue:[
+ self error:'with alpha, only separate planes supported'.
+ ^ nil
+ ].
+ 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ nPlanes := 1.
+ bitsPerPixel := bitsPerSample at:1.
+ bitsPerSample := Array with:bitsPerPixel.
+ samplesPerPixel := 1.
] ifFalse:[
- (nPlanes == 3) ifTrue:[
- (planarConfiguration ~~ 1) ifTrue:[
- self error:'only non separate planes supported'.
- ^ nil
- ].
- bitsPerSample ~= #(8 8 8) ifTrue:[
- self error:'only 8/8/8 rgb images supported'.
- ^ nil
- ].
- bitsPerPixel := 24
- ] ifFalse:[
- (nPlanes ~~ 1) ifTrue:[
- self error:'format not supported'.
- ^ nil
- ].
- bitsPerPixel := bitsPerSample at:1.
- ]
+ (nPlanes == 3) ifTrue:[
+ (planarConfiguration ~~ 1) ifTrue:[
+ self error:'only non separate planes supported'.
+ ^ nil
+ ].
+ bitsPerSample ~= #(8 8 8) ifTrue:[
+ self error:'only 8/8/8 rgb images supported'.
+ ^ nil
+ ].
+ bitsPerPixel := 24
+ ] ifFalse:[
+ (nPlanes ~~ 1) ifTrue:[
+ self error:'format not supported'.
+ ^ nil
+ ].
+ bitsPerPixel := bitsPerSample at:1.
+ ]
].
bitsPerRow := width * bitsPerPixel.
bytesPerRow := bitsPerRow // 8.
((bitsPerRow \\ 8) ~~ 0) ifTrue:[
- bytesPerRow := bytesPerRow + 1
+ bytesPerRow := bytesPerRow + 1
].
overAllBytes := bytesPerRow * height.
@@ -1005,14 +1005,20 @@
row := 1.
[row <= height] whileTrue:[
- stripNr := stripNr + 1.
- nBytes := stripByteCounts at:stripNr.
- inStream position:((stripOffsets at:stripNr) + 1).
+ stripNr := stripNr + 1.
+ nBytes := stripByteCounts at:stripNr.
+ inStream position:((stripOffsets at:stripNr) + 1).
- inStream nextBytes:nBytes into:data startingAt:offset.
- offset := offset + nBytes.
- row := row + rowsPerStrip
+ offset + nBytes > overAllBytes ifTrue:[
+ nBytes := overAllBytes - offset
+ ].
+
+ inStream nextBytes:nBytes into:data startingAt:offset.
+ offset := offset + nBytes.
+ row := row + rowsPerStrip
]
+
+ "Modified: 11.7.1996 / 21:10:30 / cg"
!
writeBitsPerSample
@@ -1644,9 +1650,9 @@
outStream close
! !
-!TIFFReader class methodsFor:'documentation'!
+!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.37 1996-05-10 16:45:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.38 1996-07-11 19:15:48 cg Exp $'
! !
TIFFReader initialize!