*** empty log message ***
authorclaus
Fri, 28 Oct 1994 04:19:24 +0100
changeset 30 9638bc775850
parent 29 e04e1aceff6f
child 31 c8adde64ce92
*** empty log message ***
TIFFRdr.st
TIFFReader.st
--- a/TIFFRdr.st	Fri Oct 28 04:16:37 1994 +0100
+++ b/TIFFRdr.st	Fri Oct 28 04:19:24 1994 +0100
@@ -27,7 +27,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.11 1994-10-10 02:33:22 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.12 1994-10-28 03:19:24 claus Exp $
 '!
 
 !TIFFReader class methodsFor:'documentation'!
@@ -48,7 +48,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.11 1994-10-10 02:33:22 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.12 1994-10-28 03:19:24 claus Exp $
 "
 !
 
@@ -68,13 +68,17 @@
 
     Only writing of uncompressed images is currently implemented.
     More formats will come ...
+
+    TODO: since I dont want to spend all of my life adding more formats here and
+    reinventing the wheel, this code should be changed to use the tiff library.
+    That would give us most formats and also writing capabilities for free.
 "
 ! !
 
 !TIFFReader class methodsFor:'initialization'!
 
 initialize
-    Image fileFormats at:'.tiff'  put:self.
+    Image fileFormats at:'.tiff' put:self.
     Image fileFormats at:'.tif'  put:self.
     Image fileFormats at:'.TIF'  put:self.
 ! !
@@ -212,38 +216,52 @@
 	rowsPerStrip := height
     ].
 
+    ok := false.
     (compression == 1) ifTrue:[
-      result := self readUncompressedTiffImageData
-    ] ifFalse:[
-      (compression == 5) ifTrue:[
-	result := self readLZWTiffImageData
-      ] ifFalse:[
-	(compression == 2) ifTrue:[
-	  "result := self readCCITT3ModHuffmanTiffImageData"
-	  'TIFFReader: ccitt mod Huffman compression not implemented' errorPrintNL
-	] ifFalse:[ 
-	  (compression == 3) ifTrue:[
-	    result := self readCCITTGroup3TiffImageData
-	  ] ifFalse:[ 
-	    (compression == 4) ifTrue:[
-	      "result := self readCCITTGroup4TiffImageData"
-	      'TIFFReader: ccitt group4 fax compression not implemented' errorPrintNL
-	    ] ifFalse:[ 
-	      (compression == 32773) ifTrue:[
-		result := self readPackbitsTiffImageData
-	      ] ifFalse:[
-		  (compression == 32865) ifTrue:[
-		    result := self readJPEGTiffImageData
-		  ] ifFalse:[
-		    'TIFFReader: compression type ' , compression printString , ' not known' errorPrintNL
-		  ] 
-	      ] 
-	    ] 
-	  ] 
-	] 
-      ] 
+	result := self readUncompressedTiffImageData.
+	ok := true
+    ].
+    (compression == 2) ifTrue:[
+	result := self readCCITT3RLETiffImageData.
+	ok := true
+    ].
+    (compression == 3) ifTrue:[
+	result := self readCCITTGroup3TiffImageData.
+	ok := true
+    ]. 
+    (compression == 4) ifTrue:[
+	result := self readCCITTGroup4TiffImageData.
+	ok := true
+    ]. 
+    (compression == 5) ifTrue:[
+	result := self readLZWTiffImageData.
+	ok := true
     ].
-
+    (compression == 6) ifTrue:[
+	result := self readJPEGTiffImageData.
+	ok := true
+    ].
+    (compression == 32766) ifTrue:[
+	result := self readNeXTRLE2TiffImageData.
+	ok := true
+    ].
+    (compression == 32771) ifTrue:[
+	result := self readCCITTRLEWTiffImageData.
+	ok := true
+    ].
+    (compression == 32773) ifTrue:[
+	result := self readPackbitsTiffImageData.
+	ok := true
+    ].
+    (compression == 32865) ifTrue:[
+	result := self readNeXTJPEGTiffImageData.
+	ok := true
+    ].
+    ok ifFalse:[
+	'TIFFReader: compression type ' errorPrint.
+	compression errorPrint.
+	' not known' errorPrintNL
+    ].
     inStream close.
     ^ result
 ! !
