10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 ImageReader subclass:#TIFFReader |
13 ImageReader subclass:#TIFFReader |
14 instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip |
14 instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip |
15 fillOrder compression group3options predictor stripByteCounts |
15 fillOrder compression group3options predictor stripByteCounts |
16 currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos |
16 currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos |
17 colorMapPos' |
17 colorMapPos' |
18 classVariableNames:'' |
18 classVariableNames:'' |
19 poolDictionaries:'' |
19 poolDictionaries:'' |
20 category:'Graphics-Images support' |
20 category:'Graphics-Images support' |
21 ! |
21 ! |
22 |
22 |
41 This class knows how to read TIFF files and how to |
41 This class knows how to read TIFF files and how to |
42 write uncompressed TIFF files. |
42 write uncompressed TIFF files. |
43 |
43 |
44 Only single image files are supported. |
44 Only single image files are supported. |
45 Not all formats are implemented, and of those that are, not all are tested. |
45 Not all formats are implemented, and of those that are, not all are tested. |
46 It should work with most rgb, mono and 2-plane greyscale |
46 It should read with most rgb, mono and 2-plane greyscale |
47 images, since this is what I have as test material on the NeXT. |
47 images, since this is what I have as test material on the NeXT. |
48 It supports reading of uncompressed, LZW and G3 compressed |
48 It supports reading of uncompressed, LZW and G3 compressed |
49 images; JPEG and packbits are currently not implemented. |
49 images; JPEG and packbits are currently not implemented. |
50 |
50 |
51 Only writing of uncompressed images is currently implemented. |
51 Only writing of uncompressed images is currently implemented. |
|
52 It should write (at least) mono, 8-bit palette and 24 bit rgb formats. |
52 More formats will come ... |
53 More formats will come ... |
53 |
54 |
54 TODO: since I dont want to spend all of my life adding more formats here and |
55 TODO: since I dont want to spend all of my life adding more formats here and |
55 reinventing the wheel, this code should be changed to use the tiff library. |
56 reinventing the wheel, this code should be changed to use the tiff library. |
56 That would give us most formats and also writing capabilities for free. |
57 That would give us most formats and also writing capabilities for free. |
1605 (pos printStringRadix:16)) printNewline. |
1604 (pos printStringRadix:16)) printNewline. |
1606 " |
1605 " |
1607 "output tag data" |
1606 "output tag data" |
1608 |
1607 |
1609 photometric == #palette ifTrue:[ |
1608 photometric == #palette ifTrue:[ |
|
1609 self writeShort:11. "11 tags" |
|
1610 ] ifFalse:[ |
1610 self writeShort:10. "10 tags" |
1611 self writeShort:10. "10 tags" |
1611 ] ifFalse:[ |
|
1612 self writeShort:9. "9 tags" |
|
1613 ]. |
1612 ]. |
1614 self writeTag:256. "image width" |
1613 self writeTag:256. "image width" |
1615 self writeTag:257. "image height" |
1614 self writeTag:257. "image height" |
1616 self writeTag:258. "bits per sample" |
1615 self writeTag:258. "bits per sample" |
1617 self writeTag:259. "compression" |
1616 self writeTag:259. "compression" |
1618 self writeTag:262. "photometric" |
1617 self writeTag:262. "photometric" |
1619 self writeTag:273. "strip offsets" |
1618 self writeTag:273. "strip offsets" |
|
1619 self writeTag:277. "samplesPerPixel" |
1620 self writeTag:278. "rowsPerStrip" |
1620 self writeTag:278. "rowsPerStrip" |
1621 self writeTag:279. "strip byte counts" |
1621 self writeTag:279. "strip byte counts" |
1622 self writeTag:284. "planarconfig" |
1622 self writeTag:284. "planarconfig" |
1623 photometric == #palette ifTrue:[ |
1623 photometric == #palette ifTrue:[ |
1624 self writeTag:320 "colorMap" |
1624 self writeTag:320 "colorMap" |