--- a/TIFFReader.st Tue Feb 03 18:01:23 1998 +0100
+++ b/TIFFReader.st Tue Feb 03 18:17:18 1998 +0100
@@ -1048,17 +1048,15 @@
!TIFFReader methodsFor:'private - data reading'!
readCCITT3RLETiffImageData
- 'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'ccitt mod Huffman (rle) compression not implemented'
- "Modified: / 1.12.1997 / 17:49:14 / cg"
+ "Modified: / 3.2.1998 / 18:03:14 / cg"
!
readCCITT3RLEWTiffImageData
- 'TIFFReader [warning]: ccitt mod Huffman (rlew) compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'ccitt mod Huffman (rlew) compression not implemented'.
- "Modified: / 1.12.1997 / 17:49:18 / cg"
+ "Modified: / 3.2.1998 / 18:03:30 / cg"
!
readCCITTGroup3TiffImageData
@@ -1078,17 +1076,14 @@
].
(nPlanes ~~ 1) ifTrue:[
- 'TIFFReader [warning]: only monochrome/greyscale supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only monochrome/greyscale ccitt3supported'.
].
stripByteCounts isNil ifTrue:[
- 'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'currently require stripByteCounts'.
].
(rowsPerStrip ~~ 1) isNil ifTrue:[
- 'TIFFReader [warning]: currently require rowsPerStrip to be 1' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'currently require rowsPerStrip to be 1'.
].
"/ 'TIFFReader: decompressing CCITT-3 ...' infoPrintNL.
@@ -1119,45 +1114,37 @@
row := row + rowsPerStrip
]
- "Modified: 10.1.1997 / 18:14:56 / cg"
+ "Modified: / 3.2.1998 / 18:04:21 / cg"
!
readCCITTGroup4TiffImageData
- 'TIFFReader [warning]: ccitt group4 fax compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'ccitt group4 fax compression not implemented'.
- "Modified: / 1.12.1997 / 17:49:23 / cg"
+ "Modified: / 3.2.1998 / 18:04:34 / cg"
!
readDCSTiffImageData
- 'TIFFReader [warning]: dcs compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'dcs compression not implemented'.
- "Created: / 11.4.1997 / 00:30:54 / cg"
- "Modified: / 1.12.1997 / 17:49:30 / cg"
+ "Modified: / 3.2.1998 / 18:04:44 / cg"
!
readDeflateTiffImageData
- 'TIFFReader [warning]: deflate compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'deflate compression not implemented'.
- "Created: / 11.4.1997 / 00:30:45 / cg"
- "Modified: / 1.12.1997 / 17:49:34 / cg"
+ "Modified: / 3.2.1998 / 18:04:54 / cg"
!
readJBIGTiffImageData
- 'TIFFReader [warning]: jbig compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'jbig compression not implemented'.
- "Created: / 11.4.1997 / 00:31:00 / cg"
- "Modified: / 1.12.1997 / 17:49:39 / cg"
+ "Modified: / 3.2.1998 / 18:05:04 / cg"
!
readJPEGTiffImageData
- 'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'jpeg compression not implemented'.
- "Modified: / 1.12.1997 / 17:49:44 / cg"
+ "Modified: / 3.2.1998 / 18:05:12 / cg"
!
readLZWTiffImageData
@@ -1181,29 +1168,25 @@
(((bitsPerSample at:1) ~~ 8)
or:[((bitsPerSample at:2) ~~ 8)
or:[((bitsPerSample at:3) ~~ 8)]]) ifTrue:[
- 'TIFFReader [warning]: only 8/8/8 bit/sample are supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only 8/8/8 bit/sample are supported'.
].
bytesPerRow := width * samplesPerPixel.
] ifFalse:[
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- 'TIFFReader [warning]: only separate planes are supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only separate planes are supported'.
].
'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1
].
(nPlanes == 1) ifFalse:[
- 'TIFFReader [warning]: only 3-sample rgb / monochrome supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only 3-sample rgb / monochrome supported'.
].
bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
].
stripByteCounts isNil ifTrue:[
- 'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'currently require stripByteCounts'.
].
"/ 'TIFFReader: decompressing LZW ...' infoPrintNL.
@@ -1238,21 +1221,19 @@
self class decodeDelta:3 in:data width:width height:height
]
- "Modified: 10.1.1997 / 18:13:21 / cg"
+ "Modified: / 3.2.1998 / 18:10:33 / cg"
!
readNeXTJPEGTiffImageData
- 'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'next jpeg compression not implemented'.
- "Modified: / 1.12.1997 / 17:49:50 / cg"
+ "Modified: / 3.2.1998 / 18:10:45 / cg"
!
readNeXTRLE2TiffImageData
- 'TIFFReader [warning]: next 2bit rle compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'next 2bit rle compression not implemented'.
- "Modified: / 1.12.1997 / 17:49:56 / cg"
+ "Modified: / 3.2.1998 / 18:10:54 / cg"
!
readPackbitsTiffImageData
@@ -1274,8 +1255,7 @@
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- 'TIFFReader [warning]: with alpha, only separate planes supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'with alpha, only separate planes supported'.
].
'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1.
@@ -1285,18 +1265,15 @@
] ifFalse:[
(nPlanes == 3) ifTrue:[
(planarConfiguration ~~ 1) ifTrue:[
- 'TIFFReader [warning]: only non separate planes supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only non separate planes supported'.
].
bitsPerSample ~= #(8 8 8) ifTrue:[
- 'TIFFReader [warning]: only 8/8/8 rgb images supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only 8/8/8 rgb images supported'.
].
bitsPerPixel := 24
] ifFalse:[
(nPlanes ~~ 1) ifTrue:[
- 'TIFFReader [warning]: format not supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'format not supported'.
].
bitsPerPixel := bitsPerSample at:1.
]
@@ -1333,31 +1310,25 @@
row := row + rowsPerStrip
]
- "Modified: / 1.12.1997 / 18:50:43 / cg"
+ "Modified: / 3.2.1998 / 18:11:35 / cg"
!
readPixarFilmTiffImageData
- 'TIFFReader [warning]: pixar film compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'pixar film compression not implemented'.
- "Created: / 11.4.1997 / 00:30:33 / cg"
- "Modified: / 1.12.1997 / 17:50:03 / cg"
+ "Modified: / 3.2.1998 / 18:11:45 / cg"
!
readPixarLogTiffImageData
- 'TIFFReader [warning]: pixar log compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'pixar log compression not implemented'.
- "Created: / 11.4.1997 / 00:30:39 / cg"
- "Modified: / 1.12.1997 / 17:50:08 / cg"
+ "Modified: / 3.2.1998 / 18:11:53 / cg"
!
readThunderScanTiffImageData
- 'TIFFReader [warning]: thunderScan compression not implemented' errorPrintCR.
- ^ nil.
+ ^ self fileFormatError:'thunderScan compression not implemented' .
- "Created: / 11.4.1997 / 00:30:23 / cg"
- "Modified: / 1.12.1997 / 17:50:12 / cg"
+ "Modified: / 3.2.1998 / 18:12:01 / cg"
!
readTiffImageData
@@ -1414,13 +1385,10 @@
^ self readJBIGTiffImageData.
].
- 'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
- ' not known' errorPrintCR.
+ ^ self fileFormatError:('compression type ' , compression printString , ' not known').
- ^ nil.
-
- "Created: 11.4.1997 / 00:19:44 / cg"
- "Modified: 11.4.1997 / 00:29:54 / cg"
+ "Created: / 11.4.1997 / 00:19:44 / cg"
+ "Modified: / 3.2.1998 / 18:12:36 / cg"
!
readUncompressedTiffImageData
@@ -1439,8 +1407,7 @@
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- 'TIFFReader [warning]: with alpha, only separate planes supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'with alpha, only separate planes supported'.
].
'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1.
@@ -1450,18 +1417,15 @@
] ifFalse:[
(nPlanes == 3) ifTrue:[
(planarConfiguration ~~ 1) ifTrue:[
- 'TIFFReader [warning]: only non separate planes supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only non separate planes supported'.
].
bitsPerSample ~= #(8 8 8) ifTrue:[
- 'TIFFReader [warning]: only 8/8/8 rgb images supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'only 8/8/8 rgb images supported'.
].
bitsPerPixel := 24
] ifFalse:[
(nPlanes ~~ 1) ifTrue:[
- 'TIFFReader [warning]: format not supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'format not supported'.
].
bitsPerPixel := bitsPerSample at:1.
]
@@ -1496,7 +1460,7 @@
row := row + rowsPerStrip
]
- "Modified: 24.4.1997 / 21:10:07 / cg"
+ "Modified: / 3.2.1998 / 18:13:16 / cg"
! !
!TIFFReader methodsFor:'private - reading'!
@@ -1996,8 +1960,7 @@
char1 := aStream next.
char2 := aStream next.
(char1 ~~ char2) ifTrue:[
- 'TIFFReader [warning]: not a tiff file' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'not a tiff file'.
].
(char1 == $I asciiValue) ifTrue:[
byteOrder := #lsb.
@@ -2007,15 +1970,13 @@
byteOrder := #msb.
msb := true.
] ifFalse:[
- 'TIFFReader [warning]: not a tiff file' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'not a tiff file'.
]
].
version := self readShort.
(version ~~ 42) ifTrue:[
- 'TIFFReader [warning]: version of tiff-file not supported' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'version of tiff-file not supported'.
].
"setup default values"
@@ -2052,23 +2013,19 @@
"check for required tags"
width isNil ifTrue:[
- 'TIFFReader [warning]: missing width tag' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'missing width tag'.
].
height isNil ifTrue:[
- 'TIFFReader [warning]: missing length tag' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'missing length tag'.
].
photometric isNil ifTrue:[
- 'TIFFReader [warning]: missing photometric tag' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'missing photometric tag'.
].
stripOffsets isNil ifTrue:[
- 'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'missing stripOffsets tag'.
].
stripByteCounts isNil ifTrue:[
@@ -2078,8 +2035,7 @@
].
stripByteCounts isNil ifTrue:[
- 'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR.
- ^ nil
+ ^ self fileFormatError:'missing stripByteCounts tag'.
].
dimensionCallBack notNil ifTrue:[
@@ -2122,7 +2078,7 @@
^ result
- "Modified: / 1.12.1997 / 17:54:51 / cg"
+ "Modified: / 3.2.1998 / 18:02:29 / cg"
! !
!TIFFReader methodsFor:'writing to file'!
@@ -2227,6 +2183,6 @@
!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.58 1997-12-01 18:51:00 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.59 1998-02-03 17:17:18 cg Exp $'
! !
TIFFReader initialize!