@@ -501,6 +519,7 @@
     ].
     (tagType == 262) ifTrue:[
 	"photometric"
+
 	(value == 0) ifTrue:[
 	  photometric := #whiteIs0
 	] ifFalse:[
@@ -516,7 +535,19 @@
 		(value == 4) ifTrue:[
 		  photometric := #transparency
 		] ifFalse:[
-		  photometric := nil
+		  (value == 5) ifTrue:[
+		    photometric := #separated  "/ color separations
+		  ] ifFalse:[
+		    (value == 6) ifTrue:[
+		      photometric := #ycbr    "/ CCIR 601
+		    ] ifFalse:[
+		      (value == 8) ifTrue:[
+			photometric := #cielab  "/ 1976 CIE L*a*b*
+		      ] ifFalse:[
+			photometric := nil
+		      ]
+		    ]
+		  ]
 		]
 	      ]
 	    ]
@@ -568,28 +599,28 @@
 	^ self
     ].
     (tagType == 269) ifTrue:[
-	"documentName"
+	"documentName - info only"
 "
 	'documentName ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 270) ifTrue:[
-	"imageDescription"
+	"imageDescription - info only"
 "
 	'imageDescription ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 271) ifTrue:[
-	"make"
+	"make - info only"
 "
 	'make ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 272) ifTrue:[
-	"model"
+	"model - info only"
 "
 	'model ' print. value printNewline.
 "
@@ -790,20 +821,34 @@
 "
 	^ self
     ].
+    (tagType == 305) ifTrue:[
+	"software - info only"
+"
+	'software' print. value printNewline.
+"
+	^ self
+    ].
     (tagType == 306) ifTrue:[
-	"dateTime"
+	"dateTime - info only"
 "
 	'dateTime ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 315) ifTrue:[
-	"artist"
+	"artist - info only"
 "
 	'artist ' print. value printNewline.
 "
 	^ self
     ].
+    (tagType == 316) ifTrue:[
+	"host computer - info only"
+"
+	'host ' print. value printNewline.
+"
+	^ self
+    ].
     (tagType == 317) ifTrue:[
 	"predictor"
 	predictor := value.
@@ -812,6 +857,20 @@
 "
 	^ self
     ].
+    (tagType == 318) ifTrue:[
+	"whitePoint"
+"
+	'whitePoint ' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 319) ifTrue:[
+	"primaryChromatics"
+"
+	'primaryChromatics ' print. value printNewline.
+"
+	^ self
+    ].
     (tagType == 320) ifTrue:[
 	"colorMap"
 "
@@ -834,6 +893,97 @@
 	].
 	^ self
     ].
+    (tagType == 332) ifTrue:[
+	"ink set"
+"
+	'ink set' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 333) ifTrue:[
+	"ink names"
+"
+	'ink names' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 336) ifTrue:[
+	"dot range"
+"
+	'dot range' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 337) ifTrue:[
+	"target printer"
+"
+	'target printer' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 339) ifTrue:[
+	"sample format"
+"
+	'sample format' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 340) ifTrue:[
+	"min sample value"
+"
+	'min sample value' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 341) ifTrue:[
+	"max sample value"
+"
+	'max sample value' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 512) ifTrue:[
+	"jpeg proc"
+"
+	'jpeg proc' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 513) ifTrue:[
+	"jpeg proc"
+"
+	'jpeg proc' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32995) ifTrue:[
+	"matteing"
+"
+	'matteing' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32996) ifTrue:[
+	"datatype"
+"
+	'datatype' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32997) ifTrue:[
+	"imagedepth"
+"
+	'imagedepth' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32998) ifTrue:[
+	"tiledepth"
+"
+	'tiledepth' print. value printNewline.
+"
+	^ self
+    ].
 
 "
 'TIFFReader: tag:' print. tagType print. ' typ:' print. numberType print.
@@ -1423,6 +1573,26 @@
     'TIFFReader: jpeg compression not implemented' errorPrintNL
 !
 
+readNeXTJPEGTiffImageData
+    'TIFFReader: jpeg compression not implemented' errorPrintNL
+!
+
+readCCITT3RLETiffImageData
+     'TIFFReader: ccitt mod Huffman (rle) compression not implemented' errorPrintNL.
+!
+
+readCCITT3RLEWTiffImageData
+     'TIFFReader: ccitt mod Huffman (rlew) compression not implemented' errorPrintNL.
+!
+
+readCCITTGroup4TiffImageData
+    'TIFFReader: ccitt group4 fax compression not implemented' errorPrintNL.
+!
+
+readNeXTRLE2TiffImageData
+    'TIFFReader: next 2bit rle compression not implemented' errorPrintNL.
+!
+
 readPackbitsTiffImageData
     "had no samples yet - however, packbits decompression
      is rather trivial to add ..."
