jfig.utils
Class PPMReader

java.lang.Object
  extended byjfig.utils.PPMReader

public class PPMReader
extends java.lang.Object

read image data in portable pixmap format (PPM).

PPMReader: read image data from input streams in raw portable pixmap (PPM) format. This class does not support PGM, PBM or verbose PPM format.


Field Summary
(package private)  boolean debug
           
(package private)  int height
           
(package private)  int maxvalue
           
(package private)  int[] pixels
           
(package private)  int width
           
 
Constructor Summary
PPMReader()
           
 
Method Summary
 java.awt.Image getPPMImage(java.awt.Component observer, java.io.InputStream stream)
          Read a ppm (raw) image from InputStream 'stream' and use AWT-Component 'observer' to create an AWT image.
static void main(java.lang.String[] argv)
          main: load and display an PPM image.
static void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

int width

height

int height

maxvalue

int maxvalue

pixels

int[] pixels

debug

boolean debug
Constructor Detail

PPMReader

public PPMReader()
Method Detail

getPPMImage

public java.awt.Image getPPMImage(java.awt.Component observer,
                                  java.io.InputStream stream)
                           throws java.lang.Exception
Read a ppm (raw) image from InputStream 'stream' and use AWT-Component 'observer' to create an AWT image. Note that observer _must_ be visible for this to work (AWT bug).

The ppm (raw) image format looks like this:

     P6
     # comment line(s)
     595 842
     255
     width*height bytes with the image data
     

Throws:
java.lang.Exception

usage

public static void usage()

main

public static void main(java.lang.String[] argv)
main: load and display an PPM image. Originally used for debugging, but may be used as a PPM viewer, too.