|
Class: PBMReader
Object
|
+--ImageReader
|
+--PBMReader
- Package:
- stx:libview2
- Category:
- Graphics-Images-Readers
- Version:
- rev:
1.46
date: 2023/05/04 15:02:41
- user: cg
- file: PBMReader.st directory: libview2
- module: stx stc-classLibrary: libview2
this class provides methods for loading and saving Portable BitMap-file
images (Jef Poskanzers portable bitmap package).
Reading is supported for 1bit (pbm), greyscale (pgm) and 24bit (ppm) formats.
(i.e. P1, P3, P4, P5, P6 and P7 formats)
Writing is (currently) only supported for the binary formats;
i.e. 1-bit images as (pbm P4), 8-bit gray as (pgm P5) and 24-bit images as (pnm P6).
Q: should we broil this one to perfection and base all others on
pipe-readers to the various pbmplus converters ?
copyrightCOPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
class initialization
-
initialize
-
install myself in the Image classes fileFormat table
for the `.pbm', '.pgm' and '.pnm' extensions.
testing
-
canRepresent: anImage
-
return true, if anImage can be represented in my file format.
Currently, only 1bit B&W, 8bit-grey and 24bit RGB images are supported.
-
isValidImageStream: inStream
-
return true, if inStream contains a PBM image (which I can read)
private-reading
-
readMaxVal
-
-
readWidthAndHeight
-
-
readWidthAndHeightAndMaxVal
-
-
skipPBMJunk
-
this method removes any superfluous characters from the input stream.
private-writing
-
writeCommonHeader: format on: aStream
-
common header for P4, P5 and P5 formats
reading
-
fromStream: aStream
-
read a Portable bitmap file format as of Jeff Poskanzers Portable Bitmap Package.
supported are PPM, PBM, PGM and PNM files.
-
readDepth1AsciiPBMStream
-
import portable bitmap ascii (PBM, P1 format); P1 is already read
-
readDepth1PBMStream
-
import portable bitmap (PBM, P4 format); P4 is already read
-
readDepth24AsciiPBMStream
-
import ascii portable pixmap (PBM, P3 format); P3 is already read
-
readDepth24PPMStream
-
import portable pixmap (PPM, P6 format); P6 is already read
-
readDepth8PGMStream
-
import portable gray map (PGM, P5 format); P5 is already read
-
readDepth8PPMStream
-
import portable pixmap (PPM, P7 format); P7 is already read
writing
-
save: image onStream: aStream
-
save image as PBM/PGM/PNM file on aFileName
-
writePBMFileOn: aStream
-
Saves the receivers image on the file fileName in Portable Bitmap format.
-
writePGMFileOn: aStream
-
Saves the receiver's image on the file fileName in Portable Greymap format.
-
writePNMFileOn: aStream
-
Saves the receivers image on the file fileName in Portable Anymap format.
(PBMReader fromFile:'../../support/libjpeg-9/testimg.ppm')
inspect
|
|