TIFFReader.st
changeset 335 a32831edacc5
parent 334 1da7672635be
child 336 9789b02d95bf
--- a/TIFFReader.st	Sat Sep 14 17:12:08 1996 +0200
+++ b/TIFFReader.st	Mon Sep 30 23:48:26 1996 +0200
@@ -699,30 +699,30 @@
 
     nPlanes := samplesPerPixel.
     (nPlanes == 2) ifTrue:[
-	'TIFFReader: ignoring alpha plane' errorPrintNL.
-	nPlanes := 1
+        'TIFFReader: ignoring alpha plane' errorPrintNL.
+        nPlanes := 1
     ].
 
     (nPlanes ~~ 1) ifTrue:[
-	self error:'only monochrome/greyscale supported'.
-	^ nil
+        self error:'only monochrome/greyscale supported'.
+        ^ nil
     ].
 
     stripByteCounts isNil ifTrue:[
-	self error:'currently require stripByteCounts'.
-	^ nil
+        self error:'currently require stripByteCounts'.
+        ^ nil
     ].
     (rowsPerStrip ~~ 1) isNil ifTrue:[
-	self error:'currently require rowsPerStrip to be 1'.
-	^ nil
+        self error:'currently require rowsPerStrip to be 1'.
+        ^ nil
     ].
 
-    'TIFFReader: decompressing CCITT-3 ...' infoPrintNL.
+"/    'TIFFReader: decompressing CCITT-3 ...' infoPrintNL.
 
     bitsPerRow := width * (bitsPerSample at:1).
     bytesPerRow := bitsPerRow // 8.
     ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
-	bytesPerRow := bytesPerRow + 1
+        bytesPerRow := bytesPerRow + 1
     ].
 
     data := ByteArray new:(bytesPerRow * height).
@@ -734,16 +734,18 @@
     row := 1.
     bytesPerStrip := bytesPerRow * rowsPerStrip.
     [row <= height] whileTrue:[
-	stripNr := stripNr + 1.
-	inStream position:((stripOffsets at:stripNr) + 1).
-	inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip.
-	self class decompressCCITT3From:compressedStrip
-				   into:data
-			     startingAt:offset
-				  count:width.
-	offset := offset + bytesPerStrip.
-	row := row + rowsPerStrip
+        stripNr := stripNr + 1.
+        inStream position:((stripOffsets at:stripNr) + 1).
+        inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip.
+        self class decompressCCITT3From:compressedStrip
+                                   into:data
+                             startingAt:offset
+                                  count:width.
+        offset := offset + bytesPerStrip.
+        row := row + rowsPerStrip
     ]
+
+    "Modified: 30.9.1996 / 22:45:14 / cg"
 !
 
 readCCITTGroup4TiffImageData
@@ -816,41 +818,41 @@
     nPlanes := samplesPerPixel.
 
     (nPlanes == 3) ifTrue:[
-	((bitsPerSample at:1) ~~ 8) ifTrue:[
-	    self error:'only 8 bit/sample supported'.
-	    ^ nil
-	].
-	((bitsPerSample at:2) ~~ 8) ifTrue:[
-	    self error:'only 8 bit/sample supported'.
-	    ^ nil
-	].
-	((bitsPerSample at:3) ~~ 8) ifTrue:[
-	    self error:'only 8 bit/sample supported'.
-	    ^ nil
-	].
-	bytesPerRow := width * samplesPerPixel.
+        ((bitsPerSample at:1) ~~ 8) ifTrue:[
+            self error:'only 8 bit/sample supported'.
+            ^ nil
+        ].
+        ((bitsPerSample at:2) ~~ 8) ifTrue:[
+            self error:'only 8 bit/sample supported'.
+            ^ nil
+        ].
+        ((bitsPerSample at:3) ~~ 8) ifTrue:[
+            self error:'only 8 bit/sample supported'.
+            ^ nil
+        ].
+        bytesPerRow := width * samplesPerPixel.
     ] ifFalse:[
-	(nPlanes == 2) ifTrue:[
-	    (planarConfiguration ~~ 2) ifTrue:[
-		self error:'only separate planes supported'.
-		^ nil
-	    ].
-	    'TIFFReader: ignoring alpha plane' errorPrintNL.
-	    nPlanes := 1
-	].
-	(nPlanes == 1) ifFalse:[
-	    self error:'only 3-sample rgb / monochrome supported'.
-	    ^ nil
-	].
-	bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
+        (nPlanes == 2) ifTrue:[
+            (planarConfiguration ~~ 2) ifTrue:[
+                self error:'only separate planes supported'.
+                ^ nil
+            ].
+            'TIFFReader: ignoring alpha plane' errorPrintNL.
+            nPlanes := 1
+        ].
+        (nPlanes == 1) ifFalse:[
+            self error:'only 3-sample rgb / monochrome supported'.
+            ^ nil
+        ].
+        bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
     ].
 
     stripByteCounts isNil ifTrue:[
-	self error:'currently require stripByteCounts'.
-	^ nil
+        self error:'currently require stripByteCounts'.
+        ^ nil
     ].
 
-    'TIFFReader: decompressing LZW ...' infoPrintNL.
+"/    'TIFFReader: decompressing LZW ...' infoPrintNL.
 
     data := ByteArray uninitializedNew:(bytesPerRow * height).
 
@@ -861,26 +863,28 @@
     bytesPerStrip := bytesPerRow * rowsPerStrip.
     prevSize := 0.
     [row <= height] whileTrue:[
-	stripNr := stripNr + 1.
-	inStream position:((stripOffsets at:stripNr) + 1).
-	nBytes := stripByteCounts at:stripNr.
-	(nBytes > prevSize) ifTrue:[
-	    compressedStrip := ByteArray uninitializedNew:nBytes.
-	    prevSize := nBytes
-	].
-	inStream nextBytes:nBytes
-		      into:compressedStrip.
-	self class decompressLZWFrom:compressedStrip
-			       count:nBytes
-				into:data
-			  startingAt:offset.
-	offset := offset + bytesPerStrip.
-	row := row + rowsPerStrip
+        stripNr := stripNr + 1.
+        inStream position:((stripOffsets at:stripNr) + 1).
+        nBytes := stripByteCounts at:stripNr.
+        (nBytes > prevSize) ifTrue:[
+            compressedStrip := ByteArray uninitializedNew:nBytes.
+            prevSize := nBytes
+        ].
+        inStream nextBytes:nBytes
+                      into:compressedStrip.
+        self class decompressLZWFrom:compressedStrip
+                               count:nBytes
+                                into:data
+                          startingAt:offset.
+        offset := offset + bytesPerStrip.
+        row := row + rowsPerStrip
     ].
 
     (predictor == 2) ifTrue:[
-	self class decodeDelta:3 in:data width:width height:height
+        self class decodeDelta:3 in:data width:width height:height
     ]
+
+    "Modified: 30.9.1996 / 22:45:01 / cg"
 !
 
 readLongs:nLongs
@@ -1660,6 +1664,6 @@
 !TIFFReader  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.41 1996-09-14 15:12:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.42 1996-09-30 21:48:26 cg Exp $'
 ! !
 TIFFReader initialize!