--- a/TIFFReader.st Mon Oct 10 03:32:51 1994 +0100
+++ b/TIFFReader.st Mon Oct 10 03:34:22 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1991 by Claus Gittinger
- All Rights Reserved
+ 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
@@ -11,23 +11,23 @@
"
ImageReader subclass:#TIFFReader
- instanceVariableNames:'planarConfiguration
- subFileType stripOffsets rowsPerStrip
- fillOrder compression group3options predictor
- stripByteCounts
- currentOffset
- stripOffsetsPos stripByteCountsPos bitsPerSamplePos
- colorMapPos'
- classVariableNames:''
- poolDictionaries:''
- category:'Graphics-Support'
+ instanceVariableNames:'planarConfiguration
+ subFileType stripOffsets rowsPerStrip
+ fillOrder compression group3options predictor
+ stripByteCounts
+ currentOffset
+ stripOffsetsPos stripByteCountsPos bitsPerSamplePos
+ colorMapPos'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Graphics-Support'
!
TIFFReader comment:'
COPYRIGHT (c) 1991 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.10 1994-08-22 13:15:34 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.11 1994-10-10 02:33:22 claus Exp $
'!
!TIFFReader class methodsFor:'documentation'!
@@ -35,7 +35,7 @@
copyright
"
COPYRIGHT (c) 1991 by Claus Gittinger
- All Rights Reserved
+ 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
@@ -48,7 +48,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.10 1994-08-22 13:15:34 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.11 1994-10-10 02:33:22 claus Exp $
"
!
@@ -71,6 +71,14 @@
"
! !
+!TIFFReader class methodsFor:'initialization'!
+
+initialize
+ Image fileFormats at:'.tiff' put:self.
+ Image fileFormats at:'.tif' put:self.
+ Image fileFormats at:'.TIF' put:self.
+! !
+
!TIFFReader class methodsFor:'testing'!
isValidImageFile:aFileName
@@ -85,8 +93,8 @@
char2 := inStream next.
((char1 ~~ char2) or:[(char1 ~~ $I) and:[char1 ~~ $M]]) ifTrue:[
- inStream close.
- ^ false
+ inStream close.
+ ^ false
].
inStream binary.
@@ -115,29 +123,29 @@
char1 := inStream next.
char2 := inStream next.
(char1 ~~ char2) ifTrue:[
- 'TIFFReader: not a tiff file' errorPrintNL.
- inStream close.
- ^ nil
+ 'TIFFReader: not a tiff file' errorPrintNL.
+ inStream close.
+ ^ nil
].
(char1 == $I) ifTrue:[
- byteOrder := #lsb
+ byteOrder := #lsb
] ifFalse:[
- (char1 == $M) ifTrue:[
- byteOrder := #msb
- ] ifFalse:[
- 'TIFFReader: not a tiff file' errorPrintNL.
- inStream close.
- ^ nil
- ]
+ (char1 == $M) ifTrue:[
+ byteOrder := #msb
+ ] ifFalse:[
+ 'TIFFReader: not a tiff file' errorPrintNL.
+ inStream close.
+ ^ nil
+ ]
].
inStream binary.
version := self readShort.
(version ~~ 42) ifTrue:[
- 'TIFFReader: version of tiff-file not supported' errorPrintNL.
- inStream close.
- ^ nil
+ 'TIFFReader: version of tiff-file not supported' errorPrintNL.
+ inStream close.
+ ^ nil
].
"setup default values"
@@ -160,79 +168,79 @@
numberOfTags := self readShort.
1 to:numberOfTags do:[:index |
- tagType := self readShort.
- numberType := self readShort.
- length := self readLong.
- self decodeTiffTag:tagType numberType:numberType length:length
+ tagType := self readShort.
+ numberType := self readShort.
+ length := self readLong.
+ self decodeTiffTag:tagType numberType:numberType length:length
].
offset := self readLong.
(offset ~~ 0) ifTrue:[
- 'TIFFReader: more tags ignored' errorPrintNL
+ 'TIFFReader: more tags ignored' errorPrintNL
].
"check for required tags"
ok := true.
width isNil ifTrue:[
- 'TIFFReader: missing width tag' errorPrintNL.
- ok := false
+ 'TIFFReader: missing width tag' errorPrintNL.
+ ok := false
].
height isNil ifTrue:[
- 'TIFFReader: missing length tag' errorPrintNL.
- ok := false
+ 'TIFFReader: missing length tag' errorPrintNL.
+ ok := false
].
photometric isNil ifTrue:[
- 'TIFFReader: missing photometric tag' errorPrintNL.
- ok := false
+ 'TIFFReader: missing photometric tag' errorPrintNL.
+ ok := false
].
stripOffsets isNil ifTrue:[
- 'TIFFReader: missing stripOffsets tag' errorPrintNL.
- ok := false
+ 'TIFFReader: missing stripOffsets tag' errorPrintNL.
+ ok := false
].
ok ifFalse:[
- inStream close.
- ^ nil
+ inStream close.
+ ^ nil
].
"given all the information, read the bits"
rowsPerStrip isNil ifTrue:[
- rowsPerStrip := height
+ rowsPerStrip := height
].
(compression == 1) ifTrue:[
result := self readUncompressedTiffImageData
] ifFalse:[
(compression == 5) ifTrue:[
- result := self readLZWTiffImageData
+ 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
- ]
- ]
- ]
- ]
- ]
+ (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
+ ]
+ ]
+ ]
+ ]
+ ]
]
].
@@ -249,8 +257,8 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'TIFFReader: create error' errorPrintNL.
- ^ nil
+ 'TIFFReader: create error' errorPrintNL.
+ ^ nil
].
"save as msb"
@@ -274,11 +282,11 @@
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.
@@ -298,7 +306,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"
@@ -307,14 +315,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:10. "10 tags"
+ self writeShort:10. "10 tags"
] ifFalse:[
- self writeShort:9. "9 tags"
+ self writeShort:9. "9 tags"
].
self writeTag:256. "image width"
self writeTag:257. "image height"
@@ -322,11 +330,11 @@
self writeTag:259. "compression"
self writeTag:262. "photometric"
self writeTag:273. "strip offsets"
+ self writeTag:278. "rowsPerStrip"
self writeTag:279. "strip byte counts"
self writeTag:284. "planarconfig"
- self writeTag:278. "rowsPerStrip"
photometric == #palette ifTrue:[
- self writeTag:320 "colorMap"
+ self writeTag:320 "colorMap"
].
self writeLong:0. "end of tags mark"
outStream close
@@ -339,22 +347,22 @@
values := Array new:n.
(n == 1) ifTrue:[
- values at:1 put:self readLong.
+ values at:1 put:self readLong.
] ifFalse:[
- offset := self readLong.
- oldPos := inStream position.
- inStream position:(offset + 1).
- 1 to:n do:[:index |
- values at:index put:self readLong
- ].
- inStream position:oldPos
+ offset := self readLong.
+ oldPos := inStream position.
+ inStream position:(offset + 1).
+ 1 to:n do:[:index |
+ values at:index put:self readLong
+ ].
+ inStream position:oldPos
].
^ values
!
writeLongs:longs
1 to:longs size do:[:l |
- self writeLong:l
+ self writeLong:l
]
!
@@ -363,20 +371,20 @@
values := Array new:n.
(n <= 2) ifTrue:[
- values at:1 put:self readShort.
- (n == 2) ifTrue:[
- values at:2 put:self readShort
- ] ifFalse:[
- self readShort
- ]
+ values at:1 put:self readShort.
+ (n == 2) ifTrue:[
+ values at:2 put:self readShort
+ ] ifFalse:[
+ self readShort
+ ]
] ifFalse:[
- offset := self readLong.
- oldPos := inStream position.
- inStream position:(offset + 1).
- 1 to:n do:[:index |
- values at:index put:self readShort
- ].
- inStream position:oldPos
+ offset := self readLong.
+ oldPos := inStream position.
+ inStream position:(offset + 1).
+ 1 to:n do:[:index |
+ values at:index put:self readShort
+ ].
+ inStream position:oldPos
].
^ values
!
@@ -386,13 +394,13 @@
string := String new:(n - 1).
(n <= 4) ifTrue:[
- inStream nextBytes:(n - 1) into:string
+ inStream nextBytes:(n - 1) into:string
] ifFalse:[
- offset := self readLong.
- oldPos := inStream position.
- inStream position:(offset + 1).
- inStream nextBytes:(n - 1) into:string.
- inStream position:oldPos
+ offset := self readLong.
+ oldPos := inStream position.
+ inStream position:(offset + 1).
+ inStream nextBytes:(n - 1) into:string.
+ inStream position:oldPos
].
^ string
!
@@ -405,9 +413,9 @@
oldPos := inStream position.
inStream position:(offset + 1).
1 to:cnt do:[:index |
- n := self readLong.
- d := self readLong.
- values at:index put:(Fraction numerator:n denominator:d)
+ n := self readLong.
+ d := self readLong.
+ values at:index put:(Fraction numerator:n denominator:d)
].
inStream position:oldPos.
^ values
@@ -415,413 +423,416 @@
decodeTiffTag:tagType numberType:numberType length:length
|offset value valueArray
- val
+ val map scaleFactor
n "{ 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 := self readLong
- ]
- ]
- ]
+ (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 := self readLong
+ ]
+ ]
+ ]
].
(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"
- (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:[
- photometric := nil
- ]
- ]
- ]
- ]
- ].
+ "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:[
+ 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"
+ "documentName"
"
- 'documentName ' print. value printNewline.
+ 'documentName ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 270) ifTrue:[
- "imageDescription"
+ "imageDescription"
"
- 'imageDescription ' print. value printNewline.
+ 'imageDescription ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 271) ifTrue:[
- "make"
+ "make"
"
- 'make ' print. value printNewline.
+ 'make ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 272) ifTrue:[
- "model"
+ "model"
"
- '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 == 306) ifTrue:[
- "dateTime"
+ "dateTime"
"
- 'dateTime ' print. value printNewline.
+ 'dateTime ' print. value printNewline.
"
- ^ self
+ ^ self
].
(tagType == 315) ifTrue:[
- "artist"
+ "artist"
"
- 'artist ' print. value printNewline.
+ 'artist ' 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 == 320) ifTrue:[
- "colorMap"
+ "colorMap"
"
- 'colorMap (size=' print. valueArray size print. ')' printNewline.
+ 'colorMap (size=' print. valueArray size print. ')' printNewline.
"
- n := valueArray size // 3.
- colorMap := Array new:3.
- colorMap at:1 put:(valueArray copyFrom:1 to:n).
- colorMap at:2 put:(valueArray copyFrom:n+1 to:2*n).
- colorMap at:3 put:(valueArray copyFrom:2*n+1 to:3*n).
- 1 to:3 do:[:c |
- 1 to:n do:[:e |
- val := (colorMap at:c) at:e.
- val := (val * 255.0 / 16rFFFF) rounded.
- (colorMap at:c) at:e put:val
- ]
- ].
- ^ self
+ n := valueArray size // 3.
+ colorMap := Array new:3.
+ colorMap at:1 put:(valueArray copyFrom:1 to:n).
+ colorMap at:2 put:(valueArray copyFrom:n+1 to:2*n).
+ colorMap at:3 put:(valueArray copyFrom:2*n+1 to:3*n).
+
+ scaleFactor := 255.0 / 16rFFFF.
+ 1 to:3 do:[:c |
+ map := colorMap at:c.
+ 1 to:n do:[:e |
+ val := map at:e.
+ val := (val * scaleFactor) rounded.
+ map at:e put:val
+ ]
+ ].
+ ^ self
].
"
@@ -839,22 +850,22 @@
nBytes := data size.
nBytes < 16rFFFF ifTrue:[
- stripOffsets := Array with:(outStream position - 1).
- stripByteCounts := Array with:nBytes.
- outStream nextPutBytes:nBytes from:data.
- rowsPerStrip := height
+ stripOffsets := Array with:(outStream position - 1).
+ stripByteCounts := Array with:nBytes.
+ outStream nextPutBytes:nBytes from:data.
+ rowsPerStrip := height
] ifFalse:[
- stripOffsets := Array new:height.
- bytesPerRow := nBytes // height.
- stripByteCounts := Array new:height withAll:bytesPerRow.
+ stripOffsets := Array new:height.
+ bytesPerRow := nBytes // height.
+ stripByteCounts := Array new:height withAll:bytesPerRow.
- offs := 1.
- 1 to:height do:[:row |
- stripOffsets at:row put:(outStream position - 1).
- outStream nextPutBytes:bytesPerRow from:data startingAt:offs.
- offs := offs + bytesPerRow
- ].
- rowsPerStrip := 1
+ offs := 1.
+ 1 to:height do:[:row |
+ stripOffsets at:row put:(outStream position - 1).
+ outStream nextPutBytes:bytesPerRow from:data startingAt:offs.
+ offs := offs + bytesPerRow
+ ].
+ rowsPerStrip := 1
].
"
'stripOffsets: ' print. stripOffsets printNewline.
@@ -863,17 +874,28 @@
!
writeColorMap
+ |n|
+
colorMapPos := outStream position.
colorMap do:[:subMap |
- subMap do:[:entry |
- "my maps are 8 bit - tiff map is 16 bit"
- entry isNil ifTrue:[
- "unused map entry"
- self writeShort:0
- ] ifFalse:[
- self writeShort:(entry / 255 * 16rFFFF) rounded
- ]
- ]
+ n := 0.
+ subMap do:[:entry |
+ "my maps are 8 bit - tiff map is 16 bit"
+ entry isNil ifTrue:[
+ "unused map entry"
+ self writeShort:0
+ ] ifFalse:[
+ self writeShort:(entry / 255 * 16rFFFF) rounded
+ ].
+ n := n + 1
+ ].
+ "
+ fill to 256 entries
+ "
+ [n < 256] whileTrue:[
+ self writeShort:0.
+ n := n + 1.
+ ]
]
!
@@ -884,7 +906,7 @@
"
stripOffsetsPos := outStream position.
stripOffsets do:[:o |
- self writeLong:o
+ self writeLong:o
]
!
@@ -895,7 +917,7 @@
"
stripByteCountsPos := outStream position.
stripByteCounts do:[:c |
- self writeShort:c
+ self writeShort:c
]
!
@@ -906,7 +928,7 @@
"
bitsPerSamplePos := outStream position.
bitsPerSample do:[:n |
- self writeShort:n
+ self writeShort:n
]
!
@@ -920,61 +942,61 @@
count := 1.
address := nil.
(tagType == 253) ifTrue:[
- "tiff class"
+ "tiff class"
].
(tagType == 254) ifTrue:[
].
(tagType == 255) ifTrue:[
- "SubfileType"
- value := subFileType.
- numberType := #long.
+ "SubfileType"
+ value := subFileType.
+ numberType := #long.
].
(tagType == 256) ifTrue:[
- "ImageWidth"
- value := width.
- numberType := #short.
+ "ImageWidth"
+ value := width.
+ numberType := #short.
].
(tagType == 257) ifTrue:[
- "ImageHeight"
- value := height.
- numberType := #short.
+ "ImageHeight"
+ value := height.
+ numberType := #short.
].
(tagType == 258) ifTrue:[
- "bitspersample"
- address := bitsPerSamplePos - 1.
- numberType := #short.
- count := bitsPerSample size.
- valueArray := bitsPerSample
+ "bitspersample"
+ address := bitsPerSamplePos - 1.
+ numberType := #short.
+ count := bitsPerSample size.
+ valueArray := bitsPerSample
].
(tagType == 259) ifTrue:[
- "compression"
- value := compression.
- numberType := #short.
+ "compression"
+ value := compression.
+ numberType := #short.
].
(tagType == 262) ifTrue:[
- "photometric"
- (photometric == #whiteIs0) ifTrue:[
- value := 0
- ] ifFalse:[
- (photometric == #blackIs0) ifTrue:[
- value := 1
- ] ifFalse:[
- (photometric == #rgb) ifTrue:[
- value := 2
- ] ifFalse:[
- (photometric == #palette) ifTrue:[
- value := 3
- ] ifFalse:[
- (photometric == #transparency) ifTrue:[
- value := 4
- ] ifFalse:[
- self error:'bad photometric'
- ]
- ]
- ]
- ]
- ].
- numberType := #short.
+ "photometric"
+ (photometric == #whiteIs0) ifTrue:[
+ value := 0
+ ] ifFalse:[
+ (photometric == #blackIs0) ifTrue:[
+ value := 1
+ ] ifFalse:[
+ (photometric == #rgb) ifTrue:[
+ value := 2
+ ] ifFalse:[
+ (photometric == #palette) ifTrue:[
+ value := 3
+ ] ifFalse:[
+ (photometric == #transparency) ifTrue:[
+ value := 4
+ ] ifFalse:[
+ self error:'bad photometric'
+ ]
+ ]
+ ]
+ ]
+ ].
+ numberType := #short.
].
(tagType == 263) ifTrue:[
].
@@ -983,17 +1005,17 @@
(tagType == 265) ifTrue:[
].
(tagType == 266) ifTrue:[
- "fillOrder"
- (fillOrder == #msb) ifTrue:[
- value := 1
- ] ifFalse:[
- (fillOrder == #lsb) ifTrue:[
- value := 2
- ] ifFalse:[
- self error:'bad fillOrder'
- ]
- ].
- numberType := #short.
+ "fillOrder"
+ (fillOrder == #msb) ifTrue:[
+ value := 1
+ ] ifFalse:[
+ (fillOrder == #lsb) ifTrue:[
+ value := 2
+ ] ifFalse:[
+ self error:'bad fillOrder'
+ ]
+ ].
+ numberType := #short.
].
(tagType == 269) ifTrue:[
].
@@ -1004,109 +1026,109 @@
(tagType == 272) ifTrue:[
].
(tagType == 273) ifTrue:[
- "stripoffsets"
- address := stripOffsetsPos - 1.
- numberType := #long.
- count := stripOffsets size.
- valueArray := stripOffsets
+ "stripoffsets"
+ address := stripOffsetsPos - 1.
+ numberType := #long.
+ count := stripOffsets size.
+ valueArray := stripOffsets
].
(tagType == 274) ifTrue:[
].
(tagType == 277) ifTrue:[
- "samplesPerPixel"
- value := samplesPerPixel.
- numberType := #short.
+ "samplesPerPixel"
+ value := samplesPerPixel.
+ numberType := #short.
].
(tagType == 278) ifTrue:[
- "rowsperstrip"
- value := rowsPerStrip.
- numberType := #short.
+ "rowsperstrip"
+ value := rowsPerStrip.
+ numberType := #short.
].
(tagType == 279) ifTrue:[
- "stripbytecount"
- address := stripByteCountsPos - 1.
- numberType := #short.
- count := stripByteCounts size.
- valueArray := stripByteCounts
+ "stripbytecount"
+ address := stripByteCountsPos - 1.
+ numberType := #short.
+ count := stripByteCounts size.
+ valueArray := stripByteCounts
].
(tagType == 280) ifTrue:[
- "min sample value"
+ "min sample value"
].
(tagType == 281) ifTrue:[
- "max sample value"
+ "max sample value"
].
(tagType == 282) ifTrue:[
- "x resolution"
+ "x resolution"
].
(tagType == 283) ifTrue:[
- "y resolution"
+ "y resolution"
].
(tagType == 284) ifTrue:[
- "planarconfig"
- value := planarConfiguration.
- numberType := #short.
+ "planarconfig"
+ value := planarConfiguration.
+ numberType := #short.
].
(tagType == 285) ifTrue:[
- "pageName"
+ "pageName"
].
(tagType == 286) ifTrue:[
- "xPosition"
+ "xPosition"
].
(tagType == 287) ifTrue:[
- "yPosition"
+ "yPosition"
].
(tagType == 288) ifTrue:[
- "freeOffsets"
+ "freeOffsets"
].
(tagType == 289) ifTrue:[
- "freeByteCounts"
+ "freeByteCounts"
].
(tagType == 290) ifTrue:[
- "grayResponceUnit"
+ "grayResponceUnit"
].
(tagType == 291) ifTrue:[
- "grayResponceCurve"
+ "grayResponceCurve"
].
(tagType == 292) ifTrue:[
- "group3options"
- value := group3options.
- numberType := #long.
+ "group3options"
+ value := group3options.
+ numberType := #long.
].
(tagType == 293) ifTrue:[
- "group4options"
+ "group4options"
].
(tagType == 296) ifTrue:[
- "resolutionunit"
- ^ self
+ "resolutionunit"
+ ^ self
].
(tagType == 297) ifTrue:[
- "pageNumber"
+ "pageNumber"
].
(tagType == 300) ifTrue:[
- "colorResponceUnit"
+ "colorResponceUnit"
].
(tagType == 301) ifTrue:[
- "colorResponceCurve"
+ "colorResponceCurve"
].
(tagType == 306) ifTrue:[
- "dateTime"
+ "dateTime"
].
(tagType == 315) ifTrue:[
- "artist"
+ "artist"
].
(tagType == 317) ifTrue:[
- "predictor"
+ "predictor"
].
(tagType == 320) ifTrue:[
- "colormap"
- address := colorMapPos - 1.
- numberType := #short.
- count := (colorMap at:1) size * 3.
+ "colormap"
+ address := colorMapPos - 1.
+ numberType := #short.
+ count := 256 "(colorMap at:1) size" * 3.
].
(value isNil and:[address isNil]) ifTrue:[
- self error:'unhandled tag'.
- ^ self
+ self error:'unhandled tag'.
+ ^ self
].
"
@@ -1117,73 +1139,73 @@
self writeShort:tagType.
numberType == #short ifTrue:[
- self writeShort:3.
- self writeLong:count.
+ self writeShort:3.
+ self writeLong:count.
] ifFalse:[
- numberType == #long ifTrue:[
- self writeShort:4.
- self writeLong:count.
- ] ifFalse:[
- numberType == #byte ifTrue:[
- self writeShort:1.
- self writeLong:count.
- ] ifFalse:[
- self error:'bad numbertype'
- ]
- ]
+ numberType == #long ifTrue:[
+ self writeShort:4.
+ self writeLong:count.
+ ] ifFalse:[
+ numberType == #byte ifTrue:[
+ self writeShort:1.
+ self writeLong:count.
+ ] ifFalse:[
+ self error:'bad numbertype'
+ ]
+ ]
].
address notNil ifTrue:[
- (numberType == #long and:[count == 1]) ifTrue:[
- self writeLong:(valueArray at:1).
- ^ self
- ].
- (numberType == #short and:[count <= 2]) ifTrue:[
- self writeShort:(valueArray at:1).
- count == 2 ifTrue:[
- self writeShort:(valueArray at:2).
- ] ifFalse:[
- self writeShort:0
- ].
- ^ self
- ].
- (numberType == #byte and:[count <= 4]) ifTrue:[
- outStream nextPut:(valueArray at:1).
- count > 1 ifTrue:[
- outStream nextPut:(valueArray at:2).
- count > 2 ifTrue:[
- outStream nextPut:(valueArray at:3).
- count > 3 ifTrue:[
- outStream nextPut:(valueArray at:4).
- ] ifFalse:[
- outStream nextPut:0
- ].
- ] ifFalse:[
- outStream nextPut:0
- ].
- ] ifFalse:[
- outStream nextPut:0
- ].
- ^ self
- ].
- self writeLong:address.
- ^ self
+ (numberType == #long and:[count == 1]) ifTrue:[
+ self writeLong:(valueArray at:1).
+ ^ self
+ ].
+ (numberType == #short and:[count <= 2]) ifTrue:[
+ self writeShort:(valueArray at:1).
+ count == 2 ifTrue:[
+ self writeShort:(valueArray at:2).
+ ] ifFalse:[
+ self writeShort:0
+ ].
+ ^ self
+ ].
+ (numberType == #byte and:[count <= 4]) ifTrue:[
+ outStream nextPut:(valueArray at:1).
+ count > 1 ifTrue:[
+ outStream nextPut:(valueArray at:2).
+ count > 2 ifTrue:[
+ outStream nextPut:(valueArray at:3).
+ count > 3 ifTrue:[
+ outStream nextPut:(valueArray at:4).
+ ] ifFalse:[
+ outStream nextPut:0
+ ].
+ ] ifFalse:[
+ outStream nextPut:0
+ ].
+ ] ifFalse:[
+ outStream nextPut:0
+ ].
+ ^ self
+ ].
+ self writeLong:address.
+ ^ self
].
numberType == #short ifTrue:[
- self writeShort:value.
- self writeShort:0
+ self writeShort:value.
+ self writeShort:0
] ifFalse:[
- numberType == #long ifTrue:[
- self writeLong:value
- ] ifFalse:[
- numberType == #byte ifTrue:[
- outStream nextPut:value.
- outStream nextPut:0.
- outStream nextPut:0.
- outStream nextPut:0.
- ] ifFalse:[
- self error:'bad numbertype'
- ]
- ]
+ numberType == #long ifTrue:[
+ self writeLong:value
+ ] ifFalse:[
+ numberType == #byte ifTrue:[
+ outStream nextPut:value.
+ outStream nextPut:0.
+ outStream nextPut:0.
+ outStream nextPut:0.
+ ] ifFalse:[
+ self error:'bad numbertype'
+ ]
+ ]
].
!
@@ -1202,37 +1224,37 @@
or rgb - if non separate planes and no alpha"
(nPlanes == 2) ifTrue:[
- (planarConfiguration ~~ 2) ifTrue:[
- self error:'with alpha, only separate planes supported'.
- ^ nil
- ].
- 'TIFFReader: ignoring alpha plane' errorPrintNL.
- nPlanes := 1.
- bitsPerPixel := bitsPerSample at:1
+ (planarConfiguration ~~ 2) ifTrue:[
+ self error:'with alpha, only separate planes supported'.
+ ^ nil
+ ].
+ 'TIFFReader: ignoring alpha plane' errorPrintNL.
+ nPlanes := 1.
+ bitsPerPixel := bitsPerSample at:1
] ifFalse:[
- (nPlanes == 3) ifTrue:[
- (planarConfiguration ~~ 1) ifTrue:[
- self error:'only non separate planes supported'.
- ^ nil
- ].
- bitsPerSample ~= #(8 8 8) ifTrue:[
- self error:'only 8/8/8 rgb images supported'.
- ^ nil
- ].
- bitsPerPixel := 24
- ] ifFalse:[
- (nPlanes ~~ 1) ifTrue:[
- self error:'format not supported'.
- ^ nil
- ].
- bitsPerPixel := bitsPerSample at:1
- ]
+ (nPlanes == 3) ifTrue:[
+ (planarConfiguration ~~ 1) ifTrue:[
+ self error:'only non separate planes supported'.
+ ^ nil
+ ].
+ bitsPerSample ~= #(8 8 8) ifTrue:[
+ self error:'only 8/8/8 rgb images supported'.
+ ^ nil
+ ].
+ bitsPerPixel := 24
+ ] ifFalse:[
+ (nPlanes ~~ 1) ifTrue:[
+ self error:'format not supported'.
+ ^ nil
+ ].
+ bitsPerPixel := bitsPerSample at:1
+ ]
].
bitsPerRow := width * bitsPerPixel.
bytesPerRow := bitsPerRow // 8.
((bitsPerRow \\ 8) ~~ 0) ifTrue:[
- bytesPerRow := bytesPerRow + 1
+ bytesPerRow := bytesPerRow + 1
].
overAllBytes := bytesPerRow * height.
@@ -1243,13 +1265,13 @@
row := 1.
[row <= height] whileTrue:[
- stripNr := stripNr + 1.
- nBytes := stripByteCounts at:stripNr.
- inStream position:((stripOffsets at:stripNr) + 1).
+ stripNr := stripNr + 1.
+ nBytes := stripByteCounts at:stripNr.
+ inStream position:((stripOffsets at:stripNr) + 1).
- inStream nextBytes:nBytes into:data startingAt:offset.
- offset := offset + nBytes.
- row := row + rowsPerStrip
+ inStream nextBytes:nBytes into:data startingAt:offset.
+ offset := offset + nBytes.
+ row := row + rowsPerStrip
]
!
@@ -1271,38 +1293,38 @@
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 ...' errorPrintNL.
@@ -1316,25 +1338,25 @@
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
]
!
@@ -1350,22 +1372,22 @@
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 ...' errorPrintNL.
@@ -1373,7 +1395,7 @@
bitsPerRow := width * (bitsPerSample at:1).
bytesPerRow := bitsPerRow // 8.
((bitsPerRow \\ 8) ~~ 0) ifTrue:[
- bytesPerRow := bytesPerRow + 1
+ bytesPerRow := bytesPerRow + 1
].
data := ByteArray new:(bytesPerRow * height).
@@ -1385,15 +1407,15 @@
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
]
!