--- a/TIFFRdr.st Fri Jan 10 16:10:28 1997 +0100
+++ b/TIFFRdr.st Fri Jan 10 18:32:24 1997 +0100
@@ -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.
@@ -123,552 +123,552 @@
i3 "{ Class: SmallInteger }" |
(numberType == 3) ifTrue:[
- "short"
- valueArray := self readShorts:length.
- value := valueArray at:1
+ "short"
+ valueArray := self readShorts:length.
+ value := valueArray at:1
] ifFalse:[
- (numberType == 4) ifTrue:[
- "integer"
- valueArray := self readLongs:length.
- value := valueArray at:1
- ] ifFalse:[
- (numberType == 2) ifTrue:[
- "character"
- value := self readChars:length
- ] ifFalse:[
- (numberType == 5) ifTrue:[
- "fraction"
- valueArray := self readFracts:length.
- value := valueArray at:1
- ] ifFalse:[
- offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
- ]
- ]
- ]
+ (numberType == 4) ifTrue:[
+ "integer"
+ valueArray := self readLongs:length.
+ value := valueArray at:1
+ ] ifFalse:[
+ (numberType == 2) ifTrue:[
+ "character"
+ value := self readChars:length
+ ] ifFalse:[
+ (numberType == 5) ifTrue:[
+ "fraction"
+ valueArray := self readFracts:length.
+ value := valueArray at:1
+ ] ifFalse:[
+ offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
+ ]
+ ]
+ ]
].
(tagType == 254) ifTrue:[
- "NewSubfileType"
- "newSubFileType := value."
+ "NewSubfileType"
+ "newSubFileType := value."
"
- 'newSubfiletype ' print. value printNewline.
+ 'newSubfiletype ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 255) ifTrue:[
- "SubfileType"
- subFileType := value.
+ "SubfileType"
+ subFileType := value.
"
- 'subfiletype ' print. value printNewline.
+ 'subfiletype ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 256) ifTrue:[
- "ImageWidth"
- width := value.
+ "ImageWidth"
+ width := value.
"
- 'width ' print. width printNewline.
+ 'width ' print. width printNewline.
"
- ^ self
+ ^ self
].
(tagType == 257) ifTrue:[
- "ImageHeight"
- height := value.
+ "ImageHeight"
+ height := value.
"
- 'height ' print. height printNewline.
+ 'height ' print. height printNewline.
"
- ^ self
+ ^ self
].
(tagType == 258) ifTrue:[
- "bitspersample"
- bitsPerSample := valueArray.
+ "bitspersample"
+ bitsPerSample := valueArray.
"
- 'bitspersample ' print. bitsPerSample printNewline.
+ 'bitspersample ' print. bitsPerSample printNewline.
"
- ^ self
+ ^ self
].
(tagType == 259) ifTrue:[
- "compression"
- compression := value.
+ "compression"
+ compression := value.
"
- 'compression ' print. compression printNewline.
+ 'compression ' print. compression printNewline.
"
- ^ self
+ ^ self
].
(tagType == 262) ifTrue:[
- "photometric"
+ "photometric"
- (value == 0) ifTrue:[
- photometric := #whiteIs0
- ] ifFalse:[
- (value == 1) ifTrue:[
- photometric := #blackIs0
- ] ifFalse:[
- (value == 2) ifTrue:[
- photometric := #rgb
- ] ifFalse:[
- (value == 3) ifTrue:[
- photometric := #palette
- ] ifFalse:[
- (value == 4) ifTrue:[
- photometric := #transparency
- ] ifFalse:[
- (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
- ]
- ]
- ]
- ]
- ]
- ]
- ]
- ].
+ (value == 0) ifTrue:[
+ photometric := #whiteIs0
+ ] ifFalse:[
+ (value == 1) ifTrue:[
+ photometric := #blackIs0
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ photometric := #rgb
+ ] ifFalse:[
+ (value == 3) ifTrue:[
+ photometric := #palette
+ ] ifFalse:[
+ (value == 4) ifTrue:[
+ photometric := #transparency
+ ] ifFalse:[
+ (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
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
"
- 'photometric ' print. photometric printNewline.
+ 'photometric ' print. photometric printNewline.
"
- ^ self
+ ^ self
].
(tagType == 263) ifTrue:[
- "Treshholding"
- "threshholding := value."
+ "Treshholding"
+ "threshholding := value."
"
- 'treshholding ' print. value printNewline.
+ 'treshholding ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 264) ifTrue:[
- "CellWidth"
- "cellWidth:= value."
+ "CellWidth"
+ "cellWidth:= value."
"
- 'cellWidth ' print. value printNewline.
+ 'cellWidth ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 265) ifTrue:[
- "CellLength"
- "cellLength:= value."
+ "CellLength"
+ "cellLength:= value."
"
- 'cellLength ' print. value printNewline.
+ 'cellLength ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 266) ifTrue:[
- "fillOrder"
- (value == 1) ifTrue:[
- fillOrder := #msb
- ] ifFalse:[
- (value == 2) ifTrue:[
- fillOrder := #lsb
- ] ifFalse:[
- fillOrder := nil
- ]
- ].
+ "fillOrder"
+ (value == 1) ifTrue:[
+ fillOrder := #msb
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ fillOrder := #lsb
+ ] ifFalse:[
+ fillOrder := nil
+ ]
+ ].
"
- 'fillorder ' print. fillOrder printNewline.
+ 'fillorder ' print. fillOrder printNewline.
"
- ^ self
+ ^ self
].
(tagType == 269) ifTrue:[
- "documentName - info only"
+ "documentName - info only"
"
- 'documentName ' print. value printNewline.
+ 'documentName ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 270) ifTrue:[
- "imageDescription - info only"
+ "imageDescription - info only"
"
- 'imageDescription ' print. value printNewline.
+ 'imageDescription ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 271) ifTrue:[
- "make - info only"
+ "make - info only"
"
- 'make ' print. value printNewline.
+ 'make ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 272) ifTrue:[
- "model - info only"
+ "model - info only"
"
- 'model ' print. value printNewline.
+ 'model ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 273) ifTrue:[
- "stripoffsets"
- stripOffsets := valueArray.
+ "stripoffsets"
+ stripOffsets := valueArray.
"
- 'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
+ 'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
"
- ^ self
+ ^ self
].
(tagType == 274) ifTrue:[
- "Orientation"
- "orientation:= value."
+ "Orientation"
+ "orientation:= value."
"
- 'orientation ' print. value printNewline.
+ 'orientation ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 277) ifTrue:[
- "samplesPerPixel"
- samplesPerPixel := value.
+ "samplesPerPixel"
+ samplesPerPixel := value.
"
- 'samplesperpixel ' print. samplesPerPixel printNewline.
+ 'samplesperpixel ' print. samplesPerPixel printNewline.
"
- ^ self
+ ^ self
].
(tagType == 278) ifTrue:[
- "rowsperstrip"
- rowsPerStrip := value.
+ "rowsperstrip"
+ rowsPerStrip := value.
"
- 'rowsperstrip ' print. rowsPerStrip printNewline.
+ 'rowsperstrip ' print. rowsPerStrip printNewline.
"
- ^ self
+ ^ self
].
(tagType == 279) ifTrue:[
- "stripbytecount"
- stripByteCounts := valueArray.
+ "stripbytecount"
+ stripByteCounts := valueArray.
"
- 'stripByteCounts Array(' print.
- stripByteCounts size print.
- ')' printNewline.
+ 'stripByteCounts Array(' print.
+ stripByteCounts size print.
+ ')' printNewline.
"
- ^ self
+ ^ self
].
(tagType == 280) ifTrue:[
- "MinSampleValue"
- "minSampleValue:= value."
+ "MinSampleValue"
+ "minSampleValue:= value."
"
- 'minSampleValue ' print. value printNewline.
+ 'minSampleValue ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 281) ifTrue:[
- "MaxSampleValue"
- "maxSampleValue:= value."
+ "MaxSampleValue"
+ "maxSampleValue:= value."
"
- 'maxSampleValue ' print. value printNewline.
+ 'maxSampleValue ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 282) ifTrue:[
- "xResolution"
+ "xResolution"
"
- 'xres ' print. value printNewline.
+ 'xres ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 283) ifTrue:[
- "yResolution"
+ "yResolution"
"
- 'yres ' print. value printNewline.
+ 'yres ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 284) ifTrue:[
- "planarconfig"
- (value == 1) ifTrue:[
- planarConfiguration := 1
- ] ifFalse:[
- (value == 2) ifTrue:[
- planarConfiguration := 2
- ] ifFalse:[
- planarConfiguration := nil
- ]
- ].
+ "planarconfig"
+ (value == 1) ifTrue:[
+ planarConfiguration := 1
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ planarConfiguration := 2
+ ] ifFalse:[
+ planarConfiguration := nil
+ ]
+ ].
"
- 'planarconfig ' print. planarConfiguration printNewline.
+ 'planarconfig ' print. planarConfiguration printNewline.
"
- ^ self
+ ^ self
].
(tagType == 285) ifTrue:[
- "pageName"
+ "pageName"
"
- 'pageName ' print. value printNewline.
+ 'pageName ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 286) ifTrue:[
- "xPosition"
+ "xPosition"
"
- 'xPos ' print. value printNewline.
+ 'xPos ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 287) ifTrue:[
- "yPosition"
+ "yPosition"
"
- 'yPos ' print. value printNewline.
+ 'yPos ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 288) ifTrue:[
- "freeOffsets"
+ "freeOffsets"
"
- 'freeOffsets ' print. value printNewline.
+ 'freeOffsets ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 289) ifTrue:[
- "freeByteCounts"
+ "freeByteCounts"
"
- 'freeByteCounts ' print. value printNewline.
+ 'freeByteCounts ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 290) ifTrue:[
- "grayResponceUnit"
+ "grayResponceUnit"
"
- 'grayResponceUnit' print. value printNewline.
+ 'grayResponceUnit' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 291) ifTrue:[
- "grayResponceCurve"
+ "grayResponceCurve"
"
- 'grayResponceCurve' print. value printNewline.
+ 'grayResponceCurve' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 292) ifTrue:[
- "group3options"
- group3options := value.
+ "group3options"
+ group3options := value.
"
- 'group3options ' print. group3options printNewline.
+ 'group3options ' print. group3options printNewline.
"
- ^ self
+ ^ self
].
(tagType == 293) ifTrue:[
- "group4options"
- "group4options := value."
+ "group4options"
+ "group4options := value."
"
- 'group4options ' print. value printNewline.
+ 'group4options ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 296) ifTrue:[
- "resolutionunit"
+ "resolutionunit"
"
- (value == 1) ifTrue:[
- 'res-unit pixel' printNewline
- ] ifFalse:[
- (value == 2) ifTrue:[
- 'res-unit inch' printNewline
- ] ifFalse:[
- (value == 3) ifTrue:[
- 'res-unit mm' printNewline
- ] ifFalse:[
- 'res-unit invalid' printNewline
- ]
- ]
- ].
+ (value == 1) ifTrue:[
+ 'res-unit pixel' printNewline
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ 'res-unit inch' printNewline
+ ] ifFalse:[
+ (value == 3) ifTrue:[
+ 'res-unit mm' printNewline
+ ] ifFalse:[
+ 'res-unit invalid' printNewline
+ ]
+ ]
+ ].
"
- "resolutionUnit := value."
- ^ self
+ "resolutionUnit := value."
+ ^ self
].
(tagType == 297) ifTrue:[
- "pageNumber"
- "pageNumber := value."
+ "pageNumber"
+ "pageNumber := value."
"
- 'pageNumber ' print. value printNewline.
+ 'pageNumber ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 300) ifTrue:[
- "colorResponceUnit"
+ "colorResponceUnit"
"
- 'colorResponceUnit' print. value printNewline.
+ 'colorResponceUnit' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 301) ifTrue:[
- "colorResponceCurve"
+ "colorResponceCurve"
"
- 'colorResponceCurve' print. value printNewline.
+ 'colorResponceCurve' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 305) ifTrue:[
- "software - info only"
+ "software - info only"
"
- 'software' print. value printNewline.
+ 'software' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 306) ifTrue:[
- "dateTime - info only"
+ "dateTime - info only"
"
- 'dateTime ' print. value printNewline.
+ 'dateTime ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 315) ifTrue:[
- "artist - info only"
+ "artist - info only"
"
- 'artist ' print. value printNewline.
+ 'artist ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 316) ifTrue:[
- "host computer - info only"
+ "host computer - info only"
"
- 'host ' print. value printNewline.
+ 'host ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 317) ifTrue:[
- "predictor"
- predictor := value.
+ "predictor"
+ predictor := value.
"
- 'predictor ' print. predictor printNewline.
+ 'predictor ' print. predictor printNewline.
"
- ^ self
+ ^ self
].
(tagType == 318) ifTrue:[
- "whitePoint"
+ "whitePoint"
"
- 'whitePoint ' print. value printNewline.
+ 'whitePoint ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 319) ifTrue:[
- "primaryChromatics"
+ "primaryChromatics"
"
- 'primaryChromatics ' print. value printNewline.
+ 'primaryChromatics ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 320) ifTrue:[
- "colorMap"
+ "colorMap"
"
- 'colorMap (size=' print. valueArray size print. ')' printNewline.
+ 'colorMap (size=' print. valueArray size print. ')' printNewline.
"
- "
- the tiff colormap contains 16bit values;
- our colormap expects 8bit values
- "
- n := valueArray size // 3.
+ "
+ the tiff colormap contains 16bit values;
+ our colormap expects 8bit values
+ "
+ n := valueArray size // 3.
- rV := ByteArray uninitializedNew:n.
- gV := ByteArray uninitializedNew:n.
- bV := ByteArray uninitializedNew:n.
- scaleFactor := 255.0 / 16rFFFF.
- i2 := n+1.
- i3 := 2*n+1.
- 1 to:n do:[:vi |
- val := ((valueArray at:vi) * scaleFactor) rounded.
- rV at:vi put:val.
- val := ((valueArray at:i2) * scaleFactor) rounded.
- gV at:vi put:val.
- val := ((valueArray at:i3) * scaleFactor) rounded.
- bV at:vi put:val.
- i2 := i2 + 1.
- i3 := i3 + 1.
- ].
- colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
- ^ self
+ rV := ByteArray uninitializedNew:n.
+ gV := ByteArray uninitializedNew:n.
+ bV := ByteArray uninitializedNew:n.
+ scaleFactor := 255.0 / 16rFFFF.
+ i2 := n+1.
+ i3 := 2*n+1.
+ 1 to:n do:[:vi |
+ val := ((valueArray at:vi) * scaleFactor) rounded.
+ rV at:vi put:val.
+ val := ((valueArray at:i2) * scaleFactor) rounded.
+ gV at:vi put:val.
+ val := ((valueArray at:i3) * scaleFactor) rounded.
+ bV at:vi put:val.
+ i2 := i2 + 1.
+ i3 := i3 + 1.
+ ].
+ colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
+ ^ self
].
(tagType == 332) ifTrue:[
- "ink set"
+ "ink set"
"
- 'ink set' print. value printNewline.
+ 'ink set' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 333) ifTrue:[
- "ink names"
+ "ink names"
"
- 'ink names' print. value printNewline.
+ 'ink names' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 336) ifTrue:[
- "dot range"
+ "dot range"
"
- 'dot range' print. value printNewline.
+ 'dot range' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 337) ifTrue:[
- "target printer"
+ "target printer"
"
- 'target printer' print. value printNewline.
+ 'target printer' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 339) ifTrue:[
- "sample format"
+ "sample format"
"
- 'sample format' print. value printNewline.
+ 'sample format' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 340) ifTrue:[
- "min sample value"
+ "min sample value"
"
- 'min sample value' print. value printNewline.
+ 'min sample value' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 341) ifTrue:[
- "max sample value"
+ "max sample value"
"
- 'max sample value' print. value printNewline.
+ 'max sample value' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 512) ifTrue:[
- "jpeg proc"
+ "jpeg proc"
"
- 'jpeg proc' print. value printNewline.
+ 'jpeg proc' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 513) ifTrue:[
- "jpeg proc"
+ "jpeg proc"
"
- 'jpeg proc' print. value printNewline.
+ 'jpeg proc' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32995) ifTrue:[
- "matteing"
+ "matteing"
"
- 'matteing' print. value printNewline.
+ 'matteing' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32996) ifTrue:[
- "datatype"
+ "datatype"
"
- 'datatype' print. value printNewline.
+ 'datatype' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32997) ifTrue:[
- "imagedepth"
+ "imagedepth"
"
- 'imagedepth' print. value printNewline.
+ 'imagedepth' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32998) ifTrue:[
- "tiledepth"
+ "tiledepth"
"
- 'tiledepth' print. value printNewline.
+ 'tiledepth' print. value printNewline.
"
- ^ self
+ ^ self
].
"
@@ -676,15 +676,21 @@
' len:' print. length print. ' offs:' print. offset print.
' val:' print. value print. ' valArr:' print. valueArray printNewline.
"
- 'TIFFReader: unknown tag type ' errorPrint. tagType errorPrintNL
+ 'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
+
+ "Modified: 10.1.1997 / 18:07:34 / cg"
!
readCCITT3RLETiffImageData
- 'TIFFReader: ccitt mod Huffman (rle) compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR.
+
+ "Modified: 10.1.1997 / 18:09:02 / cg"
!
readCCITT3RLEWTiffImageData
- 'TIFFReader: ccitt mod Huffman (rlew) compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: ccitt mod Huffman (rlew) compression not implemented' errorPrintCR.
+
+ "Modified: 10.1.1997 / 18:09:11 / cg"
!
readCCITTGroup3TiffImageData
@@ -699,21 +705,21 @@
nPlanes := samplesPerPixel.
(nPlanes == 2) ifTrue:[
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1
].
(nPlanes ~~ 1) ifTrue:[
- self error:'only monochrome/greyscale supported'.
+ 'TIFFReader [warning]: only monochrome/greyscale supported' errorPrintCR.
^ nil
].
stripByteCounts isNil ifTrue:[
- self error:'currently require stripByteCounts'.
+ 'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
^ nil
].
(rowsPerStrip ~~ 1) isNil ifTrue:[
- self error:'currently require rowsPerStrip to be 1'.
+ 'TIFFReader [warning]: currently require rowsPerStrip to be 1' errorPrintCR.
^ nil
].
@@ -745,11 +751,13 @@
row := row + rowsPerStrip
]
- "Modified: 30.9.1996 / 22:45:14 / cg"
+ "Modified: 10.1.1997 / 18:14:56 / cg"
!
readCCITTGroup4TiffImageData
- 'TIFFReader: ccitt group4 fax compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: ccitt group4 fax compression not implemented' errorPrintNL.
+
+ "Modified: 10.1.1997 / 18:09:14 / cg"
!
readChars:n
@@ -797,7 +805,9 @@
!
readJPEGTiffImageData
- 'TIFFReader: jpeg compression not implemented' errorPrintNL
+ 'TIFFReader [warning]: jpeg compression not implemented' errorPrintNL
+
+ "Modified: 10.1.1997 / 18:09:17 / cg"
!
readLZWTiffImageData
@@ -818,37 +828,31 @@
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'.
+ (((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
].
bytesPerRow := width * samplesPerPixel.
] ifFalse:[
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- self error:'only separate planes supported'.
+ 'TIFFReader [warning]: only separate planes are supported' errorPrintCR.
^ nil
].
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1
].
(nPlanes == 1) ifFalse:[
- self error:'only 3-sample rgb / monochrome supported'.
+ 'TIFFReader [warning]: only 3-sample rgb / monochrome supported' errorPrintCR.
^ nil
].
bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
].
stripByteCounts isNil ifTrue:[
- self error:'currently require stripByteCounts'.
+ 'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
^ nil
].
@@ -884,7 +888,7 @@
self class decodeDelta:3 in:data width:width height:height
]
- "Modified: 30.9.1996 / 22:45:01 / cg"
+ "Modified: 10.1.1997 / 18:13:21 / cg"
!
readLongs:nLongs
@@ -912,18 +916,24 @@
!
readNeXTJPEGTiffImageData
- 'TIFFReader: jpeg compression not implemented' errorPrintNL
+ 'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR
+
+ "Modified: 10.1.1997 / 18:11:04 / cg"
!
readNeXTRLE2TiffImageData
- 'TIFFReader: next 2bit rle compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: next 2bit rle compression not implemented' errorPrintCR.
+
+ "Modified: 10.1.1997 / 18:11:01 / cg"
!
readPackbitsTiffImageData
"had no samples yet - however, packbits decompression
is rather trivial to add ..."
- 'TIFFReader: packbits compression not implemented' errorPrintNL
+ 'TIFFReader [warning]: packbits compression not implemented' errorPrintCR
+
+ "Modified: 10.1.1997 / 18:10:57 / cg"
!
readShorts:nShorts
@@ -971,10 +981,10 @@
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- self error:'with alpha, only separate planes supported'.
+ 'TIFFReader [warning]: with alpha, only separate planes supported' errorPrintCR.
^ nil
].
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1.
bitsPerPixel := bitsPerSample at:1.
bitsPerSample := Array with:bitsPerPixel.
@@ -982,17 +992,17 @@
] ifFalse:[
(nPlanes == 3) ifTrue:[
(planarConfiguration ~~ 1) ifTrue:[
- self error:'only non separate planes supported'.
+ 'TIFFReader [warning]: only non separate planes supported' errorPrintCR.
^ nil
].
bitsPerSample ~= #(8 8 8) ifTrue:[
- self error:'only 8/8/8 rgb images supported'.
+ 'TIFFReader [warning]: only 8/8/8 rgb images supported' errorPrintCR.
^ nil
].
bitsPerPixel := 24
] ifFalse:[
(nPlanes ~~ 1) ifTrue:[
- self error:'format not supported'.
+ 'TIFFReader [warning]: format not supported' errorPrintCR.
^ nil
].
bitsPerPixel := bitsPerSample at:1.
@@ -1026,7 +1036,7 @@
row := row + rowsPerStrip
]
- "Modified: 10.10.1996 / 18:24:05 / cg"
+ "Modified: 10.1.1997 / 18:10:46 / cg"
!
writeBitsPerSample
@@ -1421,7 +1431,7 @@
char1 := aStream next.
char2 := aStream next.
(char1 ~~ char2) ifTrue:[
- 'TIFFReader: not a tiff file' errorPrintNL.
+ 'TIFFReader [warning]: not a tiff file' errorPrintCR.
^ nil
].
(char1 == $I asciiValue) ifTrue:[
@@ -1432,14 +1442,14 @@
byteOrder := #msb.
msb := true.
] ifFalse:[
- 'TIFFReader: not a tiff file' errorPrintNL.
+ 'TIFFReader [warning]: not a tiff file' errorPrintCR.
^ nil
]
].
version := self readShort.
(version ~~ 42) ifTrue:[
- 'TIFFReader: version of tiff-file not supported' errorPrintNL.
+ 'TIFFReader [warning]: version of tiff-file not supported' errorPrintCR.
^ nil
].
@@ -1471,28 +1481,28 @@
offset := aStream nextLongMSB:msb.
(offset ~~ 0) ifTrue:[
- 'TIFFReader: more tags ignored' errorPrintNL
+ 'TIFFReader [info]: more tags ignored' infoPrintCR
].
"check for required tags"
ok := true.
width isNil ifTrue:[
- 'TIFFReader: missing width tag' errorPrintNL.
+ 'TIFFReader [warning]: missing width tag' errorPrintCR.
ok := false
].
height isNil ifTrue:[
- 'TIFFReader: missing length tag' errorPrintNL.
+ 'TIFFReader [warning]: missing length tag' errorPrintCR.
ok := false
].
photometric isNil ifTrue:[
- 'TIFFReader: missing photometric tag' errorPrintNL.
+ 'TIFFReader [warning]: missing photometric tag' errorPrintCR.
ok := false
].
stripOffsets isNil ifTrue:[
- 'TIFFReader: missing stripOffsets tag' errorPrintNL.
+ 'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR.
ok := false
].
@@ -1503,7 +1513,7 @@
].
stripByteCounts isNil ifTrue:[
- 'TIFFReader: missing stripByteCounts tag' errorPrintNL.
+ 'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR.
ok := false
].
@@ -1563,12 +1573,12 @@
ok := true
].
ok ifFalse:[
- 'TIFFReader: compression type ' errorPrint. compression errorPrint.
- ' not known' errorPrintNL
+ 'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
+ ' not known' errorPrintCR
].
^ result
- "Modified: 14.9.1996 / 17:09:07 / cg"
+ "Modified: 10.1.1997 / 18:08:54 / cg"
! !
!TIFFReader methodsFor:'writing to file'!
@@ -1580,8 +1590,8 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'TIFFReader: create error' errorPrintNL.
- ^ nil
+ 'TIFFReader [warning]: create error' errorPrintCR.
+ ^ nil
].
"save as msb"
@@ -1604,9 +1614,9 @@
currentOffset := 0.
(byteOrder == #msb) ifTrue:[
- outStream nextPut:$M. outStream nextPut:$M.
+ outStream nextPut:$M. outStream nextPut:$M.
] ifFalse:[
- outStream nextPut:$I. outStream nextPut:$I.
+ outStream nextPut:$I. outStream nextPut:$I.
].
currentOffset := currentOffset + 2.
@@ -1626,7 +1636,7 @@
self writeStripByteCounts. "this outputs strip bytecounts, sets stripByteCountPos"
self writeBitsPerSample. "this outputs bitsPerSample, sets bitsPerSamplePos"
photometric == #palette ifTrue:[
- self writeColorMap "this outputs colorMap, sets colorMapPos"
+ self writeColorMap "this outputs colorMap, sets colorMapPos"
].
pos := outStream position. "backpatch tag offset"
@@ -1635,14 +1645,14 @@
outStream position:pos.
"
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ',
- (pos printStringRadix:16)) printNewline.
+ (pos printStringRadix:16)) printNewline.
"
"output tag data"
photometric == #palette ifTrue:[
- self writeShort:11. "11 tags"
+ self writeShort:11. "11 tags"
] ifFalse:[
- self writeShort:10. "10 tags"
+ self writeShort:10. "10 tags"
].
self writeTag:256. "image width"
self writeTag:257. "image height"
@@ -1655,15 +1665,17 @@
self writeTag:279. "strip byte counts"
self writeTag:284. "planarconfig"
photometric == #palette ifTrue:[
- self writeTag:320 "colorMap"
+ self writeTag:320 "colorMap"
].
self writeLong:0. "end of tags mark"
outStream close
+
+ "Modified: 10.1.1997 / 18:13:38 / cg"
! !
-!TIFFReader class methodsFor:'documentation'!
+!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.43 1996-10-10 17:24:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.44 1997-01-10 17:32:24 cg Exp $'
! !
TIFFReader initialize!
--- a/TIFFReader.st Fri Jan 10 16:10:28 1997 +0100
+++ b/TIFFReader.st Fri Jan 10 18:32:24 1997 +0100
@@ -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.
@@ -123,552 +123,552 @@
i3 "{ Class: SmallInteger }" |
(numberType == 3) ifTrue:[
- "short"
- valueArray := self readShorts:length.
- value := valueArray at:1
+ "short"
+ valueArray := self readShorts:length.
+ value := valueArray at:1
] ifFalse:[
- (numberType == 4) ifTrue:[
- "integer"
- valueArray := self readLongs:length.
- value := valueArray at:1
- ] ifFalse:[
- (numberType == 2) ifTrue:[
- "character"
- value := self readChars:length
- ] ifFalse:[
- (numberType == 5) ifTrue:[
- "fraction"
- valueArray := self readFracts:length.
- value := valueArray at:1
- ] ifFalse:[
- offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
- ]
- ]
- ]
+ (numberType == 4) ifTrue:[
+ "integer"
+ valueArray := self readLongs:length.
+ value := valueArray at:1
+ ] ifFalse:[
+ (numberType == 2) ifTrue:[
+ "character"
+ value := self readChars:length
+ ] ifFalse:[
+ (numberType == 5) ifTrue:[
+ "fraction"
+ valueArray := self readFracts:length.
+ value := valueArray at:1
+ ] ifFalse:[
+ offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
+ ]
+ ]
+ ]
].
(tagType == 254) ifTrue:[
- "NewSubfileType"
- "newSubFileType := value."
+ "NewSubfileType"
+ "newSubFileType := value."
"
- 'newSubfiletype ' print. value printNewline.
+ 'newSubfiletype ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 255) ifTrue:[
- "SubfileType"
- subFileType := value.
+ "SubfileType"
+ subFileType := value.
"
- 'subfiletype ' print. value printNewline.
+ 'subfiletype ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 256) ifTrue:[
- "ImageWidth"
- width := value.
+ "ImageWidth"
+ width := value.
"
- 'width ' print. width printNewline.
+ 'width ' print. width printNewline.
"
- ^ self
+ ^ self
].
(tagType == 257) ifTrue:[
- "ImageHeight"
- height := value.
+ "ImageHeight"
+ height := value.
"
- 'height ' print. height printNewline.
+ 'height ' print. height printNewline.
"
- ^ self
+ ^ self
].
(tagType == 258) ifTrue:[
- "bitspersample"
- bitsPerSample := valueArray.
+ "bitspersample"
+ bitsPerSample := valueArray.
"
- 'bitspersample ' print. bitsPerSample printNewline.
+ 'bitspersample ' print. bitsPerSample printNewline.
"
- ^ self
+ ^ self
].
(tagType == 259) ifTrue:[
- "compression"
- compression := value.
+ "compression"
+ compression := value.
"
- 'compression ' print. compression printNewline.
+ 'compression ' print. compression printNewline.
"
- ^ self
+ ^ self
].
(tagType == 262) ifTrue:[
- "photometric"
+ "photometric"
- (value == 0) ifTrue:[
- photometric := #whiteIs0
- ] ifFalse:[
- (value == 1) ifTrue:[
- photometric := #blackIs0
- ] ifFalse:[
- (value == 2) ifTrue:[
- photometric := #rgb
- ] ifFalse:[
- (value == 3) ifTrue:[
- photometric := #palette
- ] ifFalse:[
- (value == 4) ifTrue:[
- photometric := #transparency
- ] ifFalse:[
- (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
- ]
- ]
- ]
- ]
- ]
- ]
- ]
- ].
+ (value == 0) ifTrue:[
+ photometric := #whiteIs0
+ ] ifFalse:[
+ (value == 1) ifTrue:[
+ photometric := #blackIs0
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ photometric := #rgb
+ ] ifFalse:[
+ (value == 3) ifTrue:[
+ photometric := #palette
+ ] ifFalse:[
+ (value == 4) ifTrue:[
+ photometric := #transparency
+ ] ifFalse:[
+ (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
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
"
- 'photometric ' print. photometric printNewline.
+ 'photometric ' print. photometric printNewline.
"
- ^ self
+ ^ self
].
(tagType == 263) ifTrue:[
- "Treshholding"
- "threshholding := value."
+ "Treshholding"
+ "threshholding := value."
"
- 'treshholding ' print. value printNewline.
+ 'treshholding ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 264) ifTrue:[
- "CellWidth"
- "cellWidth:= value."
+ "CellWidth"
+ "cellWidth:= value."
"
- 'cellWidth ' print. value printNewline.
+ 'cellWidth ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 265) ifTrue:[
- "CellLength"
- "cellLength:= value."
+ "CellLength"
+ "cellLength:= value."
"
- 'cellLength ' print. value printNewline.
+ 'cellLength ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 266) ifTrue:[
- "fillOrder"
- (value == 1) ifTrue:[
- fillOrder := #msb
- ] ifFalse:[
- (value == 2) ifTrue:[
- fillOrder := #lsb
- ] ifFalse:[
- fillOrder := nil
- ]
- ].
+ "fillOrder"
+ (value == 1) ifTrue:[
+ fillOrder := #msb
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ fillOrder := #lsb
+ ] ifFalse:[
+ fillOrder := nil
+ ]
+ ].
"
- 'fillorder ' print. fillOrder printNewline.
+ 'fillorder ' print. fillOrder printNewline.
"
- ^ self
+ ^ self
].
(tagType == 269) ifTrue:[
- "documentName - info only"
+ "documentName - info only"
"
- 'documentName ' print. value printNewline.
+ 'documentName ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 270) ifTrue:[
- "imageDescription - info only"
+ "imageDescription - info only"
"
- 'imageDescription ' print. value printNewline.
+ 'imageDescription ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 271) ifTrue:[
- "make - info only"
+ "make - info only"
"
- 'make ' print. value printNewline.
+ 'make ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 272) ifTrue:[
- "model - info only"
+ "model - info only"
"
- 'model ' print. value printNewline.
+ 'model ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 273) ifTrue:[
- "stripoffsets"
- stripOffsets := valueArray.
+ "stripoffsets"
+ stripOffsets := valueArray.
"
- 'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
+ 'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
"
- ^ self
+ ^ self
].
(tagType == 274) ifTrue:[
- "Orientation"
- "orientation:= value."
+ "Orientation"
+ "orientation:= value."
"
- 'orientation ' print. value printNewline.
+ 'orientation ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 277) ifTrue:[
- "samplesPerPixel"
- samplesPerPixel := value.
+ "samplesPerPixel"
+ samplesPerPixel := value.
"
- 'samplesperpixel ' print. samplesPerPixel printNewline.
+ 'samplesperpixel ' print. samplesPerPixel printNewline.
"
- ^ self
+ ^ self
].
(tagType == 278) ifTrue:[
- "rowsperstrip"
- rowsPerStrip := value.
+ "rowsperstrip"
+ rowsPerStrip := value.
"
- 'rowsperstrip ' print. rowsPerStrip printNewline.
+ 'rowsperstrip ' print. rowsPerStrip printNewline.
"
- ^ self
+ ^ self
].
(tagType == 279) ifTrue:[
- "stripbytecount"
- stripByteCounts := valueArray.
+ "stripbytecount"
+ stripByteCounts := valueArray.
"
- 'stripByteCounts Array(' print.
- stripByteCounts size print.
- ')' printNewline.
+ 'stripByteCounts Array(' print.
+ stripByteCounts size print.
+ ')' printNewline.
"
- ^ self
+ ^ self
].
(tagType == 280) ifTrue:[
- "MinSampleValue"
- "minSampleValue:= value."
+ "MinSampleValue"
+ "minSampleValue:= value."
"
- 'minSampleValue ' print. value printNewline.
+ 'minSampleValue ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 281) ifTrue:[
- "MaxSampleValue"
- "maxSampleValue:= value."
+ "MaxSampleValue"
+ "maxSampleValue:= value."
"
- 'maxSampleValue ' print. value printNewline.
+ 'maxSampleValue ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 282) ifTrue:[
- "xResolution"
+ "xResolution"
"
- 'xres ' print. value printNewline.
+ 'xres ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 283) ifTrue:[
- "yResolution"
+ "yResolution"
"
- 'yres ' print. value printNewline.
+ 'yres ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 284) ifTrue:[
- "planarconfig"
- (value == 1) ifTrue:[
- planarConfiguration := 1
- ] ifFalse:[
- (value == 2) ifTrue:[
- planarConfiguration := 2
- ] ifFalse:[
- planarConfiguration := nil
- ]
- ].
+ "planarconfig"
+ (value == 1) ifTrue:[
+ planarConfiguration := 1
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ planarConfiguration := 2
+ ] ifFalse:[
+ planarConfiguration := nil
+ ]
+ ].
"
- 'planarconfig ' print. planarConfiguration printNewline.
+ 'planarconfig ' print. planarConfiguration printNewline.
"
- ^ self
+ ^ self
].
(tagType == 285) ifTrue:[
- "pageName"
+ "pageName"
"
- 'pageName ' print. value printNewline.
+ 'pageName ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 286) ifTrue:[
- "xPosition"
+ "xPosition"
"
- 'xPos ' print. value printNewline.
+ 'xPos ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 287) ifTrue:[
- "yPosition"
+ "yPosition"
"
- 'yPos ' print. value printNewline.
+ 'yPos ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 288) ifTrue:[
- "freeOffsets"
+ "freeOffsets"
"
- 'freeOffsets ' print. value printNewline.
+ 'freeOffsets ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 289) ifTrue:[
- "freeByteCounts"
+ "freeByteCounts"
"
- 'freeByteCounts ' print. value printNewline.
+ 'freeByteCounts ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 290) ifTrue:[
- "grayResponceUnit"
+ "grayResponceUnit"
"
- 'grayResponceUnit' print. value printNewline.
+ 'grayResponceUnit' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 291) ifTrue:[
- "grayResponceCurve"
+ "grayResponceCurve"
"
- 'grayResponceCurve' print. value printNewline.
+ 'grayResponceCurve' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 292) ifTrue:[
- "group3options"
- group3options := value.
+ "group3options"
+ group3options := value.
"
- 'group3options ' print. group3options printNewline.
+ 'group3options ' print. group3options printNewline.
"
- ^ self
+ ^ self
].
(tagType == 293) ifTrue:[
- "group4options"
- "group4options := value."
+ "group4options"
+ "group4options := value."
"
- 'group4options ' print. value printNewline.
+ 'group4options ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 296) ifTrue:[
- "resolutionunit"
+ "resolutionunit"
"
- (value == 1) ifTrue:[
- 'res-unit pixel' printNewline
- ] ifFalse:[
- (value == 2) ifTrue:[
- 'res-unit inch' printNewline
- ] ifFalse:[
- (value == 3) ifTrue:[
- 'res-unit mm' printNewline
- ] ifFalse:[
- 'res-unit invalid' printNewline
- ]
- ]
- ].
+ (value == 1) ifTrue:[
+ 'res-unit pixel' printNewline
+ ] ifFalse:[
+ (value == 2) ifTrue:[
+ 'res-unit inch' printNewline
+ ] ifFalse:[
+ (value == 3) ifTrue:[
+ 'res-unit mm' printNewline
+ ] ifFalse:[
+ 'res-unit invalid' printNewline
+ ]
+ ]
+ ].
"
- "resolutionUnit := value."
- ^ self
+ "resolutionUnit := value."
+ ^ self
].
(tagType == 297) ifTrue:[
- "pageNumber"
- "pageNumber := value."
+ "pageNumber"
+ "pageNumber := value."
"
- 'pageNumber ' print. value printNewline.
+ 'pageNumber ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 300) ifTrue:[
- "colorResponceUnit"
+ "colorResponceUnit"
"
- 'colorResponceUnit' print. value printNewline.
+ 'colorResponceUnit' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 301) ifTrue:[
- "colorResponceCurve"
+ "colorResponceCurve"
"
- 'colorResponceCurve' print. value printNewline.
+ 'colorResponceCurve' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 305) ifTrue:[
- "software - info only"
+ "software - info only"
"
- 'software' print. value printNewline.
+ 'software' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 306) ifTrue:[
- "dateTime - info only"
+ "dateTime - info only"
"
- 'dateTime ' print. value printNewline.
+ 'dateTime ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 315) ifTrue:[
- "artist - info only"
+ "artist - info only"
"
- 'artist ' print. value printNewline.
+ 'artist ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 316) ifTrue:[
- "host computer - info only"
+ "host computer - info only"
"
- 'host ' print. value printNewline.
+ 'host ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 317) ifTrue:[
- "predictor"
- predictor := value.
+ "predictor"
+ predictor := value.
"
- 'predictor ' print. predictor printNewline.
+ 'predictor ' print. predictor printNewline.
"
- ^ self
+ ^ self
].
(tagType == 318) ifTrue:[
- "whitePoint"
+ "whitePoint"
"
- 'whitePoint ' print. value printNewline.
+ 'whitePoint ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 319) ifTrue:[
- "primaryChromatics"
+ "primaryChromatics"
"
- 'primaryChromatics ' print. value printNewline.
+ 'primaryChromatics ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 320) ifTrue:[
- "colorMap"
+ "colorMap"
"
- 'colorMap (size=' print. valueArray size print. ')' printNewline.
+ 'colorMap (size=' print. valueArray size print. ')' printNewline.
"
- "
- the tiff colormap contains 16bit values;
- our colormap expects 8bit values
- "
- n := valueArray size // 3.
+ "
+ the tiff colormap contains 16bit values;
+ our colormap expects 8bit values
+ "
+ n := valueArray size // 3.
- rV := ByteArray uninitializedNew:n.
- gV := ByteArray uninitializedNew:n.
- bV := ByteArray uninitializedNew:n.
- scaleFactor := 255.0 / 16rFFFF.
- i2 := n+1.
- i3 := 2*n+1.
- 1 to:n do:[:vi |
- val := ((valueArray at:vi) * scaleFactor) rounded.
- rV at:vi put:val.
- val := ((valueArray at:i2) * scaleFactor) rounded.
- gV at:vi put:val.
- val := ((valueArray at:i3) * scaleFactor) rounded.
- bV at:vi put:val.
- i2 := i2 + 1.
- i3 := i3 + 1.
- ].
- colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
- ^ self
+ rV := ByteArray uninitializedNew:n.
+ gV := ByteArray uninitializedNew:n.
+ bV := ByteArray uninitializedNew:n.
+ scaleFactor := 255.0 / 16rFFFF.
+ i2 := n+1.
+ i3 := 2*n+1.
+ 1 to:n do:[:vi |
+ val := ((valueArray at:vi) * scaleFactor) rounded.
+ rV at:vi put:val.
+ val := ((valueArray at:i2) * scaleFactor) rounded.
+ gV at:vi put:val.
+ val := ((valueArray at:i3) * scaleFactor) rounded.
+ bV at:vi put:val.
+ i2 := i2 + 1.
+ i3 := i3 + 1.
+ ].
+ colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
+ ^ self
].
(tagType == 332) ifTrue:[
- "ink set"
+ "ink set"
"
- 'ink set' print. value printNewline.
+ 'ink set' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 333) ifTrue:[
- "ink names"
+ "ink names"
"
- 'ink names' print. value printNewline.
+ 'ink names' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 336) ifTrue:[
- "dot range"
+ "dot range"
"
- 'dot range' print. value printNewline.
+ 'dot range' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 337) ifTrue:[
- "target printer"
+ "target printer"
"
- 'target printer' print. value printNewline.
+ 'target printer' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 339) ifTrue:[
- "sample format"
+ "sample format"
"
- 'sample format' print. value printNewline.
+ 'sample format' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 340) ifTrue:[
- "min sample value"
+ "min sample value"
"
- 'min sample value' print. value printNewline.
+ 'min sample value' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 341) ifTrue:[
- "max sample value"
+ "max sample value"
"
- 'max sample value' print. value printNewline.
+ 'max sample value' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 512) ifTrue:[
- "jpeg proc"
+ "jpeg proc"
"
- 'jpeg proc' print. value printNewline.
+ 'jpeg proc' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 513) ifTrue:[
- "jpeg proc"
+ "jpeg proc"
"
- 'jpeg proc' print. value printNewline.
+ 'jpeg proc' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32995) ifTrue:[
- "matteing"
+ "matteing"
"
- 'matteing' print. value printNewline.
+ 'matteing' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32996) ifTrue:[
- "datatype"
+ "datatype"
"
- 'datatype' print. value printNewline.
+ 'datatype' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32997) ifTrue:[
- "imagedepth"
+ "imagedepth"
"
- 'imagedepth' print. value printNewline.
+ 'imagedepth' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 32998) ifTrue:[
- "tiledepth"
+ "tiledepth"
"
- 'tiledepth' print. value printNewline.
+ 'tiledepth' print. value printNewline.
"
- ^ self
+ ^ self
].
"
@@ -676,15 +676,21 @@
' len:' print. length print. ' offs:' print. offset print.
' val:' print. value print. ' valArr:' print. valueArray printNewline.
"
- 'TIFFReader: unknown tag type ' errorPrint. tagType errorPrintNL
+ 'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
+
+ "Modified: 10.1.1997 / 18:07:34 / cg"
!
readCCITT3RLETiffImageData
- 'TIFFReader: ccitt mod Huffman (rle) compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR.
+
+ "Modified: 10.1.1997 / 18:09:02 / cg"
!
readCCITT3RLEWTiffImageData
- 'TIFFReader: ccitt mod Huffman (rlew) compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: ccitt mod Huffman (rlew) compression not implemented' errorPrintCR.
+
+ "Modified: 10.1.1997 / 18:09:11 / cg"
!
readCCITTGroup3TiffImageData
@@ -699,21 +705,21 @@
nPlanes := samplesPerPixel.
(nPlanes == 2) ifTrue:[
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1
].
(nPlanes ~~ 1) ifTrue:[
- self error:'only monochrome/greyscale supported'.
+ 'TIFFReader [warning]: only monochrome/greyscale supported' errorPrintCR.
^ nil
].
stripByteCounts isNil ifTrue:[
- self error:'currently require stripByteCounts'.
+ 'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
^ nil
].
(rowsPerStrip ~~ 1) isNil ifTrue:[
- self error:'currently require rowsPerStrip to be 1'.
+ 'TIFFReader [warning]: currently require rowsPerStrip to be 1' errorPrintCR.
^ nil
].
@@ -745,11 +751,13 @@
row := row + rowsPerStrip
]
- "Modified: 30.9.1996 / 22:45:14 / cg"
+ "Modified: 10.1.1997 / 18:14:56 / cg"
!
readCCITTGroup4TiffImageData
- 'TIFFReader: ccitt group4 fax compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: ccitt group4 fax compression not implemented' errorPrintNL.
+
+ "Modified: 10.1.1997 / 18:09:14 / cg"
!
readChars:n
@@ -797,7 +805,9 @@
!
readJPEGTiffImageData
- 'TIFFReader: jpeg compression not implemented' errorPrintNL
+ 'TIFFReader [warning]: jpeg compression not implemented' errorPrintNL
+
+ "Modified: 10.1.1997 / 18:09:17 / cg"
!
readLZWTiffImageData
@@ -818,37 +828,31 @@
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'.
+ (((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
].
bytesPerRow := width * samplesPerPixel.
] ifFalse:[
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- self error:'only separate planes supported'.
+ 'TIFFReader [warning]: only separate planes are supported' errorPrintCR.
^ nil
].
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1
].
(nPlanes == 1) ifFalse:[
- self error:'only 3-sample rgb / monochrome supported'.
+ 'TIFFReader [warning]: only 3-sample rgb / monochrome supported' errorPrintCR.
^ nil
].
bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
].
stripByteCounts isNil ifTrue:[
- self error:'currently require stripByteCounts'.
+ 'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
^ nil
].
@@ -884,7 +888,7 @@
self class decodeDelta:3 in:data width:width height:height
]
- "Modified: 30.9.1996 / 22:45:01 / cg"
+ "Modified: 10.1.1997 / 18:13:21 / cg"
!
readLongs:nLongs
@@ -912,18 +916,24 @@
!
readNeXTJPEGTiffImageData
- 'TIFFReader: jpeg compression not implemented' errorPrintNL
+ 'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR
+
+ "Modified: 10.1.1997 / 18:11:04 / cg"
!
readNeXTRLE2TiffImageData
- 'TIFFReader: next 2bit rle compression not implemented' errorPrintNL.
+ 'TIFFReader [warning]: next 2bit rle compression not implemented' errorPrintCR.
+
+ "Modified: 10.1.1997 / 18:11:01 / cg"
!
readPackbitsTiffImageData
"had no samples yet - however, packbits decompression
is rather trivial to add ..."
- 'TIFFReader: packbits compression not implemented' errorPrintNL
+ 'TIFFReader [warning]: packbits compression not implemented' errorPrintCR
+
+ "Modified: 10.1.1997 / 18:10:57 / cg"
!
readShorts:nShorts
@@ -971,10 +981,10 @@
(nPlanes == 2) ifTrue:[
(planarConfiguration ~~ 2) ifTrue:[
- self error:'with alpha, only separate planes supported'.
+ 'TIFFReader [warning]: with alpha, only separate planes supported' errorPrintCR.
^ nil
].
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
nPlanes := 1.
bitsPerPixel := bitsPerSample at:1.
bitsPerSample := Array with:bitsPerPixel.
@@ -982,17 +992,17 @@
] ifFalse:[
(nPlanes == 3) ifTrue:[
(planarConfiguration ~~ 1) ifTrue:[
- self error:'only non separate planes supported'.
+ 'TIFFReader [warning]: only non separate planes supported' errorPrintCR.
^ nil
].
bitsPerSample ~= #(8 8 8) ifTrue:[
- self error:'only 8/8/8 rgb images supported'.
+ 'TIFFReader [warning]: only 8/8/8 rgb images supported' errorPrintCR.
^ nil
].
bitsPerPixel := 24
] ifFalse:[
(nPlanes ~~ 1) ifTrue:[
- self error:'format not supported'.
+ 'TIFFReader [warning]: format not supported' errorPrintCR.
^ nil
].
bitsPerPixel := bitsPerSample at:1.
@@ -1026,7 +1036,7 @@
row := row + rowsPerStrip
]
- "Modified: 10.10.1996 / 18:24:05 / cg"
+ "Modified: 10.1.1997 / 18:10:46 / cg"
!
writeBitsPerSample
@@ -1421,7 +1431,7 @@
char1 := aStream next.
char2 := aStream next.
(char1 ~~ char2) ifTrue:[
- 'TIFFReader: not a tiff file' errorPrintNL.
+ 'TIFFReader [warning]: not a tiff file' errorPrintCR.
^ nil
].
(char1 == $I asciiValue) ifTrue:[
@@ -1432,14 +1442,14 @@
byteOrder := #msb.
msb := true.
] ifFalse:[
- 'TIFFReader: not a tiff file' errorPrintNL.
+ 'TIFFReader [warning]: not a tiff file' errorPrintCR.
^ nil
]
].
version := self readShort.
(version ~~ 42) ifTrue:[
- 'TIFFReader: version of tiff-file not supported' errorPrintNL.
+ 'TIFFReader [warning]: version of tiff-file not supported' errorPrintCR.
^ nil
].
@@ -1471,28 +1481,28 @@
offset := aStream nextLongMSB:msb.
(offset ~~ 0) ifTrue:[
- 'TIFFReader: more tags ignored' errorPrintNL
+ 'TIFFReader [info]: more tags ignored' infoPrintCR
].
"check for required tags"
ok := true.
width isNil ifTrue:[
- 'TIFFReader: missing width tag' errorPrintNL.
+ 'TIFFReader [warning]: missing width tag' errorPrintCR.
ok := false
].
height isNil ifTrue:[
- 'TIFFReader: missing length tag' errorPrintNL.
+ 'TIFFReader [warning]: missing length tag' errorPrintCR.
ok := false
].
photometric isNil ifTrue:[
- 'TIFFReader: missing photometric tag' errorPrintNL.
+ 'TIFFReader [warning]: missing photometric tag' errorPrintCR.
ok := false
].
stripOffsets isNil ifTrue:[
- 'TIFFReader: missing stripOffsets tag' errorPrintNL.
+ 'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR.
ok := false
].
@@ -1503,7 +1513,7 @@
].
stripByteCounts isNil ifTrue:[
- 'TIFFReader: missing stripByteCounts tag' errorPrintNL.
+ 'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR.
ok := false
].
@@ -1563,12 +1573,12 @@
ok := true
].
ok ifFalse:[
- 'TIFFReader: compression type ' errorPrint. compression errorPrint.
- ' not known' errorPrintNL
+ 'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
+ ' not known' errorPrintCR
].
^ result
- "Modified: 14.9.1996 / 17:09:07 / cg"
+ "Modified: 10.1.1997 / 18:08:54 / cg"
! !
!TIFFReader methodsFor:'writing to file'!
@@ -1580,8 +1590,8 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'TIFFReader: create error' errorPrintNL.
- ^ nil
+ 'TIFFReader [warning]: create error' errorPrintCR.
+ ^ nil
].
"save as msb"
@@ -1604,9 +1614,9 @@
currentOffset := 0.
(byteOrder == #msb) ifTrue:[
- outStream nextPut:$M. outStream nextPut:$M.
+ outStream nextPut:$M. outStream nextPut:$M.
] ifFalse:[
- outStream nextPut:$I. outStream nextPut:$I.
+ outStream nextPut:$I. outStream nextPut:$I.
].
currentOffset := currentOffset + 2.
@@ -1626,7 +1636,7 @@
self writeStripByteCounts. "this outputs strip bytecounts, sets stripByteCountPos"
self writeBitsPerSample. "this outputs bitsPerSample, sets bitsPerSamplePos"
photometric == #palette ifTrue:[
- self writeColorMap "this outputs colorMap, sets colorMapPos"
+ self writeColorMap "this outputs colorMap, sets colorMapPos"
].
pos := outStream position. "backpatch tag offset"
@@ -1635,14 +1645,14 @@
outStream position:pos.
"
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ',
- (pos printStringRadix:16)) printNewline.
+ (pos printStringRadix:16)) printNewline.
"
"output tag data"
photometric == #palette ifTrue:[
- self writeShort:11. "11 tags"
+ self writeShort:11. "11 tags"
] ifFalse:[
- self writeShort:10. "10 tags"
+ self writeShort:10. "10 tags"
].
self writeTag:256. "image width"
self writeTag:257. "image height"
@@ -1655,15 +1665,17 @@
self writeTag:279. "strip byte counts"
self writeTag:284. "planarconfig"
photometric == #palette ifTrue:[
- self writeTag:320 "colorMap"
+ self writeTag:320 "colorMap"
].
self writeLong:0. "end of tags mark"
outStream close
+
+ "Modified: 10.1.1997 / 18:13:38 / cg"
! !
-!TIFFReader class methodsFor:'documentation'!
+!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.43 1996-10-10 17:24:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.44 1997-01-10 17:32:24 cg Exp $'
! !
TIFFReader initialize!
--- a/XBMReader.st Fri Jan 10 16:10:28 1997 +0100
+++ b/XBMReader.st Fri Jan 10 18:32:24 1997 +0100
@@ -128,7 +128,7 @@
line := aStream nextLine.
line isNil ifTrue:[
- 'XBMReader: short file' errorPrintNL.
+ 'XBMReader [warning]: short file' errorPrintCR.
^ nil
].
@@ -137,18 +137,18 @@
].
(line startsWith:'#define') ifFalse:[
- 'XBMReader: format error (expected #define)' errorPrintNL.
+ 'XBMReader [warning]: format error (expected #define)' errorPrintCR.
^ nil
].
index := line indexOf:(Character space).
index := line indexOf:(Character space) startingAt:(index + 1).
(index == 0) ifTrue:[
- 'XBMReader: format error' errorPrintNL.
+ 'XBMReader [warning]: format error' errorPrintCR.
^ nil
].
((line copyTo:index - 1) endsWith:'width') ifFalse:[
- 'XBMReader: format error (expected width)' errorPrintNL.
+ 'XBMReader [warning]: format error (expected width)' errorPrintCR.
^ nil
].
line := line copyFrom:(index + 1).
@@ -158,11 +158,11 @@
index := line indexOf:(Character space).
index := line indexOf:(Character space) startingAt:(index + 1).
(index == 0) ifTrue:[
- 'XBMReader: format error' errorPrintNL.
+ 'XBMReader [warning]: format error' errorPrintCR.
^ nil
].
((line copyTo:index - 1) endsWith:'height') ifFalse:[
- 'XBMReader: format error (expected height)' errorPrintNL.
+ 'XBMReader [warning]: format error (expected height)' errorPrintCR.
^ nil
].
line := line copyFrom:(index + 1).
@@ -212,7 +212,7 @@
XBMReader fromFile:'bitmaps/globe1.xbm'
"
- "Modified: 23.4.1996 / 12:38:05 / cg"
+ "Modified: 10.1.1997 / 18:16:34 / cg"
! !
!XBMReader methodsFor:'writing to file'!
@@ -233,7 +233,7 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'XBMReader: create error' errorPrintNL.
+ 'XBMReader [error]: create error' errorPrintCR.
^ nil
].
@@ -287,12 +287,12 @@
XBMReader save:(Image fromFile:'bitmaps/hello_world.icon') onFile:'test.xbm'
"
- "Modified: 20.5.1996 / 11:54:23 / cg"
+ "Modified: 10.1.1997 / 18:16:47 / cg"
! !
!XBMReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/XBMReader.st,v 1.27 1996-05-20 09:55:16 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/XBMReader.st,v 1.28 1997-01-10 17:31:43 cg Exp $'
! !
XBMReader initialize!