author | ca |
Tue, 11 Feb 1997 20:02:28 +0100 | |
changeset 410 | 2d21748e0d9c |
parent 398 | aef700d15416 |
child 440 | fa1e1a56ea43 |
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" |
0 | 697 |
! |
698 |
||
135 | 699 |
readCCITT3RLETiffImageData |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
700 |
'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
701 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
702 |
"Modified: 10.1.1997 / 18:09:02 / cg" |
135 | 703 |
! |
704 |
||
705 |
readCCITT3RLEWTiffImageData |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
706 |
'TIFFReader [warning]: ccitt mod Huffman (rlew) compression not implemented' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
707 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
708 |
"Modified: 10.1.1997 / 18:09:11 / cg" |
135 | 709 |
! |
710 |
||
711 |
readCCITTGroup3TiffImageData |
|
712 |
"not really tested - all I got is a single |
|
713 |
fax from NeXT step" |
|
714 |
||
715 |
|bytesPerRow bitsPerRow compressedStrip nPlanes |
|
716 |
stripNr "{ Class: SmallInteger }" |
|
717 |
offset "{ Class: SmallInteger }" |
|
718 |
row "{ Class: SmallInteger }" |
|
719 |
bytesPerStrip "{ Class: SmallInteger }" | |
|
720 |
||
721 |
nPlanes := samplesPerPixel. |
|
722 |
(nPlanes == 2) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
723 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
335 | 724 |
nPlanes := 1 |
135 | 725 |
]. |
726 |
||
727 |
(nPlanes ~~ 1) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
728 |
'TIFFReader [warning]: only monochrome/greyscale supported' errorPrintCR. |
335 | 729 |
^ nil |
135 | 730 |
]. |
0 | 731 |
|
135 | 732 |
stripByteCounts isNil ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
733 |
'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR. |
335 | 734 |
^ nil |
135 | 735 |
]. |
736 |
(rowsPerStrip ~~ 1) isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
737 |
'TIFFReader [warning]: currently require rowsPerStrip to be 1' errorPrintCR. |
335 | 738 |
^ nil |
135 | 739 |
]. |
740 |
||
335 | 741 |
"/ 'TIFFReader: decompressing CCITT-3 ...' infoPrintNL. |
135 | 742 |
|
743 |
bitsPerRow := width * (bitsPerSample at:1). |
|
744 |
bytesPerRow := bitsPerRow // 8. |
|
745 |
((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
335 | 746 |
bytesPerRow := bytesPerRow + 1 |
135 | 747 |
]. |
748 |
||
749 |
data := ByteArray new:(bytesPerRow * height). |
|
750 |
compressedStrip := ByteArray uninitializedNew:bytesPerRow. |
|
751 |
||
752 |
offset := 1. |
|
753 |
stripNr := 0. |
|
754 |
||
755 |
row := 1. |
|
756 |
bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
757 |
[row <= height] whileTrue:[ |
|
335 | 758 |
stripNr := stripNr + 1. |
759 |
inStream position:((stripOffsets at:stripNr) + 1). |
|
760 |
inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip. |
|
761 |
self class decompressCCITT3From:compressedStrip |
|
762 |
into:data |
|
763 |
startingAt:offset |
|
764 |
count:width. |
|
765 |
offset := offset + bytesPerStrip. |
|
766 |
row := row + rowsPerStrip |
|
135 | 767 |
] |
335 | 768 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
769 |
"Modified: 10.1.1997 / 18:14:56 / cg" |
135 | 770 |
! |
771 |
||
772 |
readCCITTGroup4TiffImageData |
|
359 | 773 |
'TIFFReader [warning]: ccitt group4 fax compression not implemented' errorPrintCR. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
774 |
|
359 | 775 |
"Modified: 10.1.1997 / 19:10:59 / cg" |
135 | 776 |
! |
0 | 777 |
|
135 | 778 |
readChars:n |
779 |
"read n characters and return them in a string" |
|
780 |
||
781 |
|oldPos offset string| |
|
782 |
||
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
783 |
n == 0 ifTrue:[^ '']. |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
784 |
|
135 | 785 |
string := String new:(n - 1). |
786 |
(n <= 4) ifTrue:[ |
|
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
787 |
inStream nextBytes:(n - 1) into:string |
135 | 788 |
] ifFalse:[ |
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
789 |
offset := inStream nextLongMSB:(byteOrder ~~ #lsb). |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
790 |
oldPos := inStream position. |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
791 |
inStream position:(offset + 1). |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
792 |
inStream nextBytes:(n - 1) into:string. |
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
793 |
inStream position:oldPos |
135 | 794 |
]. |
795 |
^ string |
|
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
796 |
|
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
797 |
"Modified: 5.9.1996 / 12:21:08 / cg" |
135 | 798 |
! |
799 |
||
800 |
readFracts:nFracts |
|
801 |
"read nFracts fractions (2 32bit words) and return them in an array" |
|
802 |
||
803 |
|oldPos offset values numerator denominator msb |
|
804 |
n "{ Class: SmallInteger }" | |
|
805 |
||
806 |
n := nFracts. |
|
807 |
||
808 |
msb := byteOrder ~~ #lsb. |
|
809 |
values := Array basicNew:n. |
|
810 |
offset := inStream nextLongMSB:msb. |
|
811 |
oldPos := inStream position. |
|
812 |
inStream position:(offset + 1). |
|
813 |
1 to:n do:[:index | |
|
814 |
numerator := inStream nextLongMSB:msb. |
|
815 |
denominator := inStream nextLongMSB:msb. |
|
816 |
values at:index put:(Fraction numerator:numerator denominator:denominator) |
|
817 |
]. |
|
818 |
inStream position:oldPos. |
|
819 |
^ values |
|
820 |
! |
|
821 |
||
822 |
readJPEGTiffImageData |
|
359 | 823 |
'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
824 |
|
359 | 825 |
"Modified: 10.1.1997 / 19:11:02 / cg" |
135 | 826 |
! |
827 |
||
828 |
readLZWTiffImageData |
|
829 |
"read LZW compressed tiff data; this method only |
|
830 |
handles 3x8 rgb and 1x2 or 2x2 greyscale images. |
|
831 |
For 2x2 greyscale images, the alpha plane is ignored. |
|
832 |
(maybe other formats work also - its simply not |
|
833 |
tested)" |
|
834 |
||
835 |
|bytesPerRow compressedStrip nPlanes |
|
836 |
bytesPerStrip "{ Class: SmallInteger }" |
|
837 |
nBytes "{ Class: SmallInteger }" |
|
838 |
prevSize "{ Class: SmallInteger }" |
|
839 |
stripNr "{ Class: SmallInteger }" |
|
840 |
offset "{ Class: SmallInteger }" |
|
841 |
row "{ Class: SmallInteger }" | |
|
842 |
||
843 |
nPlanes := samplesPerPixel. |
|
844 |
||
845 |
(nPlanes == 3) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
846 |
(((bitsPerSample at:1) ~~ 8) |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
847 |
or:[((bitsPerSample at:2) ~~ 8) |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
848 |
or:[((bitsPerSample at:3) ~~ 8)]]) ifTrue:[ |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
849 |
'TIFFReader [warning]: only 8/8/8 bit/sample are supported' errorPrintCR. |
335 | 850 |
^ nil |
851 |
]. |
|
852 |
bytesPerRow := width * samplesPerPixel. |
|
0 | 853 |
] ifFalse:[ |
335 | 854 |
(nPlanes == 2) ifTrue:[ |
855 |
(planarConfiguration ~~ 2) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
856 |
'TIFFReader [warning]: only separate planes are supported' errorPrintCR. |
335 | 857 |
^ nil |
858 |
]. |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
859 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
335 | 860 |
nPlanes := 1 |
861 |
]. |
|
862 |
(nPlanes == 1) ifFalse:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
863 |
'TIFFReader [warning]: only 3-sample rgb / monochrome supported' errorPrintCR. |
335 | 864 |
^ nil |
865 |
]. |
|
866 |
bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8. |
|
135 | 867 |
]. |
868 |
||
869 |
stripByteCounts isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
870 |
'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR. |
335 | 871 |
^ nil |
135 | 872 |
]. |
873 |
||
335 | 874 |
"/ 'TIFFReader: decompressing LZW ...' infoPrintNL. |
135 | 875 |
|
876 |
data := ByteArray uninitializedNew:(bytesPerRow * height). |
|
877 |
||
878 |
offset := 1. |
|
879 |
stripNr := 0. |
|
880 |
||
881 |
row := 1. |
|
882 |
bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
883 |
prevSize := 0. |
|
884 |
[row <= height] whileTrue:[ |
|
335 | 885 |
stripNr := stripNr + 1. |
886 |
inStream position:((stripOffsets at:stripNr) + 1). |
|
887 |
nBytes := stripByteCounts at:stripNr. |
|
888 |
(nBytes > prevSize) ifTrue:[ |
|
889 |
compressedStrip := ByteArray uninitializedNew:nBytes. |
|
890 |
prevSize := nBytes |
|
891 |
]. |
|
892 |
inStream nextBytes:nBytes |
|
893 |
into:compressedStrip. |
|
894 |
self class decompressLZWFrom:compressedStrip |
|
895 |
count:nBytes |
|
896 |
into:data |
|
897 |
startingAt:offset. |
|
898 |
offset := offset + bytesPerStrip. |
|
899 |
row := row + rowsPerStrip |
|
135 | 900 |
]. |
901 |
||
902 |
(predictor == 2) ifTrue:[ |
|
335 | 903 |
self class decodeDelta:3 in:data width:width height:height |
135 | 904 |
] |
335 | 905 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
906 |
"Modified: 10.1.1997 / 18:13:21 / cg" |
135 | 907 |
! |
908 |
||
909 |
readLongs:nLongs |
|
910 |
"read nLongs long numbers (32bit) and return them in an array" |
|
911 |
||
912 |
|oldPos offset values msb |
|
913 |
n "{ Class: SmallInteger }" | |
|
914 |
||
915 |
n := nLongs. |
|
916 |
||
917 |
msb := byteOrder ~~ #lsb. |
|
918 |
values := Array basicNew:n. |
|
919 |
(n == 1) ifTrue:[ |
|
920 |
values at:1 put:(inStream nextLongMSB:msb). |
|
921 |
] ifFalse:[ |
|
922 |
offset := inStream nextLongMSB:msb. |
|
923 |
oldPos := inStream position. |
|
924 |
inStream position:(offset + 1). |
|
925 |
1 to:n do:[:index | |
|
926 |
values at:index put:(inStream nextLongMSB:msb) |
|
927 |
]. |
|
928 |
inStream position:oldPos |
|
929 |
]. |
|
930 |
^ values |
|
931 |
! |
|
932 |
||
933 |
readNeXTJPEGTiffImageData |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
934 |
'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
935 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
936 |
"Modified: 10.1.1997 / 18:11:04 / cg" |
135 | 937 |
! |
938 |
||
939 |
readNeXTRLE2TiffImageData |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
940 |
'TIFFReader [warning]: next 2bit rle compression not implemented' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
941 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
942 |
"Modified: 10.1.1997 / 18:11:01 / cg" |
135 | 943 |
! |
944 |
||
945 |
readPackbitsTiffImageData |
|
946 |
"had no samples yet - however, packbits decompression |
|
947 |
is rather trivial to add ..." |
|
948 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
949 |
'TIFFReader [warning]: packbits compression not implemented' errorPrintCR |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
950 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
951 |
"Modified: 10.1.1997 / 18:10:57 / cg" |
135 | 952 |
! |
953 |
||
954 |
readShorts:nShorts |
|
955 |
"read nShorts short numbers (16bit) and return them in an array" |
|
956 |
||
957 |
|oldPos offset values msb val2 |
|
958 |
n "{ Class: SmallInteger }" | |
|
0 | 959 |
|
135 | 960 |
n := nShorts. |
961 |
||
962 |
msb := (byteOrder ~~ #lsb). |
|
963 |
values := Array basicNew:n. |
|
964 |
(n <= 2) ifTrue:[ |
|
965 |
values at:1 put:(inStream nextUnsignedShortMSB:msb). |
|
966 |
val2 := inStream nextUnsignedShortMSB:msb. |
|
967 |
||
968 |
(n == 2) ifTrue:[ |
|
969 |
values at:2 put:val2 |
|
970 |
] |
|
971 |
] ifFalse:[ |
|
972 |
offset := inStream nextLongMSB:msb. |
|
973 |
oldPos := inStream position. |
|
974 |
inStream position:(offset + 1). |
|
975 |
1 to:n do:[:index | |
|
976 |
values at:index put:(inStream nextUnsignedShortMSB:msb) |
|
977 |
]. |
|
978 |
inStream position:oldPos |
|
979 |
]. |
|
980 |
^ values |
|
981 |
! |
|
982 |
||
983 |
readUncompressedTiffImageData |
|
984 |
|bytesPerRow bitsPerRow nPlanes |
|
985 |
stripNr "{ Class: SmallInteger }" |
|
986 |
offset "{ Class: SmallInteger }" |
|
987 |
row "{ Class: SmallInteger }" |
|
988 |
nBytes "{ Class: SmallInteger }" |
|
989 |
bitsPerPixel overAllBytes| |
|
990 |
||
991 |
nPlanes := samplesPerPixel. |
|
992 |
||
993 |
"only support 1-sample/pixel, |
|
994 |
with alpha - if separate planes, |
|
995 |
or rgb - if non separate planes and no alpha" |
|
996 |
||
997 |
(nPlanes == 2) ifTrue:[ |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
998 |
(planarConfiguration ~~ 2) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
999 |
'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
|
1000 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1001 |
]. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1002 |
'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
|
1003 |
nPlanes := 1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1004 |
bitsPerPixel := bitsPerSample at:1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1005 |
bitsPerSample := Array with:bitsPerPixel. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1006 |
samplesPerPixel := 1. |
135 | 1007 |
] ifFalse:[ |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1008 |
(nPlanes == 3) ifTrue:[ |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1009 |
(planarConfiguration ~~ 1) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1010 |
'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
|
1011 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1012 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1013 |
bitsPerSample ~= #(8 8 8) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1014 |
'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
|
1015 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1016 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1017 |
bitsPerPixel := 24 |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1018 |
] ifFalse:[ |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1019 |
(nPlanes ~~ 1) ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1020 |
'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
|
1021 |
^ nil |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1022 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1023 |
bitsPerPixel := bitsPerSample at:1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1024 |
] |
0 | 1025 |
]. |
135 | 1026 |
|
1027 |
bitsPerRow := width * bitsPerPixel. |
|
1028 |
bytesPerRow := bitsPerRow // 8. |
|
1029 |
((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1030 |
bytesPerRow := bytesPerRow + 1 |
135 | 1031 |
]. |
1032 |
||
1033 |
overAllBytes := bytesPerRow * height. |
|
1034 |
data := ByteArray uninitializedNew:overAllBytes. |
|
1035 |
||
336
9789b02d95bf
oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1036 |
offset := 0. |
135 | 1037 |
stripNr := 0. |
1038 |
||
1039 |
row := 1. |
|
1040 |
[row <= height] whileTrue:[ |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1041 |
stripNr := stripNr + 1. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1042 |
nBytes := stripByteCounts at:stripNr. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1043 |
inStream position:((stripOffsets at:stripNr) + 1). |
135 | 1044 |
|
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1045 |
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
|
1046 |
nBytes := overAllBytes - offset. |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1047 |
]. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1048 |
|
336
9789b02d95bf
oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1049 |
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
|
1050 |
offset := offset + nBytes. |
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1051 |
row := row + rowsPerStrip |
135 | 1052 |
] |
317
5de89b17ed48
care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
1053 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1054 |
"Modified: 10.1.1997 / 18:10:46 / cg" |
135 | 1055 |
! |
1056 |
||
1057 |
writeBitsPerSample |
|
14 | 1058 |
" |
135 | 1059 |
'bitsPerSample: ' print. bitsPerSample printNewline. |
1060 |
'store bitspersample at: ' print. outStream position printNewline. |
|
14 | 1061 |
" |
135 | 1062 |
bitsPerSamplePos := outStream position. |
1063 |
bitsPerSample do:[:n | |
|
1064 |
self writeShort:n |
|
1065 |
] |
|
0 | 1066 |
! |
1067 |
||
1068 |
writeColorMap |
|
28 | 1069 |
|n| |
1070 |
||
0 | 1071 |
colorMapPos := outStream position. |
35 | 1072 |
#(red green blue) do:[:component | |
28 | 1073 |
n := 0. |
35 | 1074 |
colorMap do:[:clr | |
1075 |
|entry| |
|
1076 |
||
1077 |
clr isNil ifTrue:[ |
|
1078 |
entry := 0 |
|
28 | 1079 |
] ifFalse:[ |
35 | 1080 |
entry := clr perform:component. |
1081 |
" |
|
1082 |
tiff map is 16 bit - scale from percent to 0..16rFFFF |
|
1083 |
" |
|
1084 |
entry := (entry * 16rFFFF / 100) rounded. |
|
28 | 1085 |
]. |
35 | 1086 |
self writeShort:entry. |
28 | 1087 |
n := n + 1 |
1088 |
]. |
|
1089 |
" |
|
1090 |
fill to 256 entries |
|
1091 |
" |
|
1092 |
[n < 256] whileTrue:[ |
|
1093 |
self writeShort:0. |
|
1094 |
n := n + 1. |
|
1095 |
] |
|
0 | 1096 |
] |
1097 |
! |
|
1098 |
||
1099 |
writeStripByteCounts |
|
3 | 1100 |
" |
0 | 1101 |
'stripByteCounts: ' print. stripByteCounts printNewline. |
1102 |
'store stripbytecounts at: ' print. outStream position printNewline. |
|
3 | 1103 |
" |
0 | 1104 |
stripByteCountsPos := outStream position. |
1105 |
stripByteCounts do:[:c | |
|
28 | 1106 |
self writeShort:c |
0 | 1107 |
] |
1108 |
! |
|
1109 |
||
135 | 1110 |
writeStripOffsets |
3 | 1111 |
" |
135 | 1112 |
'stripOffsets: ' print. stripOffsets printNewline. |
1113 |
'store stripoffsets at: ' print. outStream position printNewline. |
|
3 | 1114 |
" |
135 | 1115 |
stripOffsetsPos := outStream position. |
1116 |
stripOffsets do:[:o | |
|
1117 |
self writeLong:o |
|
0 | 1118 |
] |
1119 |
! |
|
1120 |
||
1121 |
writeTag:tagType |
|
1122 |
self writeTiffTag:tagType. |
|
1123 |
! |
|
1124 |
||
1125 |
writeTiffTag:tagType |
|
1126 |
|value valueArray numberType count address| |
|
1127 |
||
1128 |
count := 1. |
|
1129 |
address := nil. |
|
1130 |
(tagType == 253) ifTrue:[ |
|
28 | 1131 |
"tiff class" |
0 | 1132 |
]. |
1133 |
(tagType == 254) ifTrue:[ |
|
1134 |
]. |
|
1135 |
(tagType == 255) ifTrue:[ |
|
28 | 1136 |
"SubfileType" |
1137 |
value := subFileType. |
|
1138 |
numberType := #long. |
|
0 | 1139 |
]. |
1140 |
(tagType == 256) ifTrue:[ |
|
28 | 1141 |
"ImageWidth" |
1142 |
value := width. |
|
1143 |
numberType := #short. |
|
0 | 1144 |
]. |
1145 |
(tagType == 257) ifTrue:[ |
|
28 | 1146 |
"ImageHeight" |
1147 |
value := height. |
|
1148 |
numberType := #short. |
|
0 | 1149 |
]. |
1150 |
(tagType == 258) ifTrue:[ |
|
28 | 1151 |
"bitspersample" |
1152 |
address := bitsPerSamplePos - 1. |
|
1153 |
numberType := #short. |
|
1154 |
count := bitsPerSample size. |
|
1155 |
valueArray := bitsPerSample |
|
0 | 1156 |
]. |
1157 |
(tagType == 259) ifTrue:[ |
|
28 | 1158 |
"compression" |
1159 |
value := compression. |
|
1160 |
numberType := #short. |
|
0 | 1161 |
]. |
1162 |
(tagType == 262) ifTrue:[ |
|
28 | 1163 |
"photometric" |
1164 |
(photometric == #whiteIs0) ifTrue:[ |
|
1165 |
value := 0 |
|
1166 |
] ifFalse:[ |
|
1167 |
(photometric == #blackIs0) ifTrue:[ |
|
1168 |
value := 1 |
|
1169 |
] ifFalse:[ |
|
1170 |
(photometric == #rgb) ifTrue:[ |
|
1171 |
value := 2 |
|
1172 |
] ifFalse:[ |
|
1173 |
(photometric == #palette) ifTrue:[ |
|
1174 |
value := 3 |
|
1175 |
] ifFalse:[ |
|
1176 |
(photometric == #transparency) ifTrue:[ |
|
1177 |
value := 4 |
|
1178 |
] ifFalse:[ |
|
1179 |
self error:'bad photometric' |
|
1180 |
] |
|
1181 |
] |
|
1182 |
] |
|
1183 |
] |
|
1184 |
]. |
|
1185 |
numberType := #short. |
|
0 | 1186 |
]. |
1187 |
(tagType == 263) ifTrue:[ |
|
1188 |
]. |
|
1189 |
(tagType == 264) ifTrue:[ |
|
1190 |
]. |
|
1191 |
(tagType == 265) ifTrue:[ |
|
1192 |
]. |
|
1193 |
(tagType == 266) ifTrue:[ |
|
28 | 1194 |
"fillOrder" |
1195 |
(fillOrder == #msb) ifTrue:[ |
|
1196 |
value := 1 |
|
1197 |
] ifFalse:[ |
|
1198 |
(fillOrder == #lsb) ifTrue:[ |
|
1199 |
value := 2 |
|
1200 |
] ifFalse:[ |
|
1201 |
self error:'bad fillOrder' |
|
1202 |
] |
|
1203 |
]. |
|
1204 |
numberType := #short. |
|
0 | 1205 |
]. |
1206 |
(tagType == 269) ifTrue:[ |
|
1207 |
]. |
|
1208 |
(tagType == 270) ifTrue:[ |
|
1209 |
]. |
|
1210 |
(tagType == 271) ifTrue:[ |
|
1211 |
]. |
|
1212 |
(tagType == 272) ifTrue:[ |
|
1213 |
]. |
|
1214 |
(tagType == 273) ifTrue:[ |
|
28 | 1215 |
"stripoffsets" |
1216 |
address := stripOffsetsPos - 1. |
|
1217 |
numberType := #long. |
|
1218 |
count := stripOffsets size. |
|
1219 |
valueArray := stripOffsets |
|
0 | 1220 |
]. |
1221 |
(tagType == 274) ifTrue:[ |
|
1222 |
]. |
|
1223 |
(tagType == 277) ifTrue:[ |
|
28 | 1224 |
"samplesPerPixel" |
1225 |
value := samplesPerPixel. |
|
1226 |
numberType := #short. |
|
0 | 1227 |
]. |
1228 |
(tagType == 278) ifTrue:[ |
|
28 | 1229 |
"rowsperstrip" |
1230 |
value := rowsPerStrip. |
|
1231 |
numberType := #short. |
|
0 | 1232 |
]. |
1233 |
(tagType == 279) ifTrue:[ |
|
28 | 1234 |
"stripbytecount" |
1235 |
address := stripByteCountsPos - 1. |
|
1236 |
numberType := #short. |
|
1237 |
count := stripByteCounts size. |
|
1238 |
valueArray := stripByteCounts |
|
0 | 1239 |
]. |
1240 |
(tagType == 280) ifTrue:[ |
|
28 | 1241 |
"min sample value" |
0 | 1242 |
]. |
1243 |
(tagType == 281) ifTrue:[ |
|
28 | 1244 |
"max sample value" |
0 | 1245 |
]. |
1246 |
(tagType == 282) ifTrue:[ |
|
28 | 1247 |
"x resolution" |
0 | 1248 |
]. |
1249 |
(tagType == 283) ifTrue:[ |
|
28 | 1250 |
"y resolution" |
0 | 1251 |
]. |
1252 |
(tagType == 284) ifTrue:[ |
|
28 | 1253 |
"planarconfig" |
1254 |
value := planarConfiguration. |
|
1255 |
numberType := #short. |
|
0 | 1256 |
]. |
1257 |
(tagType == 285) ifTrue:[ |
|
28 | 1258 |
"pageName" |
0 | 1259 |
]. |
1260 |
(tagType == 286) ifTrue:[ |
|
28 | 1261 |
"xPosition" |
0 | 1262 |
]. |
1263 |
(tagType == 287) ifTrue:[ |
|
28 | 1264 |
"yPosition" |
0 | 1265 |
]. |
1266 |
(tagType == 288) ifTrue:[ |
|
28 | 1267 |
"freeOffsets" |
0 | 1268 |
]. |
1269 |
(tagType == 289) ifTrue:[ |
|
28 | 1270 |
"freeByteCounts" |
0 | 1271 |
]. |
1272 |
(tagType == 290) ifTrue:[ |
|
28 | 1273 |
"grayResponceUnit" |
0 | 1274 |
]. |
1275 |
(tagType == 291) ifTrue:[ |
|
28 | 1276 |
"grayResponceCurve" |
0 | 1277 |
]. |
1278 |
(tagType == 292) ifTrue:[ |
|
28 | 1279 |
"group3options" |
1280 |
value := group3options. |
|
1281 |
numberType := #long. |
|
0 | 1282 |
]. |
1283 |
(tagType == 293) ifTrue:[ |
|
28 | 1284 |
"group4options" |
0 | 1285 |
]. |
1286 |
(tagType == 296) ifTrue:[ |
|
28 | 1287 |
"resolutionunit" |
1288 |
^ self |
|
0 | 1289 |
]. |
1290 |
(tagType == 297) ifTrue:[ |
|
28 | 1291 |
"pageNumber" |
0 | 1292 |
]. |
1293 |
(tagType == 300) ifTrue:[ |
|
28 | 1294 |
"colorResponceUnit" |
0 | 1295 |
]. |
1296 |
(tagType == 301) ifTrue:[ |
|
28 | 1297 |
"colorResponceCurve" |
0 | 1298 |
]. |
1299 |
(tagType == 306) ifTrue:[ |
|
28 | 1300 |
"dateTime" |
0 | 1301 |
]. |
1302 |
(tagType == 315) ifTrue:[ |
|
28 | 1303 |
"artist" |
0 | 1304 |
]. |
1305 |
(tagType == 317) ifTrue:[ |
|
28 | 1306 |
"predictor" |
0 | 1307 |
]. |
1308 |
(tagType == 320) ifTrue:[ |
|
28 | 1309 |
"colormap" |
1310 |
address := colorMapPos - 1. |
|
1311 |
numberType := #short. |
|
1312 |
count := 256 "(colorMap at:1) size" * 3. |
|
0 | 1313 |
]. |
1314 |
||
1315 |
(value isNil and:[address isNil]) ifTrue:[ |
|
28 | 1316 |
self error:'unhandled tag'. |
1317 |
^ self |
|
0 | 1318 |
]. |
1319 |
||
14 | 1320 |
" |
0 | 1321 |
'tag:' print. tagType print. ' typ:' print. numberType print. |
1322 |
' len:' print. count print. |
|
1323 |
' val:' print. value printNewline. |
|
14 | 1324 |
" |
0 | 1325 |
|
1326 |
self writeShort:tagType. |
|
1327 |
numberType == #short ifTrue:[ |
|
28 | 1328 |
self writeShort:3. |
1329 |
self writeLong:count. |
|
0 | 1330 |
] ifFalse:[ |
28 | 1331 |
numberType == #long ifTrue:[ |
1332 |
self writeShort:4. |
|
1333 |
self writeLong:count. |
|
1334 |
] ifFalse:[ |
|
1335 |
numberType == #byte ifTrue:[ |
|
1336 |
self writeShort:1. |
|
1337 |
self writeLong:count. |
|
1338 |
] ifFalse:[ |
|
1339 |
self error:'bad numbertype' |
|
1340 |
] |
|
1341 |
] |
|
0 | 1342 |
]. |
1343 |
address notNil ifTrue:[ |
|
28 | 1344 |
(numberType == #long and:[count == 1]) ifTrue:[ |
1345 |
self writeLong:(valueArray at:1). |
|
1346 |
^ self |
|
1347 |
]. |
|
1348 |
(numberType == #short and:[count <= 2]) ifTrue:[ |
|
1349 |
self writeShort:(valueArray at:1). |
|
1350 |
count == 2 ifTrue:[ |
|
1351 |
self writeShort:(valueArray at:2). |
|
1352 |
] ifFalse:[ |
|
1353 |
self writeShort:0 |
|
1354 |
]. |
|
1355 |
^ self |
|
1356 |
]. |
|
1357 |
(numberType == #byte and:[count <= 4]) ifTrue:[ |
|
1358 |
outStream nextPut:(valueArray at:1). |
|
1359 |
count > 1 ifTrue:[ |
|
1360 |
outStream nextPut:(valueArray at:2). |
|
1361 |
count > 2 ifTrue:[ |
|
1362 |
outStream nextPut:(valueArray at:3). |
|
1363 |
count > 3 ifTrue:[ |
|
1364 |
outStream nextPut:(valueArray at:4). |
|
1365 |
] ifFalse:[ |
|
1366 |
outStream nextPut:0 |
|
1367 |
]. |
|
1368 |
] ifFalse:[ |
|
1369 |
outStream nextPut:0 |
|
1370 |
]. |
|
1371 |
] ifFalse:[ |
|
1372 |
outStream nextPut:0 |
|
1373 |
]. |
|
1374 |
^ self |
|
1375 |
]. |
|
1376 |
self writeLong:address. |
|
1377 |
^ self |
|
0 | 1378 |
]. |
1379 |
numberType == #short ifTrue:[ |
|
28 | 1380 |
self writeShort:value. |
1381 |
self writeShort:0 |
|
0 | 1382 |
] ifFalse:[ |
28 | 1383 |
numberType == #long ifTrue:[ |
1384 |
self writeLong:value |
|
1385 |
] ifFalse:[ |
|
1386 |
numberType == #byte ifTrue:[ |
|
1387 |
outStream nextPut:value. |
|
1388 |
outStream nextPut:0. |
|
1389 |
outStream nextPut:0. |
|
1390 |
outStream nextPut:0. |
|
1391 |
] ifFalse:[ |
|
1392 |
self error:'bad numbertype' |
|
1393 |
] |
|
1394 |
] |
|
0 | 1395 |
]. |
1396 |
! |
|
1397 |
||
135 | 1398 |
writeUncompressedBits |
1399 |
"write bits as one or multiple strips" |
|
1400 |
||
1401 |
|offs bytesPerRow nBytes |
|
1402 |
h "{ Class: SmallInteger }"| |
|
0 | 1403 |
|
135 | 1404 |
nBytes := data size. |
1405 |
nBytes < 16rFFFF ifTrue:[ |
|
1406 |
stripOffsets := Array with:(outStream position - 1). |
|
1407 |
stripByteCounts := Array with:nBytes. |
|
1408 |
outStream nextPutBytes:nBytes from:data. |
|
1409 |
rowsPerStrip := height |
|
1410 |
] ifFalse:[ |
|
1411 |
stripOffsets := Array basicNew:height. |
|
1412 |
bytesPerRow := nBytes // height. |
|
1413 |
stripByteCounts := (Array basicNew:height) atAllPut:bytesPerRow. |
|
0 | 1414 |
|
135 | 1415 |
offs := 1. |
1416 |
h := height. |
|
1417 |
1 to:h do:[:row | |
|
1418 |
stripOffsets at:row put:(outStream position - 1). |
|
1419 |
outStream nextPutBytes:bytesPerRow from:data startingAt:offs. |
|
1420 |
offs := offs + bytesPerRow |
|
28 | 1421 |
]. |
135 | 1422 |
rowsPerStrip := 1 |
1423 |
]. |
|
1424 |
" |
|
1425 |
'stripOffsets: ' print. stripOffsets printNewline. |
|
1426 |
'stripByteCounts: ' print. stripByteCounts printNewline. |
|
1427 |
" |
|
1428 |
! ! |
|
1429 |
||
1430 |
!TIFFReader methodsFor:'reading from file'! |
|
1431 |
||
1432 |
fromStream:aStream |
|
192 | 1433 |
"read a stream containing a TIFF image. |
1434 |
Leave image description in instance variables." |
|
135 | 1435 |
|
1436 |
|char1 char2 version |
|
1437 |
numberOfTags "{ Class: SmallInteger }" |
|
1438 |
tagType "{ Class: SmallInteger }" |
|
1439 |
numberType "{ Class: SmallInteger }" |
|
1440 |
length "{ Class: SmallInteger }" |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1441 |
result offset ok msb |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1442 |
bitsPerPixel bytesPerRow offset1 offset2 tmp| |
135 | 1443 |
|
1444 |
inStream := aStream. |
|
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1445 |
aStream binary. |
135 | 1446 |
|
1447 |
char1 := aStream next. |
|
1448 |
char2 := aStream next. |
|
1449 |
(char1 ~~ char2) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1450 |
'TIFFReader [warning]: not a tiff file' errorPrintCR. |
192 | 1451 |
^ nil |
135 | 1452 |
]. |
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1453 |
(char1 == $I asciiValue) ifTrue:[ |
192 | 1454 |
byteOrder := #lsb. |
1455 |
msb := false. |
|
0 | 1456 |
] ifFalse:[ |
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1457 |
(char1 == $M asciiValue) ifTrue:[ |
192 | 1458 |
byteOrder := #msb. |
1459 |
msb := true. |
|
1460 |
] ifFalse:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1461 |
'TIFFReader [warning]: not a tiff file' errorPrintCR. |
192 | 1462 |
^ nil |
1463 |
] |
|
0 | 1464 |
]. |
1465 |
||
135 | 1466 |
version := self readShort. |
1467 |
(version ~~ 42) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1468 |
'TIFFReader [warning]: version of tiff-file not supported' errorPrintCR. |
192 | 1469 |
^ nil |
0 | 1470 |
]. |
1471 |
||
135 | 1472 |
"setup default values" |
0 | 1473 |
|
135 | 1474 |
compression := 1. "none" |
1475 |
fillOrder := #msb. |
|
1476 |
planarConfiguration := 1. |
|
1477 |
photometric := nil. |
|
1478 |
bitsPerSample := 1. |
|
1479 |
samplesPerPixel := 1. |
|
1480 |
width := nil. |
|
1481 |
height := nil. |
|
1482 |
stripOffsets := nil. |
|
1483 |
rowsPerStrip := nil. |
|
1484 |
"resolutionUnit := 2." |
|
1485 |
predictor := 1. |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1486 |
orientation := nil. |
0 | 1487 |
|
135 | 1488 |
offset := aStream nextLongMSB:msb. |
1489 |
aStream position:offset + 1. |
|
1490 |
||
1491 |
numberOfTags := self readShort. |
|
1492 |
1 to:numberOfTags do:[:index | |
|
192 | 1493 |
tagType := self readShort. |
1494 |
numberType := self readShort. |
|
1495 |
length := aStream nextLongMSB:msb. |
|
1496 |
self decodeTiffTag:tagType numberType:numberType length:length |
|
135 | 1497 |
]. |
0 | 1498 |
|
135 | 1499 |
offset := aStream nextLongMSB:msb. |
1500 |
(offset ~~ 0) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1501 |
'TIFFReader [info]: more tags ignored' infoPrintCR |
135 | 1502 |
]. |
0 | 1503 |
|
135 | 1504 |
"check for required tags" |
1505 |
ok := true. |
|
1506 |
width isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1507 |
'TIFFReader [warning]: missing width tag' errorPrintCR. |
192 | 1508 |
ok := false |
135 | 1509 |
]. |
0 | 1510 |
|
135 | 1511 |
height isNil ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1512 |
'TIFFReader [warning]: missing length tag' errorPrintCR. |
192 | 1513 |
ok := false |
135 | 1514 |
]. |
1515 |
||
1516 |
photometric isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1517 |
'TIFFReader [warning]: missing photometric tag' errorPrintCR. |
192 | 1518 |
ok := false |
135 | 1519 |
]. |
1520 |
||
1521 |
stripOffsets isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1522 |
'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR. |
192 | 1523 |
ok := false |
0 | 1524 |
]. |
1525 |
||
1526 |
stripByteCounts isNil ifTrue:[ |
|
192 | 1527 |
stripOffsets size == 1 ifTrue:[ |
1528 |
stripByteCounts := Array with:(self bitsPerPixel // 8) * width * height |
|
1529 |
] |
|
135 | 1530 |
]. |
1531 |
||
1532 |
stripByteCounts isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1533 |
'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR. |
192 | 1534 |
ok := false |
135 | 1535 |
]. |
1536 |
||
1537 |
ok ifFalse:[ |
|
192 | 1538 |
^ nil |
0 | 1539 |
]. |
1540 |
||
334 | 1541 |
dimensionCallBack notNil ifTrue:[ |
1542 |
dimensionCallBack value:self |
|
1543 |
]. |
|
1544 |
||
135 | 1545 |
"given all the information, read the bits" |
0 | 1546 |
|
135 | 1547 |
rowsPerStrip isNil ifTrue:[ |
192 | 1548 |
rowsPerStrip := height |
0 | 1549 |
]. |
1550 |
||
135 | 1551 |
ok := false. |
1552 |
(compression == 1) ifTrue:[ |
|
192 | 1553 |
result := self readUncompressedTiffImageData. |
1554 |
ok := true |
|
135 | 1555 |
]. |
1556 |
(compression == 2) ifTrue:[ |
|
192 | 1557 |
result := self readCCITT3RLETiffImageData. |
1558 |
ok := true |
|
135 | 1559 |
]. |
1560 |
(compression == 3) ifTrue:[ |
|
192 | 1561 |
result := self readCCITTGroup3TiffImageData. |
1562 |
ok := true |
|
135 | 1563 |
]. |
1564 |
(compression == 4) ifTrue:[ |
|
192 | 1565 |
result := self readCCITTGroup4TiffImageData. |
1566 |
ok := true |
|
135 | 1567 |
]. |
1568 |
(compression == 5) ifTrue:[ |
|
192 | 1569 |
result := self readLZWTiffImageData. |
1570 |
ok := true |
|
135 | 1571 |
]. |
1572 |
(compression == 6) ifTrue:[ |
|
192 | 1573 |
result := self readJPEGTiffImageData. |
1574 |
ok := true |
|
135 | 1575 |
]. |
1576 |
(compression == 32766) ifTrue:[ |
|
192 | 1577 |
result := self readNeXTRLE2TiffImageData. |
1578 |
ok := true |
|
135 | 1579 |
]. |
1580 |
(compression == 32771) ifTrue:[ |
|
192 | 1581 |
result := self readCCITTRLEWTiffImageData. |
1582 |
ok := true |
|
135 | 1583 |
]. |
1584 |
(compression == 32773) ifTrue:[ |
|
192 | 1585 |
result := self readPackbitsTiffImageData. |
1586 |
ok := true |
|
135 | 1587 |
]. |
1588 |
(compression == 32865) ifTrue:[ |
|
192 | 1589 |
result := self readNeXTJPEGTiffImageData. |
1590 |
ok := true |
|
135 | 1591 |
]. |
1592 |
ok ifFalse:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1593 |
'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1594 |
' not known' errorPrintCR |
135 | 1595 |
]. |
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1596 |
|
393 | 1597 |
orientation == #vFlip ifTrue:[ |
1598 |
"/ reverse rows to top-to bottom |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1599 |
|
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1600 |
bytesPerRow := self bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1601 |
tmp := ByteArray new:bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1602 |
offset1 := 1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1603 |
offset2 := (height-1)*bytesPerRow + 1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1604 |
0 to:(height-1//2) do:[:row | |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1605 |
tmp replaceFrom:1 to:bytesPerRow |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1606 |
with:data startingAt:offset1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1607 |
data replaceFrom:offset1 to:offset1+bytesPerRow-1 |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1608 |
with:data startingAt:offset2. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1609 |
data replaceFrom:offset2 to:offset2+bytesPerRow-1 |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1610 |
with:tmp startingAt:1. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1611 |
offset1 := offset1 + bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1612 |
offset2 := offset2 - bytesPerRow. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1613 |
]. |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1614 |
]. |
393 | 1615 |
orientation == #unsupported ifTrue:[ |
1616 |
'TIFFReader [warning]: unsupported orientation' errorPrintCR |
|
1617 |
]. |
|
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
1618 |
|
135 | 1619 |
^ result |
192 | 1620 |
|
393 | 1621 |
"Modified: 31.1.1997 / 10:51:27 / cg" |
135 | 1622 |
! ! |
0 | 1623 |
|
135 | 1624 |
!TIFFReader methodsFor:'writing to file'! |
1625 |
||
1626 |
save:image onFile:aFileName |
|
1627 |
"save image as (uncompressed) TIFF file on aFileName" |
|
0 | 1628 |
|
135 | 1629 |
|pos1 pos| |
0 | 1630 |
|
135 | 1631 |
outStream := FileStream newFileNamed:aFileName. |
1632 |
outStream isNil ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1633 |
'TIFFReader [warning]: create error' errorPrintCR. |
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1634 |
^ nil |
0 | 1635 |
]. |
1636 |
||
135 | 1637 |
"save as msb" |
1638 |
||
1639 |
byteOrder := #msb. |
|
1640 |
" |
|
1641 |
byteOrder := #lsb. |
|
1642 |
" |
|
1643 |
fillOrder := #msb. |
|
1644 |
width := image width. |
|
1645 |
height := image height. |
|
1646 |
photometric := image photometric. |
|
1647 |
samplesPerPixel := image samplesPerPixel. |
|
1648 |
bitsPerSample := image bitsPerSample. |
|
1649 |
colorMap := image colorMap. |
|
1650 |
planarConfiguration := 1. |
|
1651 |
compression := 1. "none" |
|
1652 |
data := image bits. |
|
1653 |
||
1654 |
currentOffset := 0. |
|
1655 |
||
1656 |
(byteOrder == #msb) ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1657 |
outStream nextPut:$M. outStream nextPut:$M. |
135 | 1658 |
] ifFalse:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1659 |
outStream nextPut:$I. outStream nextPut:$I. |
0 | 1660 |
]. |
135 | 1661 |
currentOffset := currentOffset + 2. |
0 | 1662 |
|
135 | 1663 |
outStream binary. |
1664 |
||
1665 |
self writeShort:42. |
|
1666 |
currentOffset := currentOffset + 2. |
|
0 | 1667 |
|
135 | 1668 |
pos1 := outStream position. |
1669 |
self writeLong:0. "start of tags - filled in later" |
|
1670 |
currentOffset := currentOffset + 4. |
|
1671 |
||
1672 |
"output strips" |
|
1673 |
||
1674 |
self writeUncompressedBits. "this outputs bits as strips, sets stripOffsets and stripByteCounts" |
|
1675 |
self writeStripOffsets. "this outputs strip offsets, sets stripOffsetsPos" |
|
1676 |
self writeStripByteCounts. "this outputs strip bytecounts, sets stripByteCountPos" |
|
1677 |
self writeBitsPerSample. "this outputs bitsPerSample, sets bitsPerSamplePos" |
|
1678 |
photometric == #palette ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1679 |
self writeColorMap "this outputs colorMap, sets colorMapPos" |
0 | 1680 |
]. |
1681 |
||
135 | 1682 |
pos := outStream position. "backpatch tag offset" |
1683 |
outStream position:pos1. |
|
1684 |
self writeLong:(pos - 1). "fill in tag offset" |
|
1685 |
outStream position:pos. |
|
1686 |
" |
|
1687 |
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ', |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1688 |
(pos printStringRadix:16)) printNewline. |
135 | 1689 |
" |
1690 |
"output tag data" |
|
0 | 1691 |
|
135 | 1692 |
photometric == #palette ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1693 |
self writeShort:11. "11 tags" |
135 | 1694 |
] ifFalse:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1695 |
self writeShort:10. "10 tags" |
135 | 1696 |
]. |
1697 |
self writeTag:256. "image width" |
|
1698 |
self writeTag:257. "image height" |
|
1699 |
self writeTag:258. "bits per sample" |
|
1700 |
self writeTag:259. "compression" |
|
1701 |
self writeTag:262. "photometric" |
|
1702 |
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
|
1703 |
self writeTag:277. "samplesPerPixel" |
135 | 1704 |
self writeTag:278. "rowsPerStrip" |
1705 |
self writeTag:279. "strip byte counts" |
|
1706 |
self writeTag:284. "planarconfig" |
|
1707 |
photometric == #palette ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1708 |
self writeTag:320 "colorMap" |
135 | 1709 |
]. |
1710 |
self writeLong:0. "end of tags mark" |
|
1711 |
outStream close |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1712 |
|
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1713 |
"Modified: 10.1.1997 / 18:13:38 / cg" |
135 | 1714 |
! ! |
30 | 1715 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1716 |
!TIFFReader class methodsFor:'documentation'! |
30 | 1717 |
|
135 | 1718 |
version |
398 | 1719 |
^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.48 1997-02-01 14:05:57 cg Exp $' |
0 | 1720 |
! ! |
135 | 1721 |
TIFFReader initialize! |