author | Patrik Svestka <patrik.svestka@gmail.com> |
Wed, 14 Nov 2018 12:13:31 +0100 | |
branch | jv |
changeset 4213 | 8127ef0ff47d |
parent 3855 | 1db7742d33ad |
permissions | -rw-r--r-- |
37 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
" |
|
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1848
diff
changeset
|
12 |
"{ Package: 'stx:libview2' }" |
37 | 13 |
|
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1848
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
1577 | 15 |
|
37 | 16 |
ImageReader subclass:#TargaReader |
1738 | 17 |
instanceVariableNames:'orientation bytesPerRow bytesPerPixel' |
210 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
1745
4fa0fad2a463
code cleanup (colorMap handling)
Claus Gittinger <cg@exept.de>
parents:
1738
diff
changeset
|
20 |
category:'Graphics-Images-Readers' |
37 | 21 |
! |
22 |
||
23 |
!TargaReader class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
28 |
All Rights Reserved |
|
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 |
||
39 |
documentation |
|
40 |
" |
|
41 |
this class provides methods for loading targa-file (tga) images. |
|
556 | 42 |
|
37 | 43 |
Limitations: |
556 | 44 |
not fully tested (I only had a few targa files to check things) |
45 |
only supports 8,24 and 32 bits/pixel formats; alpha channel is ignored |
|
210 | 46 |
Image saving not supported |
37 | 47 |
|
48 |
I had two tga files to test this code with - it may not work with |
|
556 | 49 |
other targa files (it certainly does not work with 1/16 bit images). |
299 | 50 |
|
37 | 51 |
Suggestions: adapt & use the pbmplus library here. |
210 | 52 |
|
53 |
[See also:] |
|
234 | 54 |
Image Form Icon |
210 | 55 |
BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader |
56 |
ST80FormReader SunRasterReader TIFFReader WindowsIconReader |
|
57 |
XBMReader XPMReader XWDReader |
|
37 | 58 |
" |
1738 | 59 |
! |
60 |
||
61 |
format |
|
62 |
" |
|
63 |
Shorts etc. are lsb. |
|
64 |
||
65 |
offset: |
|
66 |
||
67 |
1 lenID byte |
|
68 |
2 hasColorMap byte |
|
69 |
3 imageType byte |
|
70 |
1 MapRGB |
|
71 |
2 RawRGB |
|
72 |
3 RawMono |
|
73 |
9 MapEnCode |
|
74 |
10 RawEnCode |
|
75 |
4, 5 cmapOffset short |
|
76 |
6, 7 cmapLength short |
|
77 |
8 cmapEntrySize short |
|
78 |
9,10 xOrg short |
|
79 |
11,12 yOrg short |
|
80 |
||
81 |
13,14 width |
|
82 |
15,16 height |
|
83 |
17 depth |
|
84 |
18 flags |
|
85 |
0000 xxxx attribute-bits-per-pixel |
|
86 |
0000 0001 greysc |
|
87 |
0000 0010 colour |
|
88 |
0000 0011 mapped |
|
89 |
0000 0100 rleEncoded |
|
90 |
0000 1000 interlaced |
|
91 |
00xx 0000 origin (0 -> lower-left / 1 -> l-r / 2 -> u-l / 3 -> u-r) |
|
92 |
xx00 0000 interleave (0 -> none / 1 -> odd/even / 2 ->4-fould / 3 reserved) |
|
93 |
||
94 |
19.. len lenID-bytes |
|
95 |
.. colorMap cmapLength*3 bytes iff hasColorMap ~~ 0 |
|
96 |
" |
|
37 | 97 |
! ! |
98 |
||
99 |
!TargaReader class methodsFor:'initialization'! |
|
100 |
||
101 |
initialize |
|
210 | 102 |
"tell Image-class, that a new fileReader is present |
398 | 103 |
for the '.tga' extension." |
210 | 104 |
|
647 | 105 |
MIMETypes defineImageType:'image/x-targa' suffix:'tga' reader:self. |
37 | 106 |
|
630 | 107 |
"Modified: 27.6.1997 / 18:39:43 / cg" |
37 | 108 |
! ! |
109 |
||
110 |
!TargaReader class methodsFor:'testing'! |
|
111 |
||
112 |
isValidImageFile:aFileName |
|
113 |
"return true, if aFileName contains a targa-file image" |
|
114 |
||
1577 | 115 |
|aStream w h depth flags imageType ok| |
116 |
||
117 |
ok := true. |
|
37 | 118 |
|
43 | 119 |
aStream := self streamReadingFile:aFileName. |
120 |
aStream isNil ifTrue:[^ false]. |
|
121 |
aStream binary. |
|
1577 | 122 |
|
123 |
aStream next. "lenID" |
|
124 |
aStream next. "hasColorMap" |
|
125 |
imageType := aStream next. |
|
126 |
aStream skip:2. "cmapOffset" |
|
127 |
aStream skip:2. "cmapLength" |
|
128 |
aStream next. "cmapEntrySize" |
|
129 |
aStream skip:2. "xOrg" |
|
130 |
aStream skip:2. "yOrg" |
|
37 | 131 |
|
43 | 132 |
w := aStream nextShortMSB:false. |
133 |
h := aStream nextShortMSB:false. |
|
37 | 134 |
|
43 | 135 |
depth := aStream next. |
136 |
flags := aStream next. |
|
37 | 137 |
|
1577 | 138 |
"/ MapRGB == 1 |
139 |
"/ RawRGB == 2 |
|
140 |
"/ RawMono == 3 |
|
141 |
"/ MapEnCode == 9 |
|
142 |
"/ RawEnCode == 10 |
|
143 |
||
144 |
(#(1 2 3 9 10) includes:imageType) ifFalse:[ |
|
145 |
"/ 'TargaReader [warning]: unsupported imageType: ' errorPrint. imageType errorPrintCR. |
|
146 |
ok := false |
|
147 |
] ifTrue:[ |
|
148 |
(#(8 "16" 24 32) includes:depth) ifFalse:[ |
|
149 |
ok := false |
|
150 |
]. |
|
37 | 151 |
]. |
43 | 152 |
aStream close. |
1577 | 153 |
^ ok |
37 | 154 |
|
155 |
" |
|
156 |
TargaReader isValidImageFile:'bitmaps/test.tga' |
|
157 |
TargaReader isValidImageFile:'bitmaps/garfield.gif' |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
158 |
" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
159 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
160 |
"Modified: 21.4.1997 / 20:46:52 / cg" |
37 | 161 |
! ! |
162 |
||
1848 | 163 |
!TargaReader methodsFor:'private-reading'! |
37 | 164 |
|
1738 | 165 |
handleImageOrientation |
166 |
|rowIdx startIdx endIdx t| |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
167 |
|
1738 | 168 |
orientation == #topLeft ifTrue:[ |
169 |
^ self. |
|
37 | 170 |
]. |
171 |
||
1738 | 172 |
orientation == #topRight ifTrue:[ |
173 |
"/ flip horizontal |
|
174 |
rowIdx := 1. |
|
175 |
1 to:height do:[:row | |
|
176 |
startIdx := rowIdx. |
|
177 |
endIdx := rowIdx + bytesPerRow - bytesPerPixel. |
|
178 |
1 to:width//2 do:[:x | |
|
179 |
0 to:bytesPerPixel-1 do:[:c | |
|
180 |
t := data at:startIdx+c. |
|
181 |
data at:startIdx+c put:(data at:endIdx+c). |
|
182 |
data at:endIdx+c put:t. |
|
183 |
]. |
|
184 |
startIdx := startIdx + bytesPerPixel. |
|
185 |
endIdx := endIdx - bytesPerPixel. |
|
1065
32a68620ddab
care for EOF while reading colorMap.
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
186 |
]. |
1738 | 187 |
rowIdx := rowIdx + width. |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
188 |
]. |
1738 | 189 |
^ self. |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
190 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
191 |
|
1738 | 192 |
orientation == #bottomLeft ifTrue:[ |
193 |
"/ flip vertical |
|
194 |
startIdx := 1. |
|
195 |
endIdx := 1 + ((height - 1) * bytesPerRow). |
|
196 |
t := ByteArray new:bytesPerRow. |
|
197 |
1 to:height//2 do:[:row | |
|
198 |
t replaceFrom:1 to:bytesPerRow with:data startingAt:startIdx. |
|
199 |
data replaceFrom:startIdx to:startIdx+bytesPerRow-1 with:data startingAt:endIdx. |
|
200 |
data replaceFrom:endIdx to:endIdx+bytesPerRow-1 with:t startingAt:1. |
|
201 |
startIdx := startIdx + bytesPerRow. |
|
202 |
endIdx := endIdx - bytesPerRow |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
203 |
]. |
1738 | 204 |
^ self. |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
205 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
206 |
|
1738 | 207 |
'TargaReader [warning]: unsupported orientation: ' errorPrint. orientation errorPrintCR. |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
208 |
! |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
209 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
210 |
read24 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
211 |
"read a 24 bit/pixel targa-image" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
212 |
|
1738 | 213 |
|totalBytes| |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
214 |
|
1738 | 215 |
totalBytes := width * height * 3. |
216 |
data := ByteArray new:totalBytes. |
|
217 |
inStream nextBytes:totalBytes into:data. |
|
299 | 218 |
|
37 | 219 |
" |
299 | 220 |
mhmh - pixel-byte order is blue-green-red |
221 |
swap blue & red bytes |
|
37 | 222 |
" |
1738 | 223 |
self class swap:totalBytes bytesFromRGB_to_BGR_in:data. |
37 | 224 |
|
225 |
photometric := #rgb. |
|
226 |
samplesPerPixel := 3. |
|
227 |
bitsPerSample := #(8 8 8). |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
228 |
! |
37 | 229 |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
230 |
read24RLE |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
231 |
"read an 8 bit/pixel rle encoded targa-image" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
232 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
233 |
|total count dstIndex code n r g b| |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
234 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
235 |
data := ByteArray new:((total := width * height * 3)). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
236 |
count := 0. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
237 |
dstIndex := 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
238 |
[count < total] whileTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
239 |
code := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
240 |
n := (code bitAnd:16r7F) + 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
241 |
(code bitAnd:16r80) ~~ 0 ifTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
242 |
b := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
243 |
g := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
244 |
r := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
245 |
n timesRepeat:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
246 |
data at:dstIndex put:r. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
247 |
data at:dstIndex+1 put:g. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
248 |
data at:dstIndex+2 put:b. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
249 |
dstIndex := dstIndex + 3 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
250 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
251 |
] ifFalse:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
252 |
n timesRepeat:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
253 |
b := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
254 |
g := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
255 |
r := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
256 |
data at:dstIndex put:r. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
257 |
data at:dstIndex+1 put:g. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
258 |
data at:dstIndex+2 put:b. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
259 |
dstIndex := dstIndex + 3 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
260 |
] |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
261 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
262 |
count := count + (n * 3). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
263 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
264 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
265 |
photometric := #rgb. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
266 |
samplesPerPixel := 3. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
267 |
bitsPerSample := #(8 8 8). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
268 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
269 |
"Modified: 21.4.1997 / 20:21:12 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
270 |
"Created: 21.4.1997 / 20:43:23 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
271 |
! |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
272 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
273 |
read32 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
274 |
"read a 32 bit/pixel targa-image; skip alpha channel (for now)" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
275 |
|
1738 | 276 |
|totalBytes remainingBytes dstIndex a r g b| |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
277 |
|
1738 | 278 |
totalBytes := width * height * 3. |
279 |
data := ByteArray new:totalBytes. |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
280 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
281 |
dstIndex := 1. |
1738 | 282 |
remainingBytes := totalBytes. |
283 |
[remainingBytes > 0] whileTrue:[ |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
284 |
b := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
285 |
g := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
286 |
r := inStream nextByte. |
1738 | 287 |
a := inStream nextByte. "/ alpha - skipped |
288 |
data at:dstIndex put:r. |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
289 |
data at:dstIndex+1 put:g. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
290 |
data at:dstIndex+2 put:b. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
291 |
dstIndex := dstIndex + 3. |
1738 | 292 |
remainingBytes := remainingBytes - 3. |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
293 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
294 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
295 |
photometric := #rgb. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
296 |
samplesPerPixel := 3. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
297 |
bitsPerSample := #(8 8 8). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
298 |
|
1738 | 299 |
" |
300 |
TargaReader fromFile:'/phys/exept//unsaved1/pd_stuff/graphic/3d_engines/crystal_space/CS/plugins/video/canvas/sdl/img/move.tga' |
|
301 |
TargaReader fromFile:'/phys/exept/unsaved2/smalltalk/Squeak/croquet/Croquet/Content/Cisco/2520/Textures/2520caseback.tga' |
|
302 |
TargaReader fromFile:'/phys/exept/unsaved2/smalltalk/Squeak/croquet/Croquet/Content/Cisco/2520/Textures/2520dimm1front.tga' |
|
303 |
" |
|
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
304 |
! |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
305 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
306 |
read32RLE |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
307 |
"read a 32 bit/pixel rle encoded targa-image; skip alpha channel (for now)" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
308 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
309 |
|total count dstIndex code n a r g b| |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
310 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
311 |
data := ByteArray new:((total := width * height * 3)). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
312 |
count := 0. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
313 |
dstIndex := 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
314 |
[count < total] whileTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
315 |
code := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
316 |
n := (code bitAnd:16r7F) + 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
317 |
(code bitAnd:16r80) ~~ 0 ifTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
318 |
b := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
319 |
g := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
320 |
r := inStream nextByte. |
1738 | 321 |
a := inStream nextByte. "/ alpha - skipped |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
322 |
n timesRepeat:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
323 |
data at:dstIndex put:r. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
324 |
data at:dstIndex+1 put:g. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
325 |
data at:dstIndex+2 put:b. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
326 |
dstIndex := dstIndex + 3 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
327 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
328 |
] ifFalse:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
329 |
n timesRepeat:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
330 |
b := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
331 |
g := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
332 |
r := inStream nextByte. |
1738 | 333 |
a := inStream nextByte. "/ alpha - skipped |
555
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
334 |
data at:dstIndex put:r. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
335 |
data at:dstIndex+1 put:g. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
336 |
data at:dstIndex+2 put:b. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
337 |
dstIndex := dstIndex + 3 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
338 |
] |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
339 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
340 |
count := count + (n * 3). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
341 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
342 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
343 |
photometric := #rgb. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
344 |
samplesPerPixel := 3. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
345 |
bitsPerSample := #(8 8 8). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
346 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
347 |
"Created: 21.4.1997 / 20:43:54 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
348 |
"Modified: 21.4.1997 / 20:45:49 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
349 |
! |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
350 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
351 |
read8 |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
352 |
"read an 8 bit/pixel targa-image" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
353 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
354 |
data := ByteArray new:(width * height). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
355 |
inStream nextBytes:(data size) into:data. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
356 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
357 |
colorMap isNil ifTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
358 |
photometric := #blackIs0. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
359 |
] ifFalse:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
360 |
photometric := #palette. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
361 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
362 |
samplesPerPixel := 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
363 |
bitsPerSample := #(8). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
364 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
365 |
"Created: 21.4.1997 / 20:12:35 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
366 |
"Modified: 21.4.1997 / 20:39:02 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
367 |
! |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
368 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
369 |
read8RLE |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
370 |
"read an 8 bit/pixel rle encoded targa-image" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
371 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
372 |
|total count dstIndex code n byte| |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
373 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
374 |
data := ByteArray new:((total := width * height)). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
375 |
count := 0. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
376 |
dstIndex := 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
377 |
[count < total] whileTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
378 |
code := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
379 |
n := (code bitAnd:16r7F) + 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
380 |
(code bitAnd:16r80) ~~ 0 ifTrue:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
381 |
byte := inStream nextByte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
382 |
data from:dstIndex to:dstIndex+n-1 put:byte. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
383 |
] ifFalse:[ |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
384 |
inStream nextBytes:n into:data startingAt:dstIndex. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
385 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
386 |
count := count + n. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
387 |
dstIndex := dstIndex + n. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
388 |
]. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
389 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
390 |
photometric := #palette. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
391 |
samplesPerPixel := 1. |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
392 |
bitsPerSample := #(8). |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
393 |
|
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
394 |
"Created: 21.4.1997 / 20:19:46 / cg" |
f51ec2cc4482
support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents:
551
diff
changeset
|
395 |
"Modified: 21.4.1997 / 20:21:12 / cg" |
1738 | 396 |
! |
397 |
||
398 |
readColorMap:cmapLength |
|
399 |
colorMap := Array new:cmapLength. |
|
400 |
1 to:cmapLength do:[:index | |
|
401 |
|r g b| |
|
402 |
||
403 |
b := inStream nextByte. |
|
404 |
g := inStream nextByte. |
|
405 |
r := inStream nextByte. |
|
406 |
(r isNil or:[g isNil or:[b isNil]]) ifTrue:[ |
|
407 |
^ self fileFormatError:('short file - probably not targa format'). |
|
408 |
]. |
|
409 |
colorMap at:index put:(Color redByte:r greenByte:g blueByte:b). |
|
410 |
]. |
|
411 |
^ colorMap |
|
37 | 412 |
! ! |
413 |
||
1848 | 414 |
!TargaReader methodsFor:'reading'! |
415 |
||
416 |
readImage |
|
417 |
"read a targa-image from aFileName. return the receiver (with all |
|
418 |
relevant instance variables set for the image) or nil on error" |
|
419 |
||
420 |
|depth flags lenID hasColorMap imageType |
|
421 |
cmapOffset cmapLength cmapEntrySize xOrg yOrg rle| |
|
422 |
||
423 |
inStream binary. |
|
424 |
||
425 |
lenID := inStream next. |
|
426 |
hasColorMap := inStream next. |
|
427 |
imageType := inStream next. |
|
428 |
cmapOffset := inStream nextShortMSB:false. |
|
429 |
cmapLength := inStream nextShortMSB:false. |
|
430 |
cmapEntrySize := inStream next. |
|
431 |
xOrg := inStream nextShortMSB:false. |
|
432 |
yOrg := inStream nextShortMSB:false. |
|
433 |
||
434 |
width := inStream nextShortMSB:false. |
|
435 |
height := inStream nextShortMSB:false. |
|
436 |
depth := inStream next. |
|
437 |
(#(8 "16" 24 32) includes:depth) ifFalse:[ |
|
438 |
^ self fileFormatError:('unsupported depth: ', depth printString). |
|
439 |
]. |
|
440 |
depth == 32 ifTrue:[ |
|
441 |
'TargaReader [info]: alpha channel ignored' infoPrintCR. |
|
442 |
] ifFalse:[ |
|
443 |
'TargaReader [info]: depth: ' infoPrint. depth infoPrintCR. |
|
444 |
]. |
|
445 |
||
446 |
"/ MapRGB == 1 |
|
447 |
"/ RawRGB == 2 |
|
448 |
"/ RawMono == 3 |
|
449 |
"/ MapEnCode == 9 |
|
450 |
"/ RawEnCode == 10 |
|
451 |
||
452 |
(#(1 2 9 10) includes:imageType) ifFalse:[ |
|
453 |
"/ 'TargaReader [warning]: unsupported imageType: ' errorPrint. imageType errorPrintCR. |
|
454 |
^ self fileFormatError:('unsupported imageType: ', imageType printString). |
|
455 |
]. |
|
456 |
'TargaReader [info]: imageType: ' infoPrint. imageType infoPrintCR. |
|
457 |
||
458 |
self reportDimension. |
|
459 |
||
460 |
"/ flags: |
|
461 |
"/ 0000 xxxx attribute-bits-per-pixel |
|
462 |
"/ 0000 0001 greysc |
|
463 |
"/ 0000 0010 colour |
|
464 |
"/ 0000 0011 mapped |
|
465 |
"/ 0000 0100 rleEncoded |
|
466 |
"/ 0000 1000 interlaced |
|
467 |
"/ 00xx 0000 origin (0 -> lower-left / 1 -> l-r / 2 -> u-l / 3 -> u-r) |
|
468 |
"/ xx00 0000 interleave (0 -> none / 1 -> odd/even / 2 ->4-fould / 3 reserved) |
|
469 |
"/ |
|
470 |
flags := inStream next. |
|
471 |
||
472 |
(flags bitAnd:2r11000000) ~~ 0 ifTrue:[ |
|
473 |
^ self fileFormatError:('unsupported interlace: ' , flags printString). |
|
474 |
]. |
|
475 |
||
476 |
rle := flags bitTest:2r000001000. |
|
477 |
flags := flags bitAnd:2r111110111. |
|
478 |
||
479 |
(flags bitAnd:2r00001111) ~~ 0 ifTrue:[ |
|
480 |
^ self fileFormatError:('unsupported flags: ' , flags printString). |
|
481 |
]. |
|
482 |
||
483 |
(flags bitAnd:2r00110000) == 16r20 ifTrue:[ |
|
484 |
orientation := #topLeft |
|
485 |
] ifFalse:[ |
|
486 |
(flags bitAnd:2r00110000) == 16r30 ifTrue:[ |
|
487 |
orientation := #topRight |
|
488 |
] ifFalse:[ |
|
489 |
(flags bitAnd:2r00110000) == 16r10 ifTrue:[ |
|
490 |
orientation := #bottomRight |
|
491 |
] ifFalse:[ |
|
492 |
(flags bitAnd:2r00110000) == 0 ifTrue:[ |
|
493 |
orientation := #bottomLeft |
|
494 |
] |
|
495 |
] |
|
496 |
] |
|
497 |
]. |
|
498 |
||
499 |
lenID ~~ 0 ifTrue:[ |
|
500 |
inStream skip:lenID |
|
501 |
]. |
|
502 |
||
503 |
hasColorMap ~~ 0 ifTrue:[ |
|
504 |
"/ read the colorMap |
|
505 |
colorMap := self readColorMap:cmapLength. |
|
506 |
'TargaReader [info]: has colorMap' infoPrintCR. |
|
507 |
]. |
|
508 |
||
509 |
depth == 32 ifTrue:[ |
|
510 |
imageType == 2 ifTrue:[ |
|
511 |
"/ rle ifTrue:[self halt:'oops - should not happen']. |
|
512 |
self read32. |
|
513 |
] ifFalse:[ |
|
514 |
"/ rle ifFalse:[self halt:'oops - should not happen']. |
|
515 |
self read32RLE. |
|
516 |
]. |
|
517 |
bytesPerRow := width*3. |
|
518 |
bytesPerPixel := 3. |
|
519 |
]. |
|
520 |
depth == 24 ifTrue:[ |
|
521 |
imageType == 2 ifTrue:[ |
|
522 |
"/ rle ifTrue:[self halt:'oops - should not happen']. |
|
523 |
self read24. |
|
524 |
] ifFalse:[ |
|
525 |
"/ rle ifFalse:[self halt:'oops - should not happen']. |
|
526 |
self read24RLE. |
|
527 |
]. |
|
528 |
bytesPerRow := width*3. |
|
529 |
bytesPerPixel := 3. |
|
530 |
]. |
|
531 |
depth == 8 ifTrue:[ |
|
532 |
imageType == 1 ifTrue:[ |
|
533 |
"/ rle ifTrue:[self halt:'oops - should not happen']. |
|
534 |
self read8. |
|
535 |
] ifFalse:[ |
|
536 |
"/ rle ifFalse:[self halt:'oops - should not happen']. |
|
537 |
self read8RLE |
|
538 |
]. |
|
539 |
bytesPerRow := width. |
|
540 |
bytesPerPixel := 1. |
|
541 |
]. |
|
542 |
||
543 |
self handleImageOrientation. |
|
544 |
||
545 |
" |
|
546 |
TargaReader fromFile:'bitmaps/test.tga' |
|
547 |
" |
|
548 |
||
549 |
"Modified: / 7.9.1998 / 21:12:12 / cg" |
|
550 |
"Modified: / 13.10.1998 / 19:50:48 / ps" |
|
551 |
! ! |
|
552 |
||
210 | 553 |
!TargaReader class methodsFor:'documentation'! |
554 |
||
555 |
version |
|
1848 | 556 |
^ '$Header: /cvs/stx/stx/libview2/TargaReader.st,v 1.25 2003-11-19 15:38:53 cg Exp $' |
210 | 557 |
! ! |
1738 | 558 |
|
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1848
diff
changeset
|
559 |
|
37 | 560 |
TargaReader initialize! |