--- a/TIFFReader.st	Fri Oct 28 04:16:37 1994 +0100
+++ b/TIFFReader.st	Fri Oct 28 04:19:24 1994 +0100
@@ -27,7 +27,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.11 1994-10-10 02:33:22 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.12 1994-10-28 03:19:24 claus Exp $
 '!
 
 !TIFFReader class methodsFor:'documentation'!
@@ -48,7 +48,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.11 1994-10-10 02:33:22 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.12 1994-10-28 03:19:24 claus Exp $
 "
 !
 
@@ -68,13 +68,17 @@
 
     Only writing of uncompressed images is currently implemented.
     More formats will come ...
+
+    TODO: since I dont want to spend all of my life adding more formats here and
+    reinventing the wheel, this code should be changed to use the tiff library.
+    That would give us most formats and also writing capabilities for free.
 "
 ! !
 
 !TIFFReader class methodsFor:'initialization'!
 
 initialize
-    Image fileFormats at:'.tiff'  put:self.
+    Image fileFormats at:'.tiff' put:self.
     Image fileFormats at:'.tif'  put:self.
     Image fileFormats at:'.TIF'  put:self.
 ! !
@@ -212,38 +216,52 @@
 	rowsPerStrip := height
     ].
 
+    ok := false.
     (compression == 1) ifTrue:[
-      result := self readUncompressedTiffImageData
-    ] ifFalse:[
-      (compression == 5) ifTrue:[
-	result := self readLZWTiffImageData
-      ] ifFalse:[
-	(compression == 2) ifTrue:[
-	  "result := self readCCITT3ModHuffmanTiffImageData"
-	  'TIFFReader: ccitt mod Huffman compression not implemented' errorPrintNL
-	] ifFalse:[ 
-	  (compression == 3) ifTrue:[
-	    result := self readCCITTGroup3TiffImageData
-	  ] ifFalse:[ 
-	    (compression == 4) ifTrue:[
-	      "result := self readCCITTGroup4TiffImageData"
-	      'TIFFReader: ccitt group4 fax compression not implemented' errorPrintNL
-	    ] ifFalse:[ 
-	      (compression == 32773) ifTrue:[
-		result := self readPackbitsTiffImageData
-	      ] ifFalse:[
-		  (compression == 32865) ifTrue:[
-		    result := self readJPEGTiffImageData
-		  ] ifFalse:[
-		    'TIFFReader: compression type ' , compression printString , ' not known' errorPrintNL
-		  ] 
-	      ] 
-	    ] 
-	  ] 
-	] 
-      ] 
+	result := self readUncompressedTiffImageData.
+	ok := true
+    ].
+    (compression == 2) ifTrue:[
+	result := self readCCITT3RLETiffImageData.
+	ok := true
+    ].
+    (compression == 3) ifTrue:[
+	result := self readCCITTGroup3TiffImageData.
+	ok := true
+    ]. 
+    (compression == 4) ifTrue:[
+	result := self readCCITTGroup4TiffImageData.
+	ok := true
+    ]. 
+    (compression == 5) ifTrue:[
+	result := self readLZWTiffImageData.
+	ok := true
     ].
-
+    (compression == 6) ifTrue:[
+	result := self readJPEGTiffImageData.
+	ok := true
+    ].
+    (compression == 32766) ifTrue:[
+	result := self readNeXTRLE2TiffImageData.
+	ok := true
+    ].
+    (compression == 32771) ifTrue:[
+	result := self readCCITTRLEWTiffImageData.
+	ok := true
+    ].
+    (compression == 32773) ifTrue:[
+	result := self readPackbitsTiffImageData.
+	ok := true
+    ].
+    (compression == 32865) ifTrue:[
+	result := self readNeXTJPEGTiffImageData.
+	ok := true
+    ].
+    ok ifFalse:[
+	'TIFFReader: compression type ' errorPrint.
+	compression errorPrint.
+	' not known' errorPrintNL
+    ].
     inStream close.
     ^ result
 ! !
@@ -501,6 +519,7 @@
     ].
     (tagType == 262) ifTrue:[
 	"photometric"
+
 	(value == 0) ifTrue:[
 	  photometric := #whiteIs0
 	] ifFalse:[
@@ -516,7 +535,19 @@
 		(value == 4) ifTrue:[
 		  photometric := #transparency
 		] ifFalse:[
-		  photometric := nil
+		  (value == 5) ifTrue:[
+		    photometric := #separated  "/ color separations
+		  ] ifFalse:[
+		    (value == 6) ifTrue:[
+		      photometric := #ycbr    "/ CCIR 601
+		    ] ifFalse:[
+		      (value == 8) ifTrue:[
+			photometric := #cielab  "/ 1976 CIE L*a*b*
+		      ] ifFalse:[
+			photometric := nil
+		      ]
+		    ]
+		  ]
 		]
 	      ]
 	    ]
@@ -568,28 +599,28 @@
 	^ self
     ].
     (tagType == 269) ifTrue:[
-	"documentName"
+	"documentName - info only"
 "
 	'documentName ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 270) ifTrue:[
-	"imageDescription"
+	"imageDescription - info only"
 "
 	'imageDescription ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 271) ifTrue:[
-	"make"
+	"make - info only"
 "
 	'make ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 272) ifTrue:[
-	"model"
+	"model - info only"
 "
 	'model ' print. value printNewline.
 "
@@ -790,20 +821,34 @@
 "
 	^ self
     ].
+    (tagType == 305) ifTrue:[
+	"software - info only"
+"
+	'software' print. value printNewline.
+"
+	^ self
+    ].
     (tagType == 306) ifTrue:[
-	"dateTime"
+	"dateTime - info only"
 "
 	'dateTime ' print. value printNewline.
 "
 	^ self
     ].
     (tagType == 315) ifTrue:[
-	"artist"
+	"artist - info only"
 "
 	'artist ' print. value printNewline.
 "
 	^ self
     ].
+    (tagType == 316) ifTrue:[
+	"host computer - info only"
+"
+	'host ' print. value printNewline.
+"
+	^ self
+    ].
     (tagType == 317) ifTrue:[
 	"predictor"
 	predictor := value.
@@ -812,6 +857,20 @@
 "
 	^ self
     ].
+    (tagType == 318) ifTrue:[
+	"whitePoint"
+"
+	'whitePoint ' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 319) ifTrue:[
+	"primaryChromatics"
+"
+	'primaryChromatics ' print. value printNewline.
+"
+	^ self
+    ].
     (tagType == 320) ifTrue:[
 	"colorMap"
 "
@@ -834,6 +893,97 @@
 	].
 	^ self
     ].
+    (tagType == 332) ifTrue:[
+	"ink set"
+"
+	'ink set' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 333) ifTrue:[
+	"ink names"
+"
+	'ink names' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 336) ifTrue:[
+	"dot range"
+"
+	'dot range' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 337) ifTrue:[
+	"target printer"
+"
+	'target printer' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 339) ifTrue:[
+	"sample format"
+"
+	'sample format' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 340) ifTrue:[
+	"min sample value"
+"
+	'min sample value' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 341) ifTrue:[
+	"max sample value"
+"
+	'max sample value' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 512) ifTrue:[
+	"jpeg proc"
+"
+	'jpeg proc' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 513) ifTrue:[
+	"jpeg proc"
+"
+	'jpeg proc' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32995) ifTrue:[
+	"matteing"
+"
+	'matteing' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32996) ifTrue:[
+	"datatype"
+"
+	'datatype' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32997) ifTrue:[
+	"imagedepth"
+"
+	'imagedepth' print. value printNewline.
+"
+	^ self
+    ].
+    (tagType == 32998) ifTrue:[
+	"tiledepth"
+"
+	'tiledepth' print. value printNewline.
+"
+	^ self
+    ].
 
 "
 'TIFFReader: tag:' print. tagType print. ' typ:' print. numberType print.
@@ -1423,6 +1573,26 @@
     'TIFFReader: jpeg compression not implemented' errorPrintNL
 !
 
+readNeXTJPEGTiffImageData
+    'TIFFReader: jpeg compression not implemented' errorPrintNL
+!
+
+readCCITT3RLETiffImageData
+     'TIFFReader: ccitt mod Huffman (rle) compression not implemented' errorPrintNL.
+!
+
+readCCITT3RLEWTiffImageData
+     'TIFFReader: ccitt mod Huffman (rlew) compression not implemented' errorPrintNL.
+!
+
+readCCITTGroup4TiffImageData
+    'TIFFReader: ccitt group4 fax compression not implemented' errorPrintNL.
+!
+
+readNeXTRLE2TiffImageData
+    'TIFFReader: next 2bit rle compression not implemented' errorPrintNL.
+!
+
 readPackbitsTiffImageData
     "had no samples yet - however, packbits decompression
      is rather trivial to add ..."