author | Claus Gittinger <cg@exept.de> |
Wed, 31 Jul 2002 14:05:47 +0200 | |
changeset 1588 | 34e2502e4891 |
parent 1562 | 3b444efb61ee |
child 1737 | a1ed08195ee7 |
permissions | -rw-r--r-- |
27 | 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 |
" |
|
12 |
||
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
13 |
"{ Package: 'stx:libview2' }" |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
14 |
|
27 | 15 |
ImageReader subclass:#PCXReader |
201 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
259 | 19 |
category:'Graphics-Images-Support' |
27 | 20 |
! |
21 |
||
29 | 22 |
!PCXReader class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
102 | 40 |
this class provides methods for loading 8-plane PCX bitmap files. |
201 | 41 |
|
29 | 42 |
Due to not having too many examples for testing, this could fail |
201 | 43 |
to read some files. |
44 |
(especially, I have no uncompressed files for testing). |
|
45 |
||
46 |
Only 8-bit (i.e. 256 color) PCX images are supported. |
|
47 |
Image writing is not supported. |
|
48 |
||
49 |
[See also:] |
|
531 | 50 |
Image Form Icon |
51 |
BlitImageReader FaceReader GIFReader JPEGReader PBMReader |
|
52 |
ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader |
|
53 |
XBMReader XPMReader XWDReader |
|
29 | 54 |
" |
55 |
! ! |
|
56 |
||
43 | 57 |
!PCXReader class methodsFor:'initialization'! |
58 |
||
59 |
initialize |
|
201 | 60 |
"tell Image-class, that a new fileReader is present |
398 | 61 |
for the '.pcx' extension." |
43 | 62 |
|
647 | 63 |
MIMETypes defineImageType:'image/x-pcx' suffix:'pcx' reader:self. |
201 | 64 |
|
630 | 65 |
"Modified: 27.6.1997 / 18:39:23 / cg" |
43 | 66 |
! ! |
67 |
||
27 | 68 |
!PCXReader class methodsFor:'testing'! |
69 |
||
70 |
isValidImageFile:aFilename |
|
71 |
"return true, if aFilename contains a PCX image" |
|
72 |
||
29 | 73 |
|count header inStream| |
27 | 74 |
|
75 |
inStream := self streamReadingFile:aFilename. |
|
76 |
inStream isNil ifTrue:[^ false]. |
|
77 |
inStream binary. |
|
78 |
||
79 |
header := ByteArray uninitializedNew:128. |
|
29 | 80 |
count := inStream nextBytes:128 into:header. |
27 | 81 |
inStream close. |
82 |
||
29 | 83 |
((count == 128) and:[self isValidPCXHeader:header]) ifFalse:[ |
27 | 84 |
^ false |
85 |
]. |
|
86 |
^ true |
|
102 | 87 |
|
88 |
"Modified: 17.9.1995 / 17:32:07 / claus" |
|
201 | 89 |
! |
90 |
||
91 |
isValidPCXHeader:aHeader |
|
92 |
"return true, if aHeader looks like a PCX image header" |
|
93 |
||
530 | 94 |
"check magic number" |
201 | 95 |
((aHeader at:1) ~~ 16r0A) ifTrue:[ |
531 | 96 |
^ false |
201 | 97 |
]. |
98 |
||
99 |
"check version" |
|
100 |
(#(0 2 3 5) includes:(aHeader at:2)) ifFalse:[ |
|
531 | 101 |
^ false |
201 | 102 |
]. |
103 |
||
104 |
^ true |
|
530 | 105 |
|
106 |
"Modified: 16.4.1997 / 22:24:32 / cg" |
|
27 | 107 |
! ! |
108 |
||
109 |
!PCXReader methodsFor:'reading from file'! |
|
110 |
||
201 | 111 |
fromStream:aStream |
112 |
"read an image in pcx format from aStream" |
|
113 |
||
114 |
|fileSize header img| |
|
115 |
||
116 |
inStream := aStream. |
|
117 |
||
118 |
inStream binary. |
|
119 |
fileSize := aStream size. |
|
120 |
||
121 |
fileSize < 128 ifTrue:[ |
|
812
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
122 |
^ self fileFormatError:'short file'. |
201 | 123 |
]. |
124 |
||
125 |
header := ByteArray uninitializedNew:128. |
|
126 |
aStream nextBytes:128 into:header. |
|
127 |
||
128 |
(self class isValidPCXHeader:header) ifFalse:[ |
|
812
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
129 |
^ self fileFormatError:'wrong header'. |
201 | 130 |
]. |
131 |
||
132 |
img := self fromStreamWithHeader:header. |
|
133 |
^ img |
|
812
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
134 |
|
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
135 |
"Modified: / 3.2.1998 / 17:58:17 / cg" |
201 | 136 |
! |
137 |
||
27 | 138 |
fromStreamWithHeader:header |
201 | 139 |
"read an raw image in pcx format from aStream. |
140 |
The header has already been read into the header argument." |
|
141 |
||
27 | 142 |
| inDepth version compression nPlanes xmin ymin xmax ymax |
143 |
paletteType rawMap rMap gMap bMap |
|
32 | 144 |
endIndex "{Class: SmallInteger }" |
145 |
srcIndex "{Class: SmallInteger }" |
|
146 |
dstIndex "{Class: SmallInteger }" |
|
147 |
rowIndex "{Class: SmallInteger }" |
|
148 |
h "{Class: SmallInteger }" |
|
149 |
byte "{Class: SmallInteger }" |
|
150 |
nByte "{Class: SmallInteger }" |
|
83 | 151 |
srcBytesPerRow "{Class: SmallInteger }" |
29 | 152 |
value "{Class: SmallInteger }" |
153 |
idx2 "{Class: SmallInteger }" |
|
154 |
dataBytes buffer |
|
155 |
bufferIndex "{Class: SmallInteger }" |
|
35 | 156 |
bendIndex "{Class: SmallInteger }" |
499 | 157 |
nBuffer "{Class: SmallInteger }" |
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
158 |
mapSize nMaxPad| |
27 | 159 |
|
531 | 160 |
"/ typedef struct { /*header for PCX bitmap files*/ |
566 | 161 |
"/ unsigned char signature; /*1 PCX file identifier*/ |
162 |
"/ unsigned char version; /*2 version compatibility level*/ |
|
163 |
"/ unsigned char encoding; /*3 encoding method*/ |
|
164 |
"/ unsigned char bitsperpix; /*4 bits per pixel, or depth*/ |
|
165 |
"/ unsigned short Xleft; /*5 X position of left edge*/ |
|
166 |
"/ unsigned short Ytop; /*7 Y position of top edge*/ |
|
167 |
"/ unsigned short Xright; /*9 X position of right edge*/ |
|
168 |
"/ unsigned short Ybottom; /*11 Y position of bottom edge*/ |
|
169 |
"/ unsigned short Xscreensize; /*13 X screen res of source image*/ |
|
170 |
"/ unsigned short Yscreensize; /*15 Y screen res of source image*/ |
|
171 |
"/ unsigned char PCXpalette[16][3]; /*17 PCX color map*/ |
|
172 |
"/ unsigned char reserved1; /*17+48 should be 0, 1 if std res fax*/ |
|
173 |
"/ unsigned char planes; /*66 bit planes in image*/ |
|
174 |
"/ unsigned short linesize; /*67 byte delta between scanlines */ |
|
531 | 175 |
"/ unsigned short paletteinfo; /*0 == undef |
176 |
"/ 1 == color |
|
177 |
"/ 2 == grayscale*/ |
|
178 |
"/ unsigned char reserved2[58]; /*fill to struct size of 128*/ |
|
179 |
"/ } PCX_HEADER; |
|
180 |
||
27 | 181 |
version := header at:2. |
182 |
"/ 'version=' print. version printNL. |
|
183 |
compression := header at:3. |
|
184 |
"/ 'compression=' print. compression printNL. |
|
185 |
(#(0 1) includes:compression) ifFalse:[ |
|
812
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
186 |
^ self fileFormatError:'unknown compression'. |
27 | 187 |
]. |
530 | 188 |
|
27 | 189 |
inDepth := header at:4. |
190 |
"/ 'depth=' print. inDepth printNL. |
|
191 |
nPlanes := header at:66. |
|
192 |
"/ 'planes=' print. nPlanes printNL. |
|
83 | 193 |
srcBytesPerRow := header wordAt:67 MSB:false. |
194 |
"/ 'srcBytesPerRow=' print. srcBytesPerRow printNL. |
|
27 | 195 |
paletteType := header at:69. |
196 |
||
197 |
" |
|
198 |
although it would be easy to implement ... |
|
199 |
I have no test pictures for other formats. |
|
200 |
So its not (yet) implemented |
|
201 |
" |
|
202 |
((inDepth ~~ 8) or:[nPlanes ~~ 1]) ifTrue:[ |
|
812
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
203 |
"/ 'PCXReader: depth: ' errorPrint. inDepth errorPrint. |
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
204 |
"/ ' planes:' errorPrint. nPlanes errorPrintNL. |
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
205 |
^ self fileFormatError:'can only handle 1-plane 256 color images'. |
27 | 206 |
]. |
207 |
||
83 | 208 |
xmin := header wordAt:5 MSB:false. |
209 |
ymin := header wordAt:7 MSB:false. |
|
210 |
xmax := header wordAt:9 MSB:false. |
|
211 |
ymax := header wordAt:11 MSB:false. |
|
27 | 212 |
|
213 |
width := (xmax - xmin + 1). |
|
214 |
height := (ymax - ymin + 1). |
|
215 |
"/ 'width=' print. width printNL. |
|
216 |
"/ 'height=' print. width printNL. |
|
217 |
||
218 |
(version == 2) ifTrue:[ |
|
561 | 219 |
"read the 16-entry colormap" |
27 | 220 |
|
561 | 221 |
rawMap := ByteArray uninitializedNew:(16*3). |
222 |
rawMap replaceFrom:1 to:(16*3) with:header startingAt:17. |
|
223 |
rMap := ByteArray new:16. |
|
224 |
gMap := ByteArray new:16. |
|
225 |
bMap := ByteArray new:16. |
|
226 |
srcIndex := 1. |
|
227 |
1 to:16 do:[:i | |
|
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
228 |
|r g b| |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
229 |
|
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
230 |
r := rawMap at:srcIndex. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
231 |
g := rawMap at:srcIndex+1. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
232 |
b := rawMap at:srcIndex+2. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
233 |
|
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
234 |
rMap at:i put:r. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
235 |
gMap at:i put:g. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
236 |
bMap at:i put:b. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
237 |
srcIndex := srcIndex + 3. |
561 | 238 |
]. |
27 | 239 |
]. |
240 |
||
29 | 241 |
compression == 1 ifTrue:[ |
561 | 242 |
data := dataBytes := ByteArray uninitializedNew:(height * srcBytesPerRow). |
27 | 243 |
|
561 | 244 |
buffer := ByteArray uninitializedNew:4096. |
245 |
bufferIndex := 1. |
|
246 |
bendIndex := 1. |
|
29 | 247 |
|
561 | 248 |
rowIndex := 1. |
249 |
h := height. |
|
250 |
1 to:h do:[:row | |
|
251 |
dstIndex := rowIndex. |
|
252 |
endIndex := dstIndex + srcBytesPerRow. |
|
253 |
[dstIndex < endIndex] whileTrue:[ |
|
254 |
bufferIndex == bendIndex ifTrue:[ |
|
255 |
nBuffer := inStream nextBytes:4096 into:buffer. |
|
256 |
bufferIndex := 1. |
|
257 |
bendIndex := nBuffer + 1. |
|
258 |
]. |
|
259 |
byte := buffer at:bufferIndex. |
|
260 |
bufferIndex := bufferIndex + 1. |
|
261 |
((byte bitAnd:2r11000000) ~~ 2r11000000) ifTrue:[ |
|
262 |
dataBytes at:dstIndex put:byte. |
|
263 |
dstIndex := dstIndex + 1. |
|
264 |
] ifFalse:[ |
|
265 |
nByte := byte bitAnd:2r00111111. |
|
266 |
bufferIndex == bendIndex ifTrue:[ |
|
267 |
nBuffer := inStream nextBytes:4096 into:buffer. |
|
268 |
bufferIndex := 1. |
|
269 |
bendIndex := nBuffer + 1. |
|
270 |
]. |
|
271 |
value := buffer at:bufferIndex. |
|
272 |
bufferIndex := bufferIndex + 1. |
|
273 |
idx2 := ((dstIndex + nByte) min:endIndex) - 1. |
|
274 |
dataBytes from:dstIndex to:idx2 put:value. |
|
275 |
dstIndex := dstIndex + nByte. |
|
276 |
]. |
|
277 |
]. |
|
278 |
rowIndex := endIndex. |
|
279 |
]. |
|
29 | 280 |
|
561 | 281 |
"/ have to compress - above code reads srcBytesPerRow |
282 |
"/ (to keep in sync with RLE); but we want width bytesPerRow |
|
283 |
"/ Can compress in the data-area; leftover pixels are simply ignored |
|
284 |
"/ by other image processing code |
|
285 |
"/ |
|
286 |
srcBytesPerRow ~~ width ifTrue:[ |
|
287 |
dstIndex := width + 1. |
|
288 |
srcIndex := srcBytesPerRow + 1. |
|
289 |
2 to:h do:[:row | |
|
290 |
dataBytes replaceFrom:dstIndex to:dstIndex+width-1 with:dataBytes startingAt:srcIndex. |
|
291 |
dstIndex := dstIndex + width. |
|
292 |
srcIndex := srcIndex + srcBytesPerRow |
|
293 |
] |
|
294 |
]. |
|
295 |
nBuffer := endIndex - bufferIndex. |
|
27 | 296 |
] ifFalse:[ |
561 | 297 |
" |
298 |
uncompressed; actually untested ... |
|
299 |
" |
|
300 |
data := dataBytes := ByteArray uninitializedNew:(height * width). |
|
301 |
srcBytesPerRow ~~ width ifTrue:[ |
|
302 |
dstIndex := 1. |
|
303 |
1 to:h do:[:row | |
|
304 |
inStream nextBytes:width into:data startingAt:dstIndex. |
|
305 |
dstIndex := dstIndex + width. |
|
306 |
inStream skip:(srcBytesPerRow - width). |
|
307 |
] |
|
308 |
] ifFalse:[ |
|
309 |
inStream nextBytes:(height * width) into:data. |
|
310 |
]. |
|
311 |
nBuffer := 0. |
|
27 | 312 |
]. |
313 |
||
314 |
(version == 5) ifTrue:[ |
|
561 | 315 |
"read the 256-entry colormap" |
27 | 316 |
|
561 | 317 |
nBuffer ~~ 0 ifTrue:[ |
318 |
byte := buffer at:bufferIndex. |
|
319 |
bufferIndex := bufferIndex + 1. nBuffer := nBuffer - 1. |
|
320 |
] ifFalse:[ |
|
321 |
byte := inStream next |
|
322 |
]. |
|
29 | 323 |
|
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
324 |
"/ RLE data is padded - skip over zeros for the 0C-byte |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
325 |
nMaxPad := 15. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
326 |
[(byte ~~ 16r0C) and:[nMaxPad > 0]] whileTrue:[ |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
327 |
nBuffer ~~ 0 ifTrue:[ |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
328 |
byte := buffer at:bufferIndex. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
329 |
bufferIndex := bufferIndex + 1. nBuffer := nBuffer - 1. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
330 |
] ifFalse:[ |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
331 |
byte := inStream next |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
332 |
]. |
561 | 333 |
]. |
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
334 |
(byte == 16r0C) ifFalse:[ |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
335 |
'PCXREADER: no valid 256-entry palette (got' errorPrint. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
336 |
byte errorPrint. '; expected ' errorPrint. 16rC0 errorPrint. ')' errorPrintCR. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
337 |
]. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
338 |
|
561 | 339 |
rawMap := ByteArray uninitializedNew:(256*3). |
340 |
nBuffer ~~ 0 ifTrue:[ |
|
341 |
mapSize := buffer size - bufferIndex + 1. |
|
342 |
mapSize := mapSize min:(256*3). |
|
343 |
rawMap replaceFrom:1 to:mapSize with:buffer startingAt:bufferIndex. |
|
344 |
nBuffer < (256*3) ifTrue:[ |
|
345 |
inStream nextBytes:((256*3)-nBuffer) into:rawMap startingAt:nBuffer+1 |
|
346 |
] |
|
347 |
] ifFalse:[ |
|
348 |
inStream nextBytes:(256*3) into:rawMap. |
|
349 |
]. |
|
350 |
rMap := Array new:256. |
|
351 |
gMap := Array new:256. |
|
352 |
bMap := Array new:256. |
|
353 |
srcIndex := 1. |
|
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
354 |
|
561 | 355 |
1 to:256 do:[:i | |
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
356 |
|r g b| |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
357 |
|
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
358 |
r := rawMap at:srcIndex. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
359 |
g := rawMap at:srcIndex+1. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
360 |
b := rawMap at:srcIndex+2. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
361 |
|
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
362 |
rMap at:i put:r. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
363 |
gMap at:i put:g. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
364 |
bMap at:i put:b. |
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
365 |
srcIndex := srcIndex + 3. |
561 | 366 |
]. |
27 | 367 |
]. |
368 |
||
369 |
photometric := #palette. |
|
370 |
samplesPerPixel := 1. |
|
371 |
bitsPerSample := #(8). |
|
35 | 372 |
colorMap := Colormap redVector:rMap greenVector:gMap blueVector:bMap. |
27 | 373 |
|
374 |
" |
|
375 |
|i f| |
|
29 | 376 |
i := Image fromFile:'somefile.pcx'. |
377 |
i inspect. |
|
27 | 378 |
" |
499 | 379 |
|
812
01d6b05a1276
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
647
diff
changeset
|
380 |
"Modified: / 3.2.1998 / 17:59:03 / cg" |
27 | 381 |
! ! |
382 |
||
201 | 383 |
!PCXReader class methodsFor:'documentation'! |
384 |
||
385 |
version |
|
1562
3b444efb61ee
bug fix: palette is padded after RLE data.
Claus Gittinger <cg@exept.de>
parents:
812
diff
changeset
|
386 |
^ '$Header: /cvs/stx/stx/libview2/PCXReader.st,v 1.26 2002-03-15 16:52:43 cg Exp $' |
201 | 387 |
! ! |
27 | 388 |
PCXReader initialize! |