j2d.face
Class PPMFile

java.lang.Object
  extended by j2d.face.PPMFile

public class PPMFile
extends java.lang.Object

PPM File reader/writer. Works with type 2,4-6.


Constructor Summary
PPMFile(java.io.File filename)
          Read the PPM File.
 
Method Summary
 byte[] getBytes()
          Get the data as byte array.
 double[] getDouble()
          Get the data as double array.
 int getHeight()
          Get the height of the PPM image.
 int getWidth()
          Get the width of the PPM image.
static void main(java.lang.String[] args)
           
static void writeImage(java.lang.String fn, byte[] data, int width, int height)
          Write to
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PPMFile

public PPMFile(java.io.File filename)
        throws java.io.FileNotFoundException,
               java.io.IOException
Read the PPM File.

Throws:
java.io.FileNotFoundException - if the directory/image specified is wrong
java.io.IOException - if there are problems reading the file.
Method Detail

getHeight

public int getHeight()
Get the height of the PPM image.

Returns:
the height of the image.

getWidth

public int getWidth()
Get the width of the PPM image.

Returns:
the width of the image.

getBytes

public byte[] getBytes()
Get the data as byte array. Data is of any type that has been read from the file (usually 8bit RGB)

Returns:
The data of the image.

getDouble

public double[] getDouble()
Get the data as double array. Data is of any type that has been read from the file (usually 8bit RGB put into an 64bit double)

Returns:
The data of the image.

writeImage

public static void writeImage(java.lang.String fn,
                              byte[] data,
                              int width,
                              int height)
                       throws java.io.FileNotFoundException,
                              java.io.IOException
Write to
Throws:
java.io.FileNotFoundException - if the directory/image specified is wrong
java.io.IOException - if there are problems reading the file.

main

public static void main(java.lang.String[] args)