author | Claus Gittinger <cg@exept.de> |
Sat, 01 Mar 1997 23:15:10 +0100 | |
changeset 471 | 350583677b5b |
parent 461 | bacef118f54a |
child 516 | 76ffe180cff8 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
28 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
ImageReader subclass:#TIFFReader |
|
192 | 14 |
instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip |
159
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
15 |
fillOrder compression group3options predictor stripByteCounts |
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
16 |
currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
17 |
colorMapPos orientation' |
192 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
259 | 20 |
category:'Graphics-Images-Support' |
0 | 21 |
! |
22 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
23 |
!TIFFReader class methodsFor:'documentation'! |
0 | 24 |
|
21 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
28 | 28 |
All Rights Reserved |
21 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
0 | 39 |
documentation |
40 |
" |
|
21 | 41 |
This class knows how to read TIFF files and how to |
42 |
write uncompressed TIFF files. |
|
14 | 43 |
|
21 | 44 |
Only single image files are supported. |
38 | 45 |
Not all formats are implemented, and of those that are, not all are tested. |
159
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
46 |
It should read with most rgb, mono and 2-plane greyscale |
38 | 47 |
images, since this is what I have as test material on the NeXT. |
21 | 48 |
It supports reading of uncompressed, LZW and G3 compressed |
49 |
images; JPEG and packbits are currently not implemented. |
|
14 | 50 |
|
21 | 51 |
Only writing of uncompressed images is currently implemented. |
159
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
52 |
It should write (at least) mono, 8-bit palette and 24 bit rgb formats. |
21 | 53 |
More formats will come ... |
30 | 54 |
|
55 |
TODO: since I dont want to spend all of my life adding more formats here and |
|
56 |
reinventing the wheel, this code should be changed to use the tiff library. |
|
57 |
That would give us most formats and also writing capabilities for free. |
|
195 | 58 |
|
220 | 59 |
[author:] |
60 |
Claus Gittinger |
|
61 |
||
195 | 62 |
[See also:] |
234 | 63 |
Image Form Icon |
197 | 64 |
BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader |
210 | 65 |
ST80FormReader SunRasterReader TargaReader WindowsIconReader |
209 | 66 |
XBMReader XPMReader XWDReader |
0 | 67 |
" |
68 |
! ! |
|
69 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
70 |
!TIFFReader class methodsFor:'initialization'! |
28 | 71 |
|
72 |
initialize |
|
198 | 73 |
"install myself in the Image classes fileFormat table |
398 | 74 |
for the `.tiff' and `.tif' extensions." |
198 | 75 |
|
398 | 76 |
Image addReader:self suffix:'tiff'. |
77 |
Image addReader:self suffix:'tif'. |
|
198 | 78 |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
79 |
" |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
80 |
self initialize |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
81 |
" |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
82 |
|
398 | 83 |
"Modified: 1.2.1997 / 15:00:01 / cg" |
28 | 84 |
! ! |
85 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
86 |
!TIFFReader class methodsFor:'testing'! |
3 | 87 |
|
135 | 88 |
canRepresent:anImage |
89 |
"return true, if anImage can be represented in my file format. |
|
90 |
Any image is supported." |
|
91 |
||
92 |
^ true |
|
93 |
! |
|
94 |
||
3 | 95 |
isValidImageFile:aFileName |
96 |
"return true, if aFileName contains a GIF image" |
|
97 |
||
98 |
|inStream char1 char2 version| |
|
99 |
||
11 | 100 |
inStream := self streamReadingFile:aFileName. |
3 | 101 |
inStream isNil ifTrue:[^ false]. |
102 |
||
103 |
char1 := inStream next. |
|
104 |
char2 := inStream next. |
|
105 |
||
106 |
((char1 ~~ char2) or:[(char1 ~~ $I) and:[char1 ~~ $M]]) ifTrue:[ |
|
28 | 107 |
inStream close. |
108 |
^ false |
|
3 | 109 |
]. |
110 |
||
111 |
inStream binary. |
|
112 |
version := inStream nextShortMSB:(char1 == $M). |
|
113 |
inStream close. |
|
114 |
||
115 |
(version ~~ 42) ifTrue:[^ false]. |
|
116 |
^ true |
|
0 | 117 |
! ! |
118 |
||
119 |
!TIFFReader methodsFor:'private'! |
|
120 |
||
121 |
decodeTiffTag:tagType numberType:numberType length:length |
|
122 |
|offset value valueArray |
|
40 | 123 |
val scaleFactor rV gV bV |
124 |
n "{ Class: SmallInteger }" |
|
35 | 125 |
i2 "{ Class: SmallInteger }" |
126 |
i3 "{ Class: SmallInteger }" | |
|
0 | 127 |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
128 |
"/ 'tiffTag: ' print. tagType printCR. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
129 |
|
0 | 130 |
(numberType == 3) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
131 |
"short" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
132 |
valueArray := self readShorts:length. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
133 |
value := valueArray at:1 |
0 | 134 |
] ifFalse:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
135 |
(numberType == 4) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
136 |
"integer" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
137 |
valueArray := self readLongs:length. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
138 |
value := valueArray at:1 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
139 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
140 |
(numberType == 2) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
141 |
"character" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
142 |
value := self readChars:length |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
143 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
144 |
(numberType == 5) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
145 |
"fraction" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
146 |
valueArray := self readFracts:length. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
147 |
value := valueArray at:1 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
148 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
149 |
offset := (inStream nextLongMSB:(byteOrder ~~ #lsb)) |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
150 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
151 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
152 |
] |
0 | 153 |
]. |
154 |
||
155 |
(tagType == 254) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
156 |
"NewSubfileType" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
157 |
"newSubFileType := value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
158 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
159 |
"/ 'newSubfiletype ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
160 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
161 |
^ self |
0 | 162 |
]. |
163 |
(tagType == 255) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
164 |
"SubfileType" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
165 |
subFileType := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
166 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
167 |
"/ 'subfiletype ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
168 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
169 |
^ self |
0 | 170 |
]. |
171 |
(tagType == 256) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
172 |
"ImageWidth" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
173 |
width := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
174 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
175 |
"/ 'width ' print. width printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
176 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
177 |
^ self |
0 | 178 |
]. |
179 |
(tagType == 257) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
180 |
"ImageHeight" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
181 |
height := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
182 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
183 |
"/ 'height ' print. height printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
184 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
185 |
^ self |
0 | 186 |
]. |
187 |
(tagType == 258) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
188 |
"bitspersample" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
189 |
bitsPerSample := valueArray. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
190 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
191 |
"/ 'bitspersample ' print. bitsPerSample printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
192 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
193 |
^ self |
0 | 194 |
]. |
195 |
(tagType == 259) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
196 |
"compression" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
197 |
compression := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
198 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
199 |
"/ 'compression ' print. compression printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
200 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
201 |
^ self |
0 | 202 |
]. |
203 |
(tagType == 262) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
204 |
"photometric" |
30 | 205 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
206 |
(value == 0) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
207 |
photometric := #whiteIs0 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
208 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
209 |
(value == 1) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
210 |
photometric := #blackIs0 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
211 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
212 |
(value == 2) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
213 |
photometric := #rgb |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
214 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
215 |
(value == 3) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
216 |
photometric := #palette |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
217 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
218 |
(value == 4) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
219 |
photometric := #transparency |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
220 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
221 |
(value == 5) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
222 |
photometric := #separated "/ color separations |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
223 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
224 |
(value == 6) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
225 |
photometric := #ycbr "/ CCIR 601 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
226 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
227 |
(value == 8) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
228 |
photometric := #cielab "/ 1976 CIE L*a*b* |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
229 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
230 |
photometric := nil |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
231 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
232 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
233 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
234 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
235 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
236 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
237 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
238 |
]. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
239 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
240 |
"/ 'photometric ' print. photometric printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
241 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
242 |
^ self |
0 | 243 |
]. |
244 |
(tagType == 263) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
245 |
"Treshholding" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
246 |
"threshholding := value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
247 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
248 |
"/ 'treshholding ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
249 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
250 |
^ self |
0 | 251 |
]. |
252 |
(tagType == 264) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
253 |
"CellWidth" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
254 |
"cellWidth:= value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
255 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
256 |
"/ 'cellWidth ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
257 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
258 |
^ self |
0 | 259 |
]. |
260 |
(tagType == 265) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
261 |
"CellLength" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
262 |
"cellLength:= value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
263 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
264 |
"/ 'cellLength ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
265 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
266 |
^ self |
0 | 267 |
]. |
268 |
(tagType == 266) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
269 |
"fillOrder" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
270 |
(value == 1) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
271 |
fillOrder := #msb |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
272 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
273 |
(value == 2) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
274 |
fillOrder := #lsb |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
275 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
276 |
fillOrder := nil |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
277 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
278 |
]. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
279 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
280 |
"/ 'fillorder ' print. fillOrder printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
281 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
282 |
^ self |
0 | 283 |
]. |
284 |
(tagType == 269) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
285 |
"documentName - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
286 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
287 |
"/ 'documentName ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
288 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
289 |
^ self |
0 | 290 |
]. |
291 |
(tagType == 270) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
292 |
"imageDescription - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
293 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
294 |
"/ 'imageDescription ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
295 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
296 |
^ self |
0 | 297 |
]. |
298 |
(tagType == 271) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
299 |
"make - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
300 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
301 |
"/ 'make ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
302 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
303 |
^ self |
0 | 304 |
]. |
305 |
(tagType == 272) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
306 |
"model - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
307 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
308 |
"/ 'model ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
309 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
310 |
^ self |
0 | 311 |
]. |
312 |
(tagType == 273) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
313 |
"stripoffsets" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
314 |
stripOffsets := valueArray. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
315 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
316 |
"/ 'stripOffsets Array(' print. stripOffsets size print. ')' printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
317 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
318 |
^ self |
0 | 319 |
]. |
320 |
(tagType == 274) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
321 |
"Orientation" |
393 | 322 |
|
323 |
orientation := |
|
324 |
#( nil "/ 1 normal |
|
325 |
unsupported "/ 2 horizontal flip |
|
326 |
unsupported "/ 3 horizontal & vertical flip |
|
327 |
vFlip "/ 4 vertical flip |
|
328 |
unsupported "/ 5 rot 90' counter clock-wise |
|
329 |
unsupported "/ 6 rot 90' clock-wise |
|
330 |
unsupported "/ 7 rot 90' & flip |
|
331 |
unsupported "/ 8 rot 90' ccw & flip |
|
332 |
) at:value ifAbsent:#unsupported. |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
333 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
334 |
"/ 'orientation ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
335 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
336 |
^ self |
0 | 337 |
]. |
338 |
(tagType == 277) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
339 |
"samplesPerPixel" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
340 |
samplesPerPixel := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
341 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
342 |
"/ 'samplesperpixel ' print. samplesPerPixel printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
343 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
344 |
^ self |
0 | 345 |
]. |
346 |
(tagType == 278) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
347 |
"rowsperstrip" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
348 |
rowsPerStrip := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
349 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
350 |
"/ 'rowsperstrip ' print. rowsPerStrip printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
351 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
352 |
^ self |
0 | 353 |
]. |
354 |
(tagType == 279) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
355 |
"stripbytecount" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
356 |
stripByteCounts := valueArray. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
357 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
358 |
"/ 'stripByteCounts Array(' print. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
359 |
"/ stripByteCounts size print. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
360 |
"/ ')' printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
361 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
362 |
^ self |
0 | 363 |
]. |
364 |
(tagType == 280) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
365 |
"MinSampleValue" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
366 |
"minSampleValue:= value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
367 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
368 |
"/ 'minSampleValue ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
369 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
370 |
^ self |
0 | 371 |
]. |
372 |
(tagType == 281) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
373 |
"MaxSampleValue" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
374 |
"maxSampleValue:= value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
375 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
376 |
"/ 'maxSampleValue ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
377 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
378 |
^ self |
0 | 379 |
]. |
380 |
(tagType == 282) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
381 |
"xResolution" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
382 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
383 |
"/ 'xres ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
384 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
385 |
^ self |
0 | 386 |
]. |
387 |
(tagType == 283) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
388 |
"yResolution" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
389 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
390 |
"/ 'yres ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
391 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
392 |
^ self |
0 | 393 |
]. |
394 |
(tagType == 284) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
395 |
"planarconfig" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
396 |
(value == 1) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
397 |
planarConfiguration := 1 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
398 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
399 |
(value == 2) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
400 |
planarConfiguration := 2 |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
401 |
] ifFalse:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
402 |
planarConfiguration := nil |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
403 |
] |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
404 |
]. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
405 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
406 |
"/ 'planarconfig ' print. planarConfiguration printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
407 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
408 |
^ self |
0 | 409 |
]. |
410 |
(tagType == 285) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
411 |
"pageName" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
412 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
413 |
"/ 'pageName ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
414 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
415 |
^ self |
0 | 416 |
]. |
417 |
(tagType == 286) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
418 |
"xPosition" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
419 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
420 |
"/ 'xPos ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
421 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
422 |
^ self |
0 | 423 |
]. |
424 |
(tagType == 287) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
425 |
"yPosition" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
426 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
427 |
"/ 'yPos ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
428 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
429 |
^ self |
0 | 430 |
]. |
431 |
(tagType == 288) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
432 |
"freeOffsets" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
433 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
434 |
"/ 'freeOffsets ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
435 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
436 |
^ self |
0 | 437 |
]. |
438 |
(tagType == 289) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
439 |
"freeByteCounts" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
440 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
441 |
"/ 'freeByteCounts ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
442 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
443 |
^ self |
0 | 444 |
]. |
445 |
(tagType == 290) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
446 |
"grayResponceUnit" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
447 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
448 |
"/ 'grayResponceUnit' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
449 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
450 |
^ self |
0 | 451 |
]. |
452 |
(tagType == 291) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
453 |
"grayResponceCurve" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
454 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
455 |
"/ 'grayResponceCurve' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
456 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
457 |
^ self |
0 | 458 |
]. |
459 |
(tagType == 292) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
460 |
"group3options" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
461 |
group3options := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
462 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
463 |
"/ 'group3options ' print. group3options printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
464 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
465 |
^ self |
0 | 466 |
]. |
467 |
(tagType == 293) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
468 |
"group4options" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
469 |
"group4options := value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
470 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
471 |
"/ 'group4options ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
472 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
473 |
^ self |
0 | 474 |
]. |
475 |
(tagType == 296) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
476 |
"resolutionunit" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
477 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
478 |
"/ (value == 1) ifTrue:[ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
479 |
"/ 'res-unit pixel' printNewline |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
480 |
"/ ] ifFalse:[ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
481 |
"/ (value == 2) ifTrue:[ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
482 |
"/ 'res-unit inch' printNewline |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
483 |
"/ ] ifFalse:[ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
484 |
"/ (value == 3) ifTrue:[ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
485 |
"/ 'res-unit mm' printNewline |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
486 |
"/ ] ifFalse:[ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
487 |
"/ 'res-unit invalid' printNewline |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
488 |
"/ ] |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
489 |
"/ ] |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
490 |
"/ ]. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
491 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
492 |
"resolutionUnit := value." |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
493 |
^ self |
0 | 494 |
]. |
495 |
(tagType == 297) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
496 |
"pageNumber" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
497 |
"pageNumber := value." |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
498 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
499 |
"/ 'pageNumber ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
500 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
501 |
^ self |
0 | 502 |
]. |
503 |
(tagType == 300) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
504 |
"colorResponceUnit" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
505 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
506 |
"/ 'colorResponceUnit' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
507 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
508 |
^ self |
0 | 509 |
]. |
510 |
(tagType == 301) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
511 |
"colorResponceCurve" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
512 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
513 |
"/ 'colorResponceCurve' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
514 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
515 |
^ self |
0 | 516 |
]. |
30 | 517 |
(tagType == 305) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
518 |
"software - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
519 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
520 |
"/ 'software' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
521 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
522 |
^ self |
30 | 523 |
]. |
0 | 524 |
(tagType == 306) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
525 |
"dateTime - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
526 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
527 |
"/ 'dateTime ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
528 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
529 |
^ self |
0 | 530 |
]. |
531 |
(tagType == 315) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
532 |
"artist - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
533 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
534 |
"/ 'artist ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
535 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
536 |
^ self |
0 | 537 |
]. |
30 | 538 |
(tagType == 316) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
539 |
"host computer - info only" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
540 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
541 |
"/ 'host ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
542 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
543 |
^ self |
30 | 544 |
]. |
0 | 545 |
(tagType == 317) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
546 |
"predictor" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
547 |
predictor := value. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
548 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
549 |
"/ 'predictor ' print. predictor printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
550 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
551 |
^ self |
0 | 552 |
]. |
30 | 553 |
(tagType == 318) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
554 |
"whitePoint" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
555 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
556 |
"/ 'whitePoint ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
557 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
558 |
^ self |
30 | 559 |
]. |
560 |
(tagType == 319) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
561 |
"primaryChromatics" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
562 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
563 |
"/ 'primaryChromatics ' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
564 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
565 |
^ self |
30 | 566 |
]. |
0 | 567 |
(tagType == 320) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
568 |
"colorMap" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
569 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
570 |
"/ 'colorMap (size=' print. valueArray size print. ')' printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
571 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
572 |
" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
573 |
the tiff colormap contains 16bit values; |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
574 |
our colormap expects 8bit values |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
575 |
" |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
576 |
n := valueArray size // 3. |
28 | 577 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
578 |
rV := ByteArray uninitializedNew:n. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
579 |
gV := ByteArray uninitializedNew:n. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
580 |
bV := ByteArray uninitializedNew:n. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
581 |
scaleFactor := 255.0 / 16rFFFF. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
582 |
i2 := n+1. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
583 |
i3 := 2*n+1. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
584 |
1 to:n do:[:vi | |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
585 |
val := ((valueArray at:vi) * scaleFactor) rounded. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
586 |
rV at:vi put:val. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
587 |
val := ((valueArray at:i2) * scaleFactor) rounded. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
588 |
gV at:vi put:val. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
589 |
val := ((valueArray at:i3) * scaleFactor) rounded. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
590 |
bV at:vi put:val. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
591 |
i2 := i2 + 1. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
592 |
i3 := i3 + 1. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
593 |
]. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
594 |
colorMap := Colormap redVector:rV greenVector:gV blueVector:bV. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
595 |
^ self |
0 | 596 |
]. |
30 | 597 |
(tagType == 332) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
598 |
"ink set" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
599 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
600 |
"/ 'ink set' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
601 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
602 |
^ self |
30 | 603 |
]. |
604 |
(tagType == 333) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
605 |
"ink names" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
606 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
607 |
"/ 'ink names' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
608 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
609 |
^ self |
30 | 610 |
]. |
611 |
(tagType == 336) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
612 |
"dot range" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
613 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
614 |
"/ 'dot range' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
615 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
616 |
^ self |
30 | 617 |
]. |
618 |
(tagType == 337) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
619 |
"target printer" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
620 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
621 |
"/ 'target printer' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
622 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
623 |
^ self |
30 | 624 |
]. |
625 |
(tagType == 339) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
626 |
"sample format" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
627 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
628 |
"/ 'sample format' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
629 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
630 |
^ self |
30 | 631 |
]. |
632 |
(tagType == 340) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
633 |
"min sample value" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
634 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
635 |
"/ 'min sample value' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
636 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
637 |
^ self |
30 | 638 |
]. |
639 |
(tagType == 341) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
640 |
"max sample value" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
641 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
642 |
"/ 'max sample value' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
643 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
644 |
^ self |
30 | 645 |
]. |
646 |
(tagType == 512) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
647 |
"jpeg proc" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
648 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
649 |
"/ 'jpeg proc' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
650 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
651 |
^ self |
30 | 652 |
]. |
653 |
(tagType == 513) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
654 |
"jpeg proc" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
655 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
656 |
"/ 'jpeg proc' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
657 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
658 |
^ self |
30 | 659 |
]. |
660 |
(tagType == 32995) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
661 |
"matteing" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
662 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
663 |
"/ 'matteing' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
664 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
665 |
^ self |
30 | 666 |
]. |
667 |
(tagType == 32996) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
668 |
"datatype" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
669 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
670 |
"/ 'datatype' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
671 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
672 |
^ self |
30 | 673 |
]. |
674 |
(tagType == 32997) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
675 |
"imagedepth" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
676 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
677 |
"/ 'imagedepth' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
678 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
679 |
^ self |
30 | 680 |
]. |
681 |
(tagType == 32998) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
682 |
"tiledepth" |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
683 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
684 |
"/ 'tiledepth' print. value printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
685 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
686 |
^ self |
30 | 687 |
]. |
0 | 688 |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
689 |
"/ |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
690 |
"/ 'TIFFReader: tag:' print. tagType print. ' typ:' print. numberType print. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
691 |
"/ ' len:' print. length print. ' offs:' print. offset print. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
692 |
"/ ' val:' print. value print. ' valArr:' print. valueArray printNewline. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
693 |
"/ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
694 |
'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
695 |
|
393 | 696 |
"Modified: 31.1.1997 / 10:50:38 / cg" |
440 | 697 |
! ! |
698 |
||
699 |
!TIFFReader methodsFor:'private - reading'! |
|
0 | 700 |
|
135 | 701 |
readCCITT3RLETiffImageData |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
702 |
'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
703 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
704 |
"Modified: 10.1.1997 / 18:09:02 / cg" |
135 | 705 |
! |
706 |
||
707 |
readCCITT3RLEWTiffImageData |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
708 |
'TIFFReader [warning]: ccitt mod Huffman (rlew) compression not implemented' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
709 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
710 |
"Modified: 10.1.1997 / 18:09:11 / cg" |
135 | 711 |
! |
712 |
||
713 |
readCCITTGroup3TiffImageData |
|
714 |
"not really tested - all I got is a single |
|
715 |
fax from NeXT step" |
|
716 |
||
717 |
|bytesPerRow bitsPerRow compressedStrip nPlanes |
|
718 |
stripNr "{ Class: SmallInteger }" |
|
719 |
offset "{ Class: SmallInteger }" |
|
720 |
row "{ Class: SmallInteger }" |
|
721 |
bytesPerStrip "{ Class: SmallInteger }" | |
|
722 |
||
723 |
nPlanes := samplesPerPixel. |
|
724 |
(nPlanes == 2) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
725 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
335 | 726 |
nPlanes := 1 |
135 | 727 |
]. |
728 |
||
729 |
(nPlanes ~~ 1) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
730 |
'TIFFReader [warning]: only monochrome/greyscale supported' errorPrintCR. |
335 | 731 |
^ nil |
135 | 732 |
]. |
0 | 733 |
|
135 | 734 |
stripByteCounts isNil ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
735 |
'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR. |
335 | 736 |
^ nil |
135 | 737 |
]. |
738 |
(rowsPerStrip ~~ 1) isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
739 |
'TIFFReader [warning]: currently require rowsPerStrip to be 1' errorPrintCR. |
335 | 740 |
^ nil |
135 | 741 |
]. |
742 |
||
335 | 743 |
"/ 'TIFFReader: decompressing CCITT-3 ...' infoPrintNL. |
135 | 744 |
|
745 |
bitsPerRow := width * (bitsPerSample at:1). |
|
746 |
bytesPerRow := bitsPerRow // 8. |
|
747 |
((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
335 | 748 |
bytesPerRow := bytesPerRow + 1 |
135 | 749 |
]. |
750 |
||
751 |
data := ByteArray new:(bytesPerRow * height). |
|
752 |
compressedStrip := ByteArray uninitializedNew:bytesPerRow. |
|
753 |
||
754 |
offset := 1. |
|
755 |
stripNr := 0. |
|
756 |
||
757 |
row := 1. |
|
758 |
bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
759 |
[row <= height] whileTrue:[ |
|
335 | 760 |
stripNr := stripNr + 1. |
761 |
inStream position:((stripOffsets at:stripNr) + 1). |
|
762 |
inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip. |
|
763 |
self class decompressCCITT3From:compressedStrip |
|
764 |
into:data |
|
765 |
startingAt:offset |
|
766 |
count:width. |
|
767 |
offset := offset + bytesPerStrip. |
|
768 |
row := row + rowsPerStrip |
|
135 | 769 |
] |
335 | 770 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
771 |
"Modified: 10.1.1997 / 18:14:56 / cg" |
135 | 772 |
! |
773 |
||
774 |
readCCITTGroup4TiffImageData |
|
359 | 775 |
'TIFFReader [warning]: ccitt group4 fax compression not implemented' errorPrintCR. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
776 |
|
359 | 777 |
"Modified: 10.1.1997 / 19:10:59 / cg" |
135 | 778 |
! |
0 | 779 |
|
135 | 780 |
readChars:n |
781 |
"read n characters and return them in a string" |
|
782 |
||
783 |
|oldPos offset string| |
|
784 |
||
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
785 |
n == 0 ifTrue:[^ '']. |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
786 |
|
135 | 787 |
string := String new:(n - 1). |
788 |
(n <= 4) ifTrue:[ |
|
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
789 |
inStream nextBytes:(n - 1) into:string |
135 | 790 |
] ifFalse:[ |
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
791 |
offset := inStream nextLongMSB:(byteOrder ~~ #lsb). |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
792 |
oldPos := inStream position. |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
793 |
inStream position:(offset + 1). |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
794 |
inStream nextBytes:(n - 1) into:string. |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
795 |
inStream position:oldPos |
135 | 796 |
]. |
797 |
^ string |
|
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
798 |
|
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
799 |
"Modified: 5.9.1996 / 12:21:08 / cg" |
135 | 800 |
! |
801 |
||
802 |
readFracts:nFracts |
|
803 |
"read nFracts fractions (2 32bit words) and return them in an array" |
|
804 |
||
805 |
|oldPos offset values numerator denominator msb |
|
806 |
n "{ Class: SmallInteger }" | |
|
807 |
||
808 |
n := nFracts. |
|
809 |
||
810 |
msb := byteOrder ~~ #lsb. |
|
811 |
values := Array basicNew:n. |
|
812 |
offset := inStream nextLongMSB:msb. |
|
813 |
oldPos := inStream position. |
|
814 |
inStream position:(offset + 1). |
|
815 |
1 to:n do:[:index | |
|
816 |
numerator := inStream nextLongMSB:msb. |
|
817 |
denominator := inStream nextLongMSB:msb. |
|
818 |
values at:index put:(Fraction numerator:numerator denominator:denominator) |
|
819 |
]. |
|
820 |
inStream position:oldPos. |
|
821 |
^ values |
|
822 |
! |
|
823 |
||
824 |
readJPEGTiffImageData |
|
359 | 825 |
'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
826 |
|
359 | 827 |
"Modified: 10.1.1997 / 19:11:02 / cg" |
135 | 828 |
! |
829 |
||
830 |
readLZWTiffImageData |
|
831 |
"read LZW compressed tiff data; this method only |
|
832 |
handles 3x8 rgb and 1x2 or 2x2 greyscale images. |
|
833 |
For 2x2 greyscale images, the alpha plane is ignored. |
|
834 |
(maybe other formats work also - its simply not |
|
835 |
tested)" |
|
836 |
||
837 |
|bytesPerRow compressedStrip nPlanes |
|
838 |
bytesPerStrip "{ Class: SmallInteger }" |
|
839 |
nBytes "{ Class: SmallInteger }" |
|
840 |
prevSize "{ Class: SmallInteger }" |
|
841 |
stripNr "{ Class: SmallInteger }" |
|
842 |
offset "{ Class: SmallInteger }" |
|
843 |
row "{ Class: SmallInteger }" | |
|
844 |
||
845 |
nPlanes := samplesPerPixel. |
|
846 |
||
847 |
(nPlanes == 3) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
848 |
(((bitsPerSample at:1) ~~ 8) |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
849 |
or:[((bitsPerSample at:2) ~~ 8) |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
850 |
or:[((bitsPerSample at:3) ~~ 8)]]) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
851 |
'TIFFReader [warning]: only 8/8/8 bit/sample are supported' errorPrintCR. |
335 | 852 |
^ nil |
853 |
]. |
|
854 |
bytesPerRow := width * samplesPerPixel. |
|
0 | 855 |
] ifFalse:[ |
335 | 856 |
(nPlanes == 2) ifTrue:[ |
857 |
(planarConfiguration ~~ 2) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
858 |
'TIFFReader [warning]: only separate planes are supported' errorPrintCR. |
335 | 859 |
^ nil |
860 |
]. |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
861 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
335 | 862 |
nPlanes := 1 |
863 |
]. |
|
864 |
(nPlanes == 1) ifFalse:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
865 |
'TIFFReader [warning]: only 3-sample rgb / monochrome supported' errorPrintCR. |
335 | 866 |
^ nil |
867 |
]. |
|
868 |
bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8. |
|
135 | 869 |
]. |
870 |
||
871 |
stripByteCounts isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
872 |
'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR. |
335 | 873 |
^ nil |
135 | 874 |
]. |
875 |
||
335 | 876 |
"/ 'TIFFReader: decompressing LZW ...' infoPrintNL. |
135 | 877 |
|
878 |
data := ByteArray uninitializedNew:(bytesPerRow * height). |
|
879 |
||
880 |
offset := 1. |
|
881 |
stripNr := 0. |
|
882 |
||
883 |
row := 1. |
|
884 |
bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
885 |
prevSize := 0. |
|
886 |
[row <= height] whileTrue:[ |
|
335 | 887 |
stripNr := stripNr + 1. |
888 |
inStream position:((stripOffsets at:stripNr) + 1). |
|
889 |
nBytes := stripByteCounts at:stripNr. |
|
890 |
(nBytes > prevSize) ifTrue:[ |
|
891 |
compressedStrip := ByteArray uninitializedNew:nBytes. |
|
892 |
prevSize := nBytes |
|
893 |
]. |
|
894 |
inStream nextBytes:nBytes |
|
895 |
into:compressedStrip. |
|
896 |
self class decompressLZWFrom:compressedStrip |
|
897 |
count:nBytes |
|
898 |
into:data |
|
899 |
startingAt:offset. |
|
900 |
offset := offset + bytesPerStrip. |
|
901 |
row := row + rowsPerStrip |
|
135 | 902 |
]. |
903 |
||
904 |
(predictor == 2) ifTrue:[ |
|
335 | 905 |
self class decodeDelta:3 in:data width:width height:height |
135 | 906 |
] |
335 | 907 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
908 |
"Modified: 10.1.1997 / 18:13:21 / cg" |
135 | 909 |
! |
910 |
||
911 |
readLongs:nLongs |
|
912 |
"read nLongs long numbers (32bit) and return them in an array" |
|
913 |
||
914 |
|oldPos offset values msb |
|
915 |
n "{ Class: SmallInteger }" | |
|
916 |
||
917 |
n := nLongs. |
|
918 |
||
919 |
msb := byteOrder ~~ #lsb. |
|
920 |
values := Array basicNew:n. |
|
921 |
(n == 1) ifTrue:[ |
|
922 |
values at:1 put:(inStream nextLongMSB:msb). |
|
923 |
] ifFalse:[ |
|
924 |
offset := inStream nextLongMSB:msb. |
|
925 |
oldPos := inStream position. |
|
926 |
inStream position:(offset + 1). |
|
927 |
1 to:n do:[:index | |
|
928 |
values at:index put:(inStream nextLongMSB:msb) |
|
929 |
]. |
|
930 |
inStream position:oldPos |
|
931 |
]. |
|
932 |
^ values |
|
933 |
! |
|
934 |
||
935 |
readNeXTJPEGTiffImageData |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
936 |
'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
937 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
938 |
"Modified: 10.1.1997 / 18:11:04 / cg" |
135 | 939 |
! |
940 |
||
941 |
readNeXTRLE2TiffImageData |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
942 |
'TIFFReader [warning]: next 2bit rle compression not implemented' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
943 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
944 |
"Modified: 10.1.1997 / 18:11:01 / cg" |
135 | 945 |
! |
946 |
||
947 |
readPackbitsTiffImageData |
|
948 |
"had no samples yet - however, packbits decompression |
|
949 |
is rather trivial to add ..." |
|
950 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
951 |
'TIFFReader [warning]: packbits compression not implemented' errorPrintCR |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
952 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
953 |
"Modified: 10.1.1997 / 18:10:57 / cg" |
135 | 954 |
! |
955 |
||
956 |
readShorts:nShorts |
|
957 |
"read nShorts short numbers (16bit) and return them in an array" |
|
958 |
||
959 |
|oldPos offset values msb val2 |
|
960 |
n "{ Class: SmallInteger }" | |
|
0 | 961 |
|
135 | 962 |
n := nShorts. |
963 |
||
964 |
msb := (byteOrder ~~ #lsb). |
|
965 |
values := Array basicNew:n. |
|
966 |
(n <= 2) ifTrue:[ |
|
967 |
values at:1 put:(inStream nextUnsignedShortMSB:msb). |
|
968 |
val2 := inStream nextUnsignedShortMSB:msb. |
|
969 |
||
970 |
(n == 2) ifTrue:[ |
|
971 |
values at:2 put:val2 |
|
972 |
] |
|
973 |
] ifFalse:[ |
|
974 |
offset := inStream nextLongMSB:msb. |
|
975 |
oldPos := inStream position. |
|
976 |
inStream position:(offset + 1). |
|
977 |
1 to:n do:[:index | |
|
978 |
values at:index put:(inStream nextUnsignedShortMSB:msb) |
|
979 |
]. |
|
980 |
inStream position:oldPos |
|
981 |
]. |
|
982 |
^ values |
|
983 |
! |
|
984 |
||
985 |
readUncompressedTiffImageData |
|
986 |
|bytesPerRow bitsPerRow nPlanes |
|
987 |
stripNr "{ Class: SmallInteger }" |
|
988 |
offset "{ Class: SmallInteger }" |
|
989 |
row "{ Class: SmallInteger }" |
|
990 |
nBytes "{ Class: SmallInteger }" |
|
991 |
bitsPerPixel overAllBytes| |
|
992 |
||
993 |
nPlanes := samplesPerPixel. |
|
994 |
||
995 |
"only support 1-sample/pixel, |
|
996 |
with alpha - if separate planes, |
|
997 |
or rgb - if non separate planes and no alpha" |
|
998 |
||
999 |
(nPlanes == 2) ifTrue:[ |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1000 |
(planarConfiguration ~~ 2) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1001 |
'TIFFReader [warning]: with alpha, only separate planes supported' errorPrintCR. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1002 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1003 |
]. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1004 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1005 |
nPlanes := 1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1006 |
bitsPerPixel := bitsPerSample at:1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1007 |
bitsPerSample := Array with:bitsPerPixel. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1008 |
samplesPerPixel := 1. |
135 | 1009 |
] ifFalse:[ |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1010 |
(nPlanes == 3) ifTrue:[ |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1011 |
(planarConfiguration ~~ 1) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1012 |
'TIFFReader [warning]: only non separate planes supported' errorPrintCR. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1013 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1014 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1015 |
bitsPerSample ~= #(8 8 8) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1016 |
'TIFFReader [warning]: only 8/8/8 rgb images supported' errorPrintCR. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1017 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1018 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1019 |
bitsPerPixel := 24 |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1020 |
] ifFalse:[ |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1021 |
(nPlanes ~~ 1) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1022 |
'TIFFReader [warning]: format not supported' errorPrintCR. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1023 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1024 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1025 |
bitsPerPixel := bitsPerSample at:1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1026 |
] |
0 | 1027 |
]. |
135 | 1028 |
|
1029 |
bitsPerRow := width * bitsPerPixel. |
|
1030 |
bytesPerRow := bitsPerRow // 8. |
|
1031 |
((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1032 |
bytesPerRow := bytesPerRow + 1 |
135 | 1033 |
]. |
1034 |
||
1035 |
overAllBytes := bytesPerRow * height. |
|
1036 |
data := ByteArray uninitializedNew:overAllBytes. |
|
1037 |
||
336
9789b02d95bf
oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1038 |
offset := 0. |
135 | 1039 |
stripNr := 0. |
1040 |
||
1041 |
row := 1. |
|
1042 |
[row <= height] whileTrue:[ |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1043 |
stripNr := stripNr + 1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1044 |
nBytes := stripByteCounts at:stripNr. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1045 |
inStream position:((stripOffsets at:stripNr) + 1). |
135 | 1046 |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1047 |
offset + nBytes > overAllBytes ifTrue:[ |
336
9789b02d95bf
oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1048 |
nBytes := overAllBytes - offset. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1049 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1050 |
|
336
9789b02d95bf
oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1051 |
inStream nextBytes:nBytes into:data startingAt:offset+1. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1052 |
offset := offset + nBytes. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1053 |
row := row + rowsPerStrip |
135 | 1054 |
] |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1055 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1056 |
"Modified: 10.1.1997 / 18:10:46 / cg" |
440 | 1057 |
! ! |
1058 |
||
1059 |
!TIFFReader methodsFor:'private - writing'! |
|
135 | 1060 |
|
1061 |
writeBitsPerSample |
|
14 | 1062 |
" |
135 | 1063 |
'bitsPerSample: ' print. bitsPerSample printNewline. |
1064 |
'store bitspersample at: ' print. outStream position printNewline. |
|
14 | 1065 |
" |
135 | 1066 |
bitsPerSamplePos := outStream position. |
1067 |
bitsPerSample do:[:n | |
|
1068 |
self writeShort:n |
|
1069 |
] |
|
0 | 1070 |
! |
1071 |
||
1072 |
writeColorMap |
|
28 | 1073 |
|n| |
1074 |
||
0 | 1075 |
colorMapPos := outStream position. |
35 | 1076 |
#(red green blue) do:[:component | |
440 | 1077 |
n := 0. |
1078 |
colorMap do:[:clr | |
|
1079 |
|entry| |
|
35 | 1080 |
|
440 | 1081 |
clr isNil ifTrue:[ |
1082 |
entry := 0 |
|
1083 |
] ifFalse:[ |
|
1084 |
entry := clr perform:component. |
|
1085 |
" |
|
1086 |
tiff map is 16 bit - scale from percent to 0..16rFFFF |
|
1087 |
" |
|
1088 |
entry := (entry * 16rFFFF / 100) rounded. |
|
1089 |
]. |
|
1090 |
self writeShort:entry. |
|
1091 |
n := n + 1 |
|
1092 |
]. |
|
1093 |
||
1094 |
" |
|
1095 |
fill to 256 entries |
|
1096 |
" |
|
1097 |
[n < 256] whileTrue:[ |
|
1098 |
self writeShort:0. |
|
1099 |
n := n + 1. |
|
1100 |
] |
|
0 | 1101 |
] |
440 | 1102 |
|
1103 |
"Modified: 20.2.1997 / 18:06:10 / cg" |
|
0 | 1104 |
! |
1105 |
||
1106 |
writeStripByteCounts |
|
3 | 1107 |
" |
0 | 1108 |
'stripByteCounts: ' print. stripByteCounts printNewline. |
1109 |
'store stripbytecounts at: ' print. outStream position printNewline. |
|
3 | 1110 |
" |
0 | 1111 |
stripByteCountsPos := outStream position. |
1112 |
stripByteCounts do:[:c | |
|
28 | 1113 |
self writeShort:c |
0 | 1114 |
] |
1115 |
! |
|
1116 |
||
135 | 1117 |
writeStripOffsets |
3 | 1118 |
" |
135 | 1119 |
'stripOffsets: ' print. stripOffsets printNewline. |
1120 |
'store stripoffsets at: ' print. outStream position printNewline. |
|
3 | 1121 |
" |
135 | 1122 |
stripOffsetsPos := outStream position. |
1123 |
stripOffsets do:[:o | |
|
1124 |
self writeLong:o |
|
0 | 1125 |
] |
1126 |
! |
|
1127 |
||
1128 |
writeTag:tagType |
|
1129 |
self writeTiffTag:tagType. |
|
1130 |
! |
|
1131 |
||
1132 |
writeTiffTag:tagType |
|
1133 |
|value valueArray numberType count address| |
|
1134 |
||
1135 |
count := 1. |
|
1136 |
address := nil. |
|
1137 |
(tagType == 253) ifTrue:[ |
|
28 | 1138 |
"tiff class" |
0 | 1139 |
]. |
1140 |
(tagType == 254) ifTrue:[ |
|
1141 |
]. |
|
1142 |
(tagType == 255) ifTrue:[ |
|
28 | 1143 |
"SubfileType" |
1144 |
value := subFileType. |
|
1145 |
numberType := #long. |
|
0 | 1146 |
]. |
1147 |
(tagType == 256) ifTrue:[ |
|
28 | 1148 |
"ImageWidth" |
1149 |
value := width. |
|
1150 |
numberType := #short. |
|
0 | 1151 |
]. |
1152 |
(tagType == 257) ifTrue:[ |
|
28 | 1153 |
"ImageHeight" |
1154 |
value := height. |
|
1155 |
numberType := #short. |
|
0 | 1156 |
]. |
1157 |
(tagType == 258) ifTrue:[ |
|
28 | 1158 |
"bitspersample" |
1159 |
address := bitsPerSamplePos - 1. |
|
1160 |
numberType := #short. |
|
1161 |
count := bitsPerSample size. |
|
1162 |
valueArray := bitsPerSample |
|
0 | 1163 |
]. |
1164 |
(tagType == 259) ifTrue:[ |
|
28 | 1165 |
"compression" |
1166 |
value := compression. |
|
1167 |
numberType := #short. |
|
0 | 1168 |
]. |
1169 |
(tagType == 262) ifTrue:[ |
|
28 | 1170 |
"photometric" |
1171 |
(photometric == #whiteIs0) ifTrue:[ |
|
1172 |
value := 0 |
|
1173 |
] ifFalse:[ |
|
1174 |
(photometric == #blackIs0) ifTrue:[ |
|
1175 |
value := 1 |
|
1176 |
] ifFalse:[ |
|
1177 |
(photometric == #rgb) ifTrue:[ |
|
1178 |
value := 2 |
|
1179 |
] ifFalse:[ |
|
1180 |
(photometric == #palette) ifTrue:[ |
|
1181 |
value := 3 |
|
1182 |
] ifFalse:[ |
|
1183 |
(photometric == #transparency) ifTrue:[ |
|
1184 |
value := 4 |
|
1185 |
] ifFalse:[ |
|
1186 |
self error:'bad photometric' |
|
1187 |
] |
|
1188 |
] |
|
1189 |
] |
|
1190 |
] |
|
1191 |
]. |
|
1192 |
numberType := #short. |
|
0 | 1193 |
]. |
1194 |
(tagType == 263) ifTrue:[ |
|
1195 |
]. |
|
1196 |
(tagType == 264) ifTrue:[ |
|
1197 |
]. |
|
1198 |
(tagType == 265) ifTrue:[ |
|
1199 |
]. |
|
1200 |
(tagType == 266) ifTrue:[ |
|
28 | 1201 |
"fillOrder" |
1202 |
(fillOrder == #msb) ifTrue:[ |
|
1203 |
value := 1 |
|
1204 |
] ifFalse:[ |
|
1205 |
(fillOrder == #lsb) ifTrue:[ |
|
1206 |
value := 2 |
|
1207 |
] ifFalse:[ |
|
1208 |
self error:'bad fillOrder' |
|
1209 |
] |
|
1210 |
]. |
|
1211 |
numberType := #short. |
|
0 | 1212 |
]. |
1213 |
(tagType == 269) ifTrue:[ |
|
1214 |
]. |
|
1215 |
(tagType == 270) ifTrue:[ |
|
1216 |
]. |
|
1217 |
(tagType == 271) ifTrue:[ |
|
1218 |
]. |
|
1219 |
(tagType == 272) ifTrue:[ |
|
1220 |
]. |
|
1221 |
(tagType == 273) ifTrue:[ |
|
28 | 1222 |
"stripoffsets" |
1223 |
address := stripOffsetsPos - 1. |
|
1224 |
numberType := #long. |
|
1225 |
count := stripOffsets size. |
|
1226 |
valueArray := stripOffsets |
|
0 | 1227 |
]. |
1228 |
(tagType == 274) ifTrue:[ |
|
1229 |
]. |
|
1230 |
(tagType == 277) ifTrue:[ |
|
28 | 1231 |
"samplesPerPixel" |
1232 |
value := samplesPerPixel. |
|
1233 |
numberType := #short. |
|
0 | 1234 |
]. |
1235 |
(tagType == 278) ifTrue:[ |
|
28 | 1236 |
"rowsperstrip" |
1237 |
value := rowsPerStrip. |
|
1238 |
numberType := #short. |
|
0 | 1239 |
]. |
1240 |
(tagType == 279) ifTrue:[ |
|
28 | 1241 |
"stripbytecount" |
1242 |
address := stripByteCountsPos - 1. |
|
1243 |
numberType := #short. |
|
1244 |
count := stripByteCounts size. |
|
1245 |
valueArray := stripByteCounts |
|
0 | 1246 |
]. |
1247 |
(tagType == 280) ifTrue:[ |
|
28 | 1248 |
"min sample value" |
0 | 1249 |
]. |
1250 |
(tagType == 281) ifTrue:[ |
|
28 | 1251 |
"max sample value" |
0 | 1252 |
]. |
1253 |
(tagType == 282) ifTrue:[ |
|
28 | 1254 |
"x resolution" |
0 | 1255 |
]. |
1256 |
(tagType == 283) ifTrue:[ |
|
28 | 1257 |
"y resolution" |
0 | 1258 |
]. |
1259 |
(tagType == 284) ifTrue:[ |
|
28 | 1260 |
"planarconfig" |
1261 |
value := planarConfiguration. |
|
1262 |
numberType := #short. |
|
0 | 1263 |
]. |
1264 |
(tagType == 285) ifTrue:[ |
|
28 | 1265 |
"pageName" |
0 | 1266 |
]. |
1267 |
(tagType == 286) ifTrue:[ |
|
28 | 1268 |
"xPosition" |
0 | 1269 |
]. |
1270 |
(tagType == 287) ifTrue:[ |
|
28 | 1271 |
"yPosition" |
0 | 1272 |
]. |
1273 |
(tagType == 288) ifTrue:[ |
|
28 | 1274 |
"freeOffsets" |
0 | 1275 |
]. |
1276 |
(tagType == 289) ifTrue:[ |
|
28 | 1277 |
"freeByteCounts" |
0 | 1278 |
]. |
1279 |
(tagType == 290) ifTrue:[ |
|
28 | 1280 |
"grayResponceUnit" |
0 | 1281 |
]. |
1282 |
(tagType == 291) ifTrue:[ |
|
28 | 1283 |
"grayResponceCurve" |
0 | 1284 |
]. |
1285 |
(tagType == 292) ifTrue:[ |
|
28 | 1286 |
"group3options" |
1287 |
value := group3options. |
|
1288 |
numberType := #long. |
|
0 | 1289 |
]. |
1290 |
(tagType == 293) ifTrue:[ |
|
28 | 1291 |
"group4options" |
0 | 1292 |
]. |
1293 |
(tagType == 296) ifTrue:[ |
|
28 | 1294 |
"resolutionunit" |
1295 |
^ self |
|
0 | 1296 |
]. |
1297 |
(tagType == 297) ifTrue:[ |
|
28 | 1298 |
"pageNumber" |
0 | 1299 |
]. |
1300 |
(tagType == 300) ifTrue:[ |
|
28 | 1301 |
"colorResponceUnit" |
0 | 1302 |
]. |
1303 |
(tagType == 301) ifTrue:[ |
|
28 | 1304 |
"colorResponceCurve" |
0 | 1305 |
]. |
1306 |
(tagType == 306) ifTrue:[ |
|
28 | 1307 |
"dateTime" |
0 | 1308 |
]. |
1309 |
(tagType == 315) ifTrue:[ |
|
28 | 1310 |
"artist" |
0 | 1311 |
]. |
1312 |
(tagType == 317) ifTrue:[ |
|
28 | 1313 |
"predictor" |
0 | 1314 |
]. |
1315 |
(tagType == 320) ifTrue:[ |
|
28 | 1316 |
"colormap" |
1317 |
address := colorMapPos - 1. |
|
1318 |
numberType := #short. |
|
1319 |
count := 256 "(colorMap at:1) size" * 3. |
|
0 | 1320 |
]. |
1321 |
||
1322 |
(value isNil and:[address isNil]) ifTrue:[ |
|
28 | 1323 |
self error:'unhandled tag'. |
1324 |
^ self |
|
0 | 1325 |
]. |
1326 |
||
14 | 1327 |
" |
0 | 1328 |
'tag:' print. tagType print. ' typ:' print. numberType print. |
1329 |
' len:' print. count print. |
|
1330 |
' val:' print. value printNewline. |
|
14 | 1331 |
" |
0 | 1332 |
|
1333 |
self writeShort:tagType. |
|
1334 |
numberType == #short ifTrue:[ |
|
28 | 1335 |
self writeShort:3. |
1336 |
self writeLong:count. |
|
0 | 1337 |
] ifFalse:[ |
28 | 1338 |
numberType == #long ifTrue:[ |
1339 |
self writeShort:4. |
|
1340 |
self writeLong:count. |
|
1341 |
] ifFalse:[ |
|
1342 |
numberType == #byte ifTrue:[ |
|
1343 |
self writeShort:1. |
|
1344 |
self writeLong:count. |
|
1345 |
] ifFalse:[ |
|
1346 |
self error:'bad numbertype' |
|
1347 |
] |
|
1348 |
] |
|
0 | 1349 |
]. |
1350 |
address notNil ifTrue:[ |
|
28 | 1351 |
(numberType == #long and:[count == 1]) ifTrue:[ |
1352 |
self writeLong:(valueArray at:1). |
|
1353 |
^ self |
|
1354 |
]. |
|
1355 |
(numberType == #short and:[count <= 2]) ifTrue:[ |
|
1356 |
self writeShort:(valueArray at:1). |
|
1357 |
count == 2 ifTrue:[ |
|
1358 |
self writeShort:(valueArray at:2). |
|
1359 |
] ifFalse:[ |
|
1360 |
self writeShort:0 |
|
1361 |
]. |
|
1362 |
^ self |
|
1363 |
]. |
|
1364 |
(numberType == #byte and:[count <= 4]) ifTrue:[ |
|
1365 |
outStream nextPut:(valueArray at:1). |
|
1366 |
count > 1 ifTrue:[ |
|
1367 |
outStream nextPut:(valueArray at:2). |
|
1368 |
count > 2 ifTrue:[ |
|
1369 |
outStream nextPut:(valueArray at:3). |
|
1370 |
count > 3 ifTrue:[ |
|
1371 |
outStream nextPut:(valueArray at:4). |
|
1372 |
] ifFalse:[ |
|
1373 |
outStream nextPut:0 |
|
1374 |
]. |
|
1375 |
] ifFalse:[ |
|
1376 |
outStream nextPut:0 |
|
1377 |
]. |
|
1378 |
] ifFalse:[ |
|
1379 |
outStream nextPut:0 |
|
1380 |
]. |
|
1381 |
^ self |
|
1382 |
]. |
|
1383 |
self writeLong:address. |
|
1384 |
^ self |
|
0 | 1385 |
]. |
1386 |
numberType == #short ifTrue:[ |
|
28 | 1387 |
self writeShort:value. |
1388 |
self writeShort:0 |
|
0 | 1389 |
] ifFalse:[ |
28 | 1390 |
numberType == #long ifTrue:[ |
1391 |
self writeLong:value |
|
1392 |
] ifFalse:[ |
|
1393 |
numberType == #byte ifTrue:[ |
|
1394 |
outStream nextPut:value. |
|
1395 |
outStream nextPut:0. |
|
1396 |
outStream nextPut:0. |
|
1397 |
outStream nextPut:0. |
|
1398 |
] ifFalse:[ |
|
1399 |
self error:'bad numbertype' |
|
1400 |
] |
|
1401 |
] |
|
0 | 1402 |
]. |
1403 |
! |
|
1404 |
||
135 | 1405 |
writeUncompressedBits |
1406 |
"write bits as one or multiple strips" |
|
1407 |
||
1408 |
|offs bytesPerRow nBytes |
|
1409 |
h "{ Class: SmallInteger }"| |
|
0 | 1410 |
|
135 | 1411 |
nBytes := data size. |
1412 |
nBytes < 16rFFFF ifTrue:[ |
|
1413 |
stripOffsets := Array with:(outStream position - 1). |
|
1414 |
stripByteCounts := Array with:nBytes. |
|
1415 |
outStream nextPutBytes:nBytes from:data. |
|
1416 |
rowsPerStrip := height |
|
1417 |
] ifFalse:[ |
|
1418 |
stripOffsets := Array basicNew:height. |
|
1419 |
bytesPerRow := nBytes // height. |
|
1420 |
stripByteCounts := (Array basicNew:height) atAllPut:bytesPerRow. |
|
0 | 1421 |
|
135 | 1422 |
offs := 1. |
1423 |
h := height. |
|
1424 |
1 to:h do:[:row | |
|
1425 |
stripOffsets at:row put:(outStream position - 1). |
|
1426 |
outStream nextPutBytes:bytesPerRow from:data startingAt:offs. |
|
1427 |
offs := offs + bytesPerRow |
|
28 | 1428 |
]. |
135 | 1429 |
rowsPerStrip := 1 |
1430 |
]. |
|
1431 |
" |
|
1432 |
'stripOffsets: ' print. stripOffsets printNewline. |
|
1433 |
'stripByteCounts: ' print. stripByteCounts printNewline. |
|
1434 |
" |
|
1435 |
! ! |
|
1436 |
||
1437 |
!TIFFReader methodsFor:'reading from file'! |
|
1438 |
||
1439 |
fromStream:aStream |
|
192 | 1440 |
"read a stream containing a TIFF image. |
1441 |
Leave image description in instance variables." |
|
135 | 1442 |
|
1443 |
|char1 char2 version |
|
1444 |
numberOfTags "{ Class: SmallInteger }" |
|
1445 |
tagType "{ Class: SmallInteger }" |
|
1446 |
numberType "{ Class: SmallInteger }" |
|
1447 |
length "{ Class: SmallInteger }" |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1448 |
result offset ok msb |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1449 |
bitsPerPixel bytesPerRow offset1 offset2 tmp| |
135 | 1450 |
|
1451 |
inStream := aStream. |
|
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1452 |
aStream binary. |
135 | 1453 |
|
1454 |
char1 := aStream next. |
|
1455 |
char2 := aStream next. |
|
1456 |
(char1 ~~ char2) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1457 |
'TIFFReader [warning]: not a tiff file' errorPrintCR. |
192 | 1458 |
^ nil |
135 | 1459 |
]. |
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1460 |
(char1 == $I asciiValue) ifTrue:[ |
192 | 1461 |
byteOrder := #lsb. |
1462 |
msb := false. |
|
0 | 1463 |
] ifFalse:[ |
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1464 |
(char1 == $M asciiValue) ifTrue:[ |
192 | 1465 |
byteOrder := #msb. |
1466 |
msb := true. |
|
1467 |
] ifFalse:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1468 |
'TIFFReader [warning]: not a tiff file' errorPrintCR. |
192 | 1469 |
^ nil |
1470 |
] |
|
0 | 1471 |
]. |
1472 |
||
135 | 1473 |
version := self readShort. |
1474 |
(version ~~ 42) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1475 |
'TIFFReader [warning]: version of tiff-file not supported' errorPrintCR. |
192 | 1476 |
^ nil |
0 | 1477 |
]. |
1478 |
||
135 | 1479 |
"setup default values" |
0 | 1480 |
|
135 | 1481 |
compression := 1. "none" |
1482 |
fillOrder := #msb. |
|
1483 |
planarConfiguration := 1. |
|
1484 |
photometric := nil. |
|
1485 |
bitsPerSample := 1. |
|
1486 |
samplesPerPixel := 1. |
|
1487 |
width := nil. |
|
1488 |
height := nil. |
|
1489 |
stripOffsets := nil. |
|
1490 |
rowsPerStrip := nil. |
|
1491 |
"resolutionUnit := 2." |
|
1492 |
predictor := 1. |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1493 |
orientation := nil. |
0 | 1494 |
|
135 | 1495 |
offset := aStream nextLongMSB:msb. |
1496 |
aStream position:offset + 1. |
|
1497 |
||
1498 |
numberOfTags := self readShort. |
|
1499 |
1 to:numberOfTags do:[:index | |
|
192 | 1500 |
tagType := self readShort. |
1501 |
numberType := self readShort. |
|
1502 |
length := aStream nextLongMSB:msb. |
|
1503 |
self decodeTiffTag:tagType numberType:numberType length:length |
|
135 | 1504 |
]. |
0 | 1505 |
|
135 | 1506 |
offset := aStream nextLongMSB:msb. |
1507 |
(offset ~~ 0) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1508 |
'TIFFReader [info]: more tags ignored' infoPrintCR |
135 | 1509 |
]. |
0 | 1510 |
|
135 | 1511 |
"check for required tags" |
1512 |
ok := true. |
|
1513 |
width isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1514 |
'TIFFReader [warning]: missing width tag' errorPrintCR. |
192 | 1515 |
ok := false |
135 | 1516 |
]. |
0 | 1517 |
|
135 | 1518 |
height isNil ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1519 |
'TIFFReader [warning]: missing length tag' errorPrintCR. |
192 | 1520 |
ok := false |
135 | 1521 |
]. |
1522 |
||
1523 |
photometric isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1524 |
'TIFFReader [warning]: missing photometric tag' errorPrintCR. |
192 | 1525 |
ok := false |
135 | 1526 |
]. |
1527 |
||
1528 |
stripOffsets isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1529 |
'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR. |
192 | 1530 |
ok := false |
0 | 1531 |
]. |
1532 |
||
1533 |
stripByteCounts isNil ifTrue:[ |
|
192 | 1534 |
stripOffsets size == 1 ifTrue:[ |
1535 |
stripByteCounts := Array with:(self bitsPerPixel // 8) * width * height |
|
1536 |
] |
|
135 | 1537 |
]. |
1538 |
||
1539 |
stripByteCounts isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1540 |
'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR. |
192 | 1541 |
ok := false |
135 | 1542 |
]. |
1543 |
||
1544 |
ok ifFalse:[ |
|
192 | 1545 |
^ nil |
0 | 1546 |
]. |
1547 |
||
334 | 1548 |
dimensionCallBack notNil ifTrue:[ |
1549 |
dimensionCallBack value:self |
|
1550 |
]. |
|
1551 |
||
135 | 1552 |
"given all the information, read the bits" |
0 | 1553 |
|
135 | 1554 |
rowsPerStrip isNil ifTrue:[ |
192 | 1555 |
rowsPerStrip := height |
0 | 1556 |
]. |
1557 |
||
135 | 1558 |
ok := false. |
1559 |
(compression == 1) ifTrue:[ |
|
192 | 1560 |
result := self readUncompressedTiffImageData. |
1561 |
ok := true |
|
135 | 1562 |
]. |
1563 |
(compression == 2) ifTrue:[ |
|
192 | 1564 |
result := self readCCITT3RLETiffImageData. |
1565 |
ok := true |
|
135 | 1566 |
]. |
1567 |
(compression == 3) ifTrue:[ |
|
192 | 1568 |
result := self readCCITTGroup3TiffImageData. |
1569 |
ok := true |
|
135 | 1570 |
]. |
1571 |
(compression == 4) ifTrue:[ |
|
192 | 1572 |
result := self readCCITTGroup4TiffImageData. |
1573 |
ok := true |
|
135 | 1574 |
]. |
1575 |
(compression == 5) ifTrue:[ |
|
192 | 1576 |
result := self readLZWTiffImageData. |
1577 |
ok := true |
|
135 | 1578 |
]. |
1579 |
(compression == 6) ifTrue:[ |
|
192 | 1580 |
result := self readJPEGTiffImageData. |
1581 |
ok := true |
|
135 | 1582 |
]. |
1583 |
(compression == 32766) ifTrue:[ |
|
192 | 1584 |
result := self readNeXTRLE2TiffImageData. |
1585 |
ok := true |
|
135 | 1586 |
]. |
1587 |
(compression == 32771) ifTrue:[ |
|
192 | 1588 |
result := self readCCITTRLEWTiffImageData. |
1589 |
ok := true |
|
135 | 1590 |
]. |
1591 |
(compression == 32773) ifTrue:[ |
|
192 | 1592 |
result := self readPackbitsTiffImageData. |
1593 |
ok := true |
|
135 | 1594 |
]. |
1595 |
(compression == 32865) ifTrue:[ |
|
192 | 1596 |
result := self readNeXTJPEGTiffImageData. |
1597 |
ok := true |
|
135 | 1598 |
]. |
1599 |
ok ifFalse:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1600 |
'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1601 |
' not known' errorPrintCR |
135 | 1602 |
]. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1603 |
|
393 | 1604 |
orientation == #vFlip ifTrue:[ |
1605 |
"/ reverse rows to top-to bottom |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1606 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1607 |
bytesPerRow := self bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1608 |
tmp := ByteArray new:bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1609 |
offset1 := 1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1610 |
offset2 := (height-1)*bytesPerRow + 1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1611 |
0 to:(height-1//2) do:[:row | |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1612 |
tmp replaceFrom:1 to:bytesPerRow |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1613 |
with:data startingAt:offset1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1614 |
data replaceFrom:offset1 to:offset1+bytesPerRow-1 |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1615 |
with:data startingAt:offset2. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1616 |
data replaceFrom:offset2 to:offset2+bytesPerRow-1 |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1617 |
with:tmp startingAt:1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1618 |
offset1 := offset1 + bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1619 |
offset2 := offset2 - bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1620 |
]. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1621 |
]. |
393 | 1622 |
orientation == #unsupported ifTrue:[ |
1623 |
'TIFFReader [warning]: unsupported orientation' errorPrintCR |
|
1624 |
]. |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1625 |
|
135 | 1626 |
^ result |
192 | 1627 |
|
393 | 1628 |
"Modified: 31.1.1997 / 10:51:27 / cg" |
135 | 1629 |
! ! |
0 | 1630 |
|
135 | 1631 |
!TIFFReader methodsFor:'writing to file'! |
1632 |
||
1633 |
save:image onFile:aFileName |
|
1634 |
"save image as (uncompressed) TIFF file on aFileName" |
|
0 | 1635 |
|
135 | 1636 |
|pos1 pos| |
0 | 1637 |
|
135 | 1638 |
outStream := FileStream newFileNamed:aFileName. |
1639 |
outStream isNil ifTrue:[ |
|
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1640 |
^ Image fileCreationErrorSignal |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1641 |
raiseWith:image |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1642 |
errorString:('file creation error: ' , aFileName asString). |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1643 |
]. |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1644 |
|
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1645 |
image mask notNil ifTrue:[ |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1646 |
Image informationLostQuerySignal |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1647 |
raiseWith:image |
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1648 |
errorString:('TIFF writer does not (yet) support an imageMask'). |
0 | 1649 |
]. |
1650 |
||
135 | 1651 |
"save as msb" |
1652 |
||
1653 |
byteOrder := #msb. |
|
1654 |
" |
|
1655 |
byteOrder := #lsb. |
|
1656 |
" |
|
1657 |
fillOrder := #msb. |
|
1658 |
width := image width. |
|
1659 |
height := image height. |
|
1660 |
photometric := image photometric. |
|
1661 |
samplesPerPixel := image samplesPerPixel. |
|
1662 |
bitsPerSample := image bitsPerSample. |
|
1663 |
colorMap := image colorMap. |
|
1664 |
planarConfiguration := 1. |
|
1665 |
compression := 1. "none" |
|
1666 |
data := image bits. |
|
1667 |
||
1668 |
currentOffset := 0. |
|
1669 |
||
1670 |
(byteOrder == #msb) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1671 |
outStream nextPut:$M. outStream nextPut:$M. |
135 | 1672 |
] ifFalse:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1673 |
outStream nextPut:$I. outStream nextPut:$I. |
0 | 1674 |
]. |
135 | 1675 |
currentOffset := currentOffset + 2. |
0 | 1676 |
|
135 | 1677 |
outStream binary. |
1678 |
||
1679 |
self writeShort:42. |
|
1680 |
currentOffset := currentOffset + 2. |
|
0 | 1681 |
|
135 | 1682 |
pos1 := outStream position. |
1683 |
self writeLong:0. "start of tags - filled in later" |
|
1684 |
currentOffset := currentOffset + 4. |
|
1685 |
||
1686 |
"output strips" |
|
1687 |
||
1688 |
self writeUncompressedBits. "this outputs bits as strips, sets stripOffsets and stripByteCounts" |
|
1689 |
self writeStripOffsets. "this outputs strip offsets, sets stripOffsetsPos" |
|
1690 |
self writeStripByteCounts. "this outputs strip bytecounts, sets stripByteCountPos" |
|
1691 |
self writeBitsPerSample. "this outputs bitsPerSample, sets bitsPerSamplePos" |
|
1692 |
photometric == #palette ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1693 |
self writeColorMap "this outputs colorMap, sets colorMapPos" |
0 | 1694 |
]. |
1695 |
||
135 | 1696 |
pos := outStream position. "backpatch tag offset" |
1697 |
outStream position:pos1. |
|
1698 |
self writeLong:(pos - 1). "fill in tag offset" |
|
1699 |
outStream position:pos. |
|
1700 |
" |
|
1701 |
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ', |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1702 |
(pos printStringRadix:16)) printNewline. |
135 | 1703 |
" |
1704 |
"output tag data" |
|
0 | 1705 |
|
135 | 1706 |
photometric == #palette ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1707 |
self writeShort:11. "11 tags" |
135 | 1708 |
] ifFalse:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1709 |
self writeShort:10. "10 tags" |
135 | 1710 |
]. |
1711 |
self writeTag:256. "image width" |
|
1712 |
self writeTag:257. "image height" |
|
1713 |
self writeTag:258. "bits per sample" |
|
1714 |
self writeTag:259. "compression" |
|
1715 |
self writeTag:262. "photometric" |
|
1716 |
self writeTag:273. "strip offsets" |
|
159
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
1717 |
self writeTag:277. "samplesPerPixel" |
135 | 1718 |
self writeTag:278. "rowsPerStrip" |
1719 |
self writeTag:279. "strip byte counts" |
|
1720 |
self writeTag:284. "planarconfig" |
|
1721 |
photometric == #palette ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1722 |
self writeTag:320 "colorMap" |
135 | 1723 |
]. |
1724 |
self writeLong:0. "end of tags mark" |
|
1725 |
outStream close |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1726 |
|
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1727 |
"Modified: 27.2.1997 / 12:46:26 / cg" |
135 | 1728 |
! ! |
30 | 1729 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1730 |
!TIFFReader class methodsFor:'documentation'! |
30 | 1731 |
|
135 | 1732 |
version |
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
1733 |
^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.50 1997-02-27 11:50:14 cg Exp $' |
0 | 1734 |
! ! |
135 | 1735 |
TIFFReader initialize! |