author | Claus Gittinger <cg@exept.de> |
Thu, 24 Jul 1997 18:03:58 +0200 | |
changeset 670 | 6a7f628ee66c |
parent 647 | 6f26c76aa0c9 |
child 691 | bb5dfbec2a7a |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
26 | 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:#GIFReader |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
14 |
instanceVariableNames:'redMap greenMap blueMap' |
154 | 15 |
classVariableNames:'' |
16 |
poolDictionaries:'' |
|
259 | 17 |
category:'Graphics-Images-Support' |
0 | 18 |
! |
19 |
||
339 | 20 |
!GIFReader class methodsFor:'documentation'! |
0 | 21 |
|
21 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
26 | 25 |
All Rights Reserved |
21 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
0 | 36 |
documentation |
37 |
" |
|
38 |
this class provides methods for loading and saving GIF pictures. |
|
21 | 39 |
It has been tested with some different GIF87a pictures, I dont |
0 | 40 |
know, if it works with other GIF versions. |
41 |
GIF extension blocks are not handled. |
|
42 |
||
43 |
GIF file writing is not implemented (use TIFF). |
|
44 |
||
21 | 45 |
legal stuff extracted from GIF87a documentation: |
0 | 46 |
|
47 |
CompuServe Incorporated hereby grants a limited, non-exclusive, royalty-free |
|
48 |
license for the use of the Graphics Interchange Format(sm) in computer |
|
49 |
software; computer software utilizing GIF(sm) must acknowledge ownership of the |
|
50 |
Graphics Interchange Format and its Service Mark by CompuServe Incorporated, in |
|
51 |
User and Technical Documentation. |
|
52 |
||
53 |
The Graphics Interchange Format(c) is the Copyright property of |
|
54 |
CompuServe Incorporated. GIF(sm) is a Service Mark property of |
|
55 |
CompuServe Incorporated. |
|
194 | 56 |
|
57 |
[See also:] |
|
234 | 58 |
Image Form Icon |
194 | 59 |
BlitImageReader FaceReader JPEGReader PBMReader PCXReader |
210 | 60 |
ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader |
209 | 61 |
XBMReader XPMReader XWDReader |
220 | 62 |
|
63 |
[author:] |
|
64 |
Claus Gittinger |
|
0 | 65 |
" |
66 |
! ! |
|
67 |
||
339 | 68 |
!GIFReader class methodsFor:'initialization'! |
26 | 69 |
|
70 |
initialize |
|
198 | 71 |
"install myself in the Image classes fileFormat table |
398 | 72 |
for the `.gif' extensions." |
198 | 73 |
|
647 | 74 |
MIMETypes defineImageType:'image/gif' suffix:'gif' reader:self. |
198 | 75 |
|
398 | 76 |
"Modified: 1.2.1997 / 14:59:37 / cg" |
26 | 77 |
! ! |
78 |
||
339 | 79 |
!GIFReader class methodsFor:'testing'! |
1 | 80 |
|
81 |
isValidImageFile:aFileName |
|
82 |
"return true, if aFileName contains a GIF image" |
|
83 |
||
84 |
|id inStream| |
|
85 |
||
9 | 86 |
inStream := self streamReadingFile:aFileName. |
1 | 87 |
inStream isNil ifTrue:[^ false]. |
88 |
||
332 | 89 |
inStream text. |
90 |
||
1 | 91 |
id := String new:6. |
92 |
inStream nextBytes:6 into:id. |
|
93 |
inStream close. |
|
94 |
||
95 |
(id = 'GIF87a') ifFalse:[ |
|
174 | 96 |
(id startsWith:'GIF') ifFalse:[^ false]. |
1 | 97 |
|
174 | 98 |
id ~= 'GIF89a' ifTrue:[ |
355 | 99 |
'GIFReader [info]: not a GIF87a/GIF89a file - hope that works' infoPrintCR. |
174 | 100 |
] |
1 | 101 |
]. |
102 |
^ true |
|
174 | 103 |
|
355 | 104 |
"Modified: 10.1.1997 / 15:40:34 / cg" |
1 | 105 |
! ! |
106 |
||
0 | 107 |
!GIFReader methodsFor:'reading from file'! |
108 |
||
1 | 109 |
checkGreyscaleColormap |
239 | 110 |
"return true, if colormap is actually a greymap. |
111 |
Could be used to convert it into a greyScale image - which is not yet done." |
|
1 | 112 |
|
20 | 113 |
|sz "{ Class: SmallInteger }" |
114 |
redVal| |
|
115 |
||
116 |
sz := redMap size. |
|
117 |
||
118 |
1 to:sz do:[:i | |
|
239 | 119 |
redVal := redMap at:i. |
120 |
redVal ~~ (greenMap at:i) ifTrue:[^ false]. |
|
121 |
redVal ~~ (blueMap at:i) ifTrue:[^ false]. |
|
1 | 122 |
]. |
123 |
^ true |
|
239 | 124 |
|
125 |
"Modified: 2.5.1996 / 17:54:40 / cg" |
|
1 | 126 |
! |
127 |
||
43 | 128 |
fromStream:aStream |
192 | 129 |
"read a stream containing a GIF image. |
130 |
Leave image description in instance variables." |
|
43 | 131 |
|
132 |
|byte index flag count |
|
133 |
colorMapSize bitsPerPixel scrWidth scrHeight |
|
134 |
hasColorMap hasLocalColorMap interlaced id |
|
135 |
leftOffs topOffs codeLen |
|
136 |
compressedData compressedSize |
|
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
137 |
tmp srcOffset dstOffset isGif89 atEnd |
64 | 138 |
h "{ Class: SmallInteger }"| |
43 | 139 |
|
140 |
inStream := aStream. |
|
141 |
aStream binary. |
|
142 |
||
143 |
"GIF-files are always lsb (intel-world)" |
|
144 |
byteOrder := #lsb. |
|
145 |
||
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
146 |
id := ByteArray new:6. |
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
147 |
aStream nextBytes:6 into:id startingAt:1. |
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
148 |
id := id asString. |
43 | 149 |
|
150 |
"all I had for testing where GIF87a files; |
|
151 |
I hope later versions work too ..." |
|
152 |
||
154 | 153 |
isGif89 := false. |
43 | 154 |
(id ~= 'GIF87a') ifTrue:[ |
154 | 155 |
(id startsWith:'GIF') ifFalse:[ |
355 | 156 |
'GIFReader [info]: not a gif file' infoPrintCR. |
154 | 157 |
^ nil |
158 |
]. |
|
159 |
id ~= 'GIF89a' ifTrue:[ |
|
355 | 160 |
'GIFReader [info]: not a GIF87a/GIF89a file - hope that works' infoPrintCR. |
154 | 161 |
] |
43 | 162 |
]. |
163 |
||
164 |
"get screen dimensions (not used)" |
|
165 |
||
166 |
scrWidth := aStream nextShortMSB:false. |
|
167 |
scrHeight := aStream nextShortMSB:false. |
|
168 |
||
169 |
"get flag byte" |
|
170 |
flag := aStream nextByte. |
|
171 |
hasColorMap := (flag bitAnd:2r10000000) ~~ 0. |
|
172 |
"bitsPerRGB := ((flag bitAnd:2r01110000) bitShift:-4) + 1. " |
|
173 |
"colorMapSorted := ((flag bitAnd:2r00001000) ~~ 0. " |
|
174 |
bitsPerPixel := (flag bitAnd:2r00000111) + 1. |
|
175 |
colorMapSize := 1 bitShift:bitsPerPixel. |
|
176 |
||
177 |
"get background (not used)" |
|
178 |
aStream nextByte. |
|
179 |
||
180 |
"aspect ratio (not used)" |
|
181 |
aStream nextByte. |
|
182 |
||
183 |
"get colorMap" |
|
184 |
hasColorMap ifTrue:[ |
|
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
185 |
self readColorMap:colorMapSize. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
186 |
colorMap := Colormap |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
187 |
redVector:redMap |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
188 |
greenVector:greenMap |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
189 |
blueVector:blueMap. |
43 | 190 |
]. |
191 |
||
192 |
photometric := #palette. |
|
193 |
samplesPerPixel := 1. |
|
194 |
bitsPerSample := #(8). |
|
195 |
||
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
196 |
atEnd := false. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
197 |
[atEnd] whileFalse:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
198 |
"gif89a extensions" |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
199 |
byte := aStream nextByte. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
200 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
201 |
byte == 16r21 ifTrue:[ |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
202 |
"/ extension |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
203 |
self readExtension:aStream. |
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
204 |
] ifFalse:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
205 |
(byte == 16r3B) ifTrue:[ "trailer" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
206 |
atEnd := true |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
207 |
] ifFalse:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
208 |
"must be image separator" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
209 |
(byte ~~ 16r2C) ifTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
210 |
('GIFReader [info]: corrupted gif file (no IMAGESEP): ' , (byte printStringRadix:16)) infoPrintCR. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
211 |
^ nil |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
212 |
]. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
213 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
214 |
"get image data" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
215 |
leftOffs := aStream nextShortMSB:false. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
216 |
topOffs := aStream nextShortMSB:false. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
217 |
width := aStream nextShortMSB:false. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
218 |
height := aStream nextShortMSB:false. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
219 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
220 |
dimensionCallBack notNil ifTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
221 |
dimensionCallBack value:self |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
222 |
]. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
223 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
224 |
"/ |
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
225 |
"/ 'width ' print. width printNewline. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
226 |
"/ 'height ' print. height printNewline. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
227 |
"/ |
43 | 228 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
229 |
"another flag byte" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
230 |
flag := aStream nextByte. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
231 |
interlaced := (flag bitAnd:2r01000000) ~~ 0. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
232 |
hasLocalColorMap := (flag bitAnd:2r10000000) ~~ 0. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
233 |
"localColorMapSorted := (flag bitAnd:2r00100000) ~~ 0. " |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
234 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
235 |
"if image has a local colormap, this one is used" |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
236 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
237 |
hasLocalColorMap ifTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
238 |
"local descr. overwrites" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
239 |
bitsPerPixel := (flag bitAnd:2r00000111) + 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
240 |
colorMapSize := 1 bitShift:bitsPerPixel. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
241 |
"overwrite colormap" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
242 |
self readColorMap:colorMapSize. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
243 |
colorMap := Colormap |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
244 |
redVector:redMap |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
245 |
greenVector:greenMap |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
246 |
blueVector:blueMap. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
247 |
]. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
248 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
249 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
250 |
"get codelen for decompression" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
251 |
codeLen := aStream nextByte. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
252 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
253 |
compressedData := ByteArray uninitializedNew:(aStream size). |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
254 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
255 |
"get compressed data" |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
256 |
index := 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
257 |
count := aStream nextByte. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
258 |
[count notNil and:[count ~~ 0]] whileTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
259 |
aStream nextBytes:count into:compressedData startingAt:index blockSize:4096. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
260 |
index := index + count. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
261 |
count := aStream nextByte |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
262 |
]. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
263 |
compressedSize := index - 1. |
83 | 264 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
265 |
h := height. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
266 |
data := ByteArray new:((width + 1) * (h + 1)). |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
267 |
"/ 'GIFReader: decompressing ...' infoPrintCR. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
268 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
269 |
self class decompressGIFFrom:compressedData |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
270 |
count:compressedSize |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
271 |
into:data |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
272 |
startingAt:1 |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
273 |
codeLen:(codeLen + 1). |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
274 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
275 |
interlaced ifTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
276 |
"/ 'GIFREADER: deinterlacing ...' infoPrintCR. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
277 |
tmp := ByteArray new:(data size). |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
278 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
279 |
"phase 1: 0, 8, 16, 24, ..." |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
280 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
281 |
srcOffset := 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
282 |
0 to:(h - 1) by:8 do:[:dstRow | |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
283 |
dstOffset := dstRow * width + 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
284 |
tmp replaceFrom:dstOffset to:(dstOffset + width - 1) |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
285 |
with:data startingAt:srcOffset. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
286 |
srcOffset := srcOffset + width. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
287 |
]. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
288 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
289 |
"phase 2: 4, 12, 20, 28, ..." |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
290 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
291 |
4 to:(h - 1) by:8 do:[:dstRow | |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
292 |
dstOffset := dstRow * width + 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
293 |
tmp replaceFrom:dstOffset to:(dstOffset + width - 1) |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
294 |
with:data startingAt:srcOffset. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
295 |
srcOffset := srcOffset + width. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
296 |
]. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
297 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
298 |
"phase 3: 2, 6, 10, 14, ..." |
43 | 299 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
300 |
2 to:(h - 1) by:4 do:[:dstRow | |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
301 |
dstOffset := dstRow * width + 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
302 |
tmp replaceFrom:dstOffset to:(dstOffset + width - 1) |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
303 |
with:data startingAt:srcOffset. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
304 |
srcOffset := srcOffset + width. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
305 |
]. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
306 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
307 |
"phase 4: 1, 3, 5, 7, ..." |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
308 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
309 |
1 to:(h - 1) by:2 do:[:dstRow | |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
310 |
dstOffset := dstRow * width + 1. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
311 |
tmp replaceFrom:dstOffset to:(dstOffset + width - 1) |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
312 |
with:data startingAt:srcOffset. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
313 |
srcOffset := srcOffset + width. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
314 |
]. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
315 |
|
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
316 |
data := tmp. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
317 |
tmp := nil. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
318 |
]. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
319 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
320 |
imageSequence isNil ifTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
321 |
imageSequence := OrderedCollection new. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
322 |
]. |
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
323 |
maskPixel notNil ifTrue:[ |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
324 |
"/ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
325 |
"/ ok, there is a maskValue |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
326 |
"/ build a Depth1Image for it. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
327 |
"/ |
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
328 |
self buildMaskFromColor:maskPixel |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
329 |
]. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
330 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
331 |
imageSequence add:(self image). |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
332 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
333 |
aStream atEnd ifTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
334 |
atEnd := true. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
335 |
] |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
336 |
] |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
337 |
]. |
307
9eaeaca798a5
create a mask-image, if present
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
338 |
]. |
9eaeaca798a5
create a mask-image, if present
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
339 |
|
43 | 340 |
" |
341 |
GIFReader fromFile:'../fileIn/bitmaps/claus.gif |
|
342 |
GIFReader fromFile:'../fileIn/bitmaps/garfield.gif' |
|
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
343 |
GIFReader new fromStream:('/home2/cg/.misc/circum.gif' asFilename readStream) |
43 | 344 |
" |
154 | 345 |
|
315
506e0ce38534
Moved #buildMask from GIFReader to ImageReader>>#buildMaskFromColor:
Stefan Vogel <sv@exept.de>
parents:
312
diff
changeset
|
346 |
"Modified: 5.7.1996 / 17:32:01 / stefan" |
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
347 |
"Modified: 24.7.1997 / 18:02:44 / cg" |
135 | 348 |
! |
349 |
||
350 |
makeGreyscale |
|
351 |
"not yet implemented/needed" |
|
352 |
! |
|
353 |
||
354 |
readColorMap:colorMapSize |
|
355 |
"get gif colormap consisting of colorMapSize entries" |
|
356 |
||
357 |
|sz "{ Class: SmallInteger }"| |
|
358 |
||
359 |
redMap := ByteArray uninitializedNew:colorMapSize. |
|
360 |
greenMap := ByteArray uninitializedNew:colorMapSize. |
|
361 |
blueMap := ByteArray uninitializedNew:colorMapSize. |
|
239 | 362 |
|
135 | 363 |
sz := colorMapSize. |
364 |
1 to:sz do:[:i | |
|
239 | 365 |
redMap at:i put:(inStream nextByte). |
366 |
greenMap at:i put:(inStream nextByte). |
|
367 |
blueMap at:i put:(inStream nextByte) |
|
307
9eaeaca798a5
create a mask-image, if present
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
368 |
]. |
239 | 369 |
|
307
9eaeaca798a5
create a mask-image, if present
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
370 |
"Modified: 21.6.1996 / 12:32:43 / cg" |
154 | 371 |
! |
372 |
||
373 |
readExtension:aStream |
|
239 | 374 |
"get gif89 extension - this is currently ignored" |
154 | 375 |
|
376 |
|type blockSize subBlockSize |
|
304 | 377 |
aspNum aspDen left top width height cWidth cHeight fg bg |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
378 |
animationType animationTime animationMask |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
379 |
appID appAUTH |
625 | 380 |
iterationCount b ok| |
154 | 381 |
|
382 |
type := aStream nextByte. |
|
383 |
type == $R asciiValue ifTrue:[ |
|
239 | 384 |
"/ |
154 | 385 |
"/ Ratio extension |
239 | 386 |
"/ |
354
b4d2ce853c24
stefans suggested info/warning/error/fatal
Claus Gittinger <cg@exept.de>
parents:
339
diff
changeset
|
387 |
'GIFREADER [info]: ratio extension ignored' infoPrintCR. |
154 | 388 |
blockSize := aStream nextByte. |
389 |
(blockSize == 2) ifTrue:[ |
|
390 |
aspNum := aStream nextByte. |
|
391 |
aspDen := aStream nextByte |
|
392 |
] ifFalse:[ |
|
393 |
aStream skip:blockSize |
|
394 |
]. |
|
395 |
"/ eat subblocks |
|
396 |
||
397 |
[(subBlockSize := aStream nextByte) > 0] whileTrue:[ |
|
398 |
aStream skip:subBlockSize |
|
239 | 399 |
]. |
400 |
^ self |
|
401 |
]. |
|
402 |
||
403 |
type == 16r01 ifTrue:[ |
|
404 |
"/ |
|
405 |
"/ plaintext extension |
|
406 |
"/ |
|
625 | 407 |
"/ 'GIFREADER [info]: plaintext extension ignored' infoPrintCR. |
239 | 408 |
subBlockSize := aStream nextByte. |
409 |
left := aStream nextShortMSB:false. |
|
410 |
top := aStream nextShortMSB:false. |
|
411 |
width := aStream nextShortMSB:false. |
|
412 |
height := aStream nextShortMSB:false. |
|
413 |
cWidth := aStream nextByte. |
|
414 |
cHeight := aStream nextByte. |
|
415 |
fg := aStream nextByte. |
|
416 |
bg := aStream nextByte. |
|
417 |
aStream skip:12. |
|
418 |
[(subBlockSize := aStream nextByte) > 0] whileTrue:[ |
|
419 |
aStream skip:subBlockSize |
|
420 |
]. |
|
421 |
^ self |
|
422 |
]. |
|
423 |
||
424 |
type == 16rF9 ifTrue:[ |
|
425 |
"/ |
|
426 |
"/ graphic control extension |
|
427 |
"/ |
|
354
b4d2ce853c24
stefans suggested info/warning/error/fatal
Claus Gittinger <cg@exept.de>
parents:
339
diff
changeset
|
428 |
"/ 'GIFREADER [info]: graphic control extension ignored' infoPrintCR. |
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
429 |
|
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
430 |
[(subBlockSize := aStream nextByte) ~~ 0] whileTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
431 |
"/ type bitAnd:1 means: animationMask is transparent pixel |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
432 |
"/ to be implemented in Image ... |
305 | 433 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
434 |
animationType := aStream nextByte. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
435 |
animationTime := aStream nextShortMSB:false. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
436 |
animationMask := aStream nextByte. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
437 |
subBlockSize := subBlockSize - 4. |
307
9eaeaca798a5
create a mask-image, if present
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
438 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
439 |
(animationType bitTest: 1) ifTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
440 |
maskPixel := animationMask. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
441 |
"/ 'GIFREADER [info]: mask: ' infoPrint. (maskPixel printStringRadix:16) infoPrintCR. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
442 |
]. |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
443 |
"/ 'GIFREADER [info]: animationTime: ' infoPrint. (animationTime * (1/100)) infoPrintCR. |
307
9eaeaca798a5
create a mask-image, if present
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
444 |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
445 |
subBlockSize ~~ 0 ifTrue:[ |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
446 |
aStream skip:subBlockSize |
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
447 |
]. |
239 | 448 |
]. |
449 |
^ self |
|
450 |
]. |
|
451 |
||
519 | 452 |
type == 16rFE ifTrue:[ |
453 |
"/ |
|
454 |
"/ comment extension |
|
455 |
"/ |
|
625 | 456 |
"/ 'GIFREADER [info]: comment extension ignored' infoPrintCR. |
519 | 457 |
[(blockSize := aStream nextByte) ~~ 0] whileTrue:[ |
458 |
aStream skip:blockSize |
|
459 |
]. |
|
460 |
^ self |
|
461 |
]. |
|
462 |
||
239 | 463 |
type == 16rFF ifTrue:[ |
464 |
"/ |
|
465 |
"/ application extension |
|
466 |
"/ |
|
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
467 |
subBlockSize := aStream nextByte. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
468 |
appID := (aStream nextBytes:8 ) asString. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
469 |
appAUTH := aStream nextBytes:3. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
470 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
471 |
subBlockSize := aStream nextByte. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
472 |
|
625 | 473 |
ok := false. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
474 |
appID = 'NETSCAPE' ifTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
475 |
appAUTH asString = '2.0' ifTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
476 |
subBlockSize == 3 ifTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
477 |
b := aStream nextByte. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
478 |
iterationCount := aStream nextShortMSB:false. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
479 |
subBlockSize := aStream nextByte. |
625 | 480 |
ok := true. |
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
481 |
] |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
482 |
] |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
483 |
]. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
484 |
|
625 | 485 |
ok ifFalse:[ |
486 |
('GIFREADER [info]: application extension (' , appID , ') ignored') infoPrintCR. |
|
487 |
]. |
|
488 |
||
618
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
489 |
[subBlockSize > 0] whileTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
490 |
aStream skip:subBlockSize. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
491 |
subBlockSize := aStream nextByte. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
492 |
]. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
493 |
^ self |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
494 |
]. |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
495 |
|
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
496 |
type == 16r2C ifTrue:[ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
497 |
"/ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
498 |
"/ image descriptor extension |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
499 |
"/ |
ab83e72fd105
support multiple images (animated gif)
Claus Gittinger <cg@exept.de>
parents:
563
diff
changeset
|
500 |
'GIFREADER [info]: image descriptor extension ignored' infoPrintCR. |
239 | 501 |
[(subBlockSize := aStream nextByte) > 0] whileTrue:[ |
502 |
aStream skip:subBlockSize |
|
503 |
]. |
|
504 |
^ self |
|
505 |
]. |
|
506 |
||
507 |
"/ |
|
508 |
"/ unknown extension |
|
509 |
"/ |
|
354
b4d2ce853c24
stefans suggested info/warning/error/fatal
Claus Gittinger <cg@exept.de>
parents:
339
diff
changeset
|
510 |
'GIFREADER [info]: unknown extension ignored' infoPrintCR. |
239 | 511 |
[(subBlockSize := aStream nextByte) > 0] whileTrue:[ |
512 |
aStream skip:subBlockSize |
|
154 | 513 |
] |
514 |
||
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
515 |
"Modified: 24.7.1997 / 18:02:49 / cg" |
0 | 516 |
! ! |
43 | 517 |
|
339 | 518 |
!GIFReader class methodsFor:'documentation'! |
135 | 519 |
|
520 |
version |
|
670
6a7f628ee66c
oops - mask was only set for interlaced images (stupid typo)
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
521 |
^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.55 1997-07-24 16:03:58 cg Exp $' |
135 | 522 |
! ! |
43 | 523 |
GIFReader initialize! |