TIFFReader.st
changeset 21 66b31c91177f
parent 19 8527f194f903
child 23 11c422f6d825
--- a/TIFFReader.st	Fri Feb 25 14:11:30 1994 +0100
+++ b/TIFFReader.st	Fri Jun 03 02:54:11 1994 +0200
@@ -24,32 +24,48 @@
 !
 
 TIFFReader comment:'
-
 COPYRIGHT (c) 1991 by Claus Gittinger
               All Rights Reserved
-
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.7 1994-01-12 20:22:50 claus Exp $
-written Summer 91 by claus
 '!
 
 !TIFFReader class methodsFor:'documentation'!
 
+copyright
+"
+ COPYRIGHT (c) 1991 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.8 1994-06-03 00:53:48 claus Exp $
+"
+!
+
 documentation
 "
-This class knows how to read TIFF files and how to
-write uncompressed TIFF files.
+    This class knows how to read TIFF files and how to
+    write uncompressed TIFF files.
 
-Only single image files are supported.
-Currently, not all formats are implemented, and of those that are not 
-all are tested.
-It should work with most rgb, mono and 2-plane greyscale
-images, since this is what I have as test material on
-the NeXT.
-It supports reading of uncompressed, LZW and G3 compressed 
-images; JPEG and packbits are currently not implemented.
+    Only single image files are supported.
+    Currently, not all formats are implemented, and of those that are not 
+    all are tested.
+    It should work with most rgb, mono and 2-plane greyscale
+    images, since this is what I have as test material on
+    the NeXT.
+    It supports reading of uncompressed, LZW and G3 compressed 
+    images; JPEG and packbits are currently not implemented.
 
-Only writing of uncompressed images is currently implemented.
-More formats will come ...
+    Only writing of uncompressed images is currently implemented.
+    More formats will come ...
 "
 ! !
 
@@ -97,7 +113,7 @@
     char1 := inStream next.
     char2 := inStream next.
     (char1 ~~ char2) ifTrue:[
-        'not a tiff file' printNewline.
+        'TIFFRDR: not a tiff file' errorPrintNewline.
         inStream close.
         ^ nil
     ].
@@ -107,7 +123,7 @@
         (char1 == $M) ifTrue:[
             byteOrder := #msb
         ] ifFalse:[
-            'not a tiff file' printNewline.
+            'TIFFRDR: not a tiff file' errorPrintNewline.
             inStream close.
             ^ nil
         ]
@@ -117,7 +133,7 @@
 
     version := self readShort.
     (version ~~ 42) ifTrue:[
-        'version of tiff-file not supported' printNewline.
+        'TIFFRDR: version of tiff-file not supported' errorPrintNewline.
         inStream close.
         ^ nil
     ].
@@ -150,28 +166,28 @@
 
     offset := self readLong.
     (offset ~~ 0) ifTrue:[
-        'more tags ignored' printNewline
+        'TIFFRDR: more tags ignored' errorPrintNewline
     ].
 
     "check for required tags"
     ok := true.
     width isNil ifTrue:[
-        'missing width tag' printNewline.
+        'TIFFRDR: missing width tag' errorPrintNewline.
         ok := false
     ].
 
     height isNil ifTrue:[
-        'missing length tag' printNewline.
+        'TIFFRDR: missing length tag' errorPrintNewline.
         ok := false
     ].
 
     photometric isNil ifTrue:[
-        'missing photometric tag' printNewline.
+        'TIFFRDR: missing photometric tag' errorPrintNewline.
         ok := false
     ].
 
     stripOffsets isNil ifTrue:[
-        'missing stripOffsets tag' printNewline.
+        'TIFFRDR: missing stripOffsets tag' errorPrintNewline.
         ok := false
     ].
 
@@ -194,14 +210,14 @@
       ] ifFalse:[
         (compression == 2) ifTrue:[
           "result := self readCCITT3ModHuffmanTiffImageData"
-          'ccitt mod Huffman compression not implemented' printNewline
+          'TIFFRDR: ccitt mod Huffman compression not implemented' errorPrintNewline
         ] ifFalse:[ 
           (compression == 3) ifTrue:[
             result := self readCCITTGroup3TiffImageData
           ] ifFalse:[ 
             (compression == 4) ifTrue:[
               "result := self readCCITTGroup4TiffImageData"
-              'ccitt group4 fax compression not implemented' printNewline
+              'TIFFRDR: ccitt group4 fax compression not implemented' errorPrintNewline
             ] ifFalse:[ 
               (compression == 32773) ifTrue:[
                 result := self readPackbitsTiffImageData
@@ -209,7 +225,7 @@
                   (compression == 32865) ifTrue:[
                     result := self readJPEGTiffImageData
                   ] ifFalse:[
-                    'compression type ' , compression printString , ' not known' printNewline
+                    'TIFFRDR: compression type ' , compression printString , ' not known' errorPrintNewline
                   ] 
               ] 
             ] 
@@ -231,7 +247,7 @@
 
     outStream := FileStream newFileNamed:aFileName.
     outStream isNil ifTrue:[
-        'create error' printNewline. 
+        'TIFFRDR: create error' errorPrintNewline. 
         ^ nil
     ].
 
@@ -444,10 +460,10 @@
     (tagType == 256) ifTrue:[
         "ImageWidth"
         width := value.
+"
         'width ' print. width printNewline.
 "
         ^ self
-"
     ].
     (tagType == 257) ifTrue:[
         "ImageHeight"
@@ -806,11 +822,12 @@
         ^ self
     ].
 
-'TIFF: tag:' print. tagType print. ' typ:' print. numberType print.
+"
+'TIFFRDR: tag:' print. tagType print. ' typ:' print. numberType print.
 ' len:' print. length print. ' offs:' print. offset print. 
 ' val:' print. value print. ' valArr:' print. valueArray printNewline.  
-
-    'TIFF: unknown type ' print. tagType printNewline
+"
+    'TIFFRDR: unknown tag type ' errorPrint. tagType errorPrintNewline
 !
 
 writeUncompressedBits
@@ -1187,7 +1204,7 @@
             self error:'with alpha, only separate planes supported'.
             ^ nil
         ].
-        'ignoring alpha plane' printNewline.
+        'TIFFRDR: ignoring alpha plane' errorPrintNewline.
         nPlanes := 1.
         bitsPerPixel := bitsPerSample at:1
     ] ifFalse:[
@@ -1271,7 +1288,7 @@
                 self error:'only separate planes supported'.
                 ^ nil
             ].
-            'ignoring alpha plane' printNewline.
+            'TIFFRDR: ignoring alpha plane' errorPrintNewline.
             nPlanes := 1
         ].
         (nPlanes == 1) ifFalse:[
@@ -1329,7 +1346,7 @@
 
     nPlanes := samplesPerPixel.
     (nPlanes == 2) ifTrue:[
-        'ignoring alpha plane' printNewline.
+        'TIFFRDR: ignoring alpha plane' errorPrintNewline.
         nPlanes := 1
     ].
 
@@ -1376,12 +1393,12 @@
 !
 
 readJPEGTiffImageData
-    'jpeg compression not implemented' printNewline
+    'TIFFRDR: jpeg compression not implemented' errorPrintNewline
 !
 
 readPackbitsTiffImageData
     "had no samples yet - however, packbits decompression
      is rather trivial to add ..."
 
-    'packbits compression not implemented' printNewline
+    'TIFFRDR: packbits compression not implemented' errorPrintNewline
 ! !