Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.mit.media.hive.support
Class SerializableImage  view SerializableImage download SerializableImage.java

java.lang.Object
  extended byedu.mit.media.hive.support.SerializableImage
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
PPM

public class SerializableImage
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Each instance of this class represents an image stored as an array of ints. These images are not AWT images - they are device independent images that can be serialized. They can be created from AWT Images, or from subclasses such as PPM that read from files. The format is an array of integers - each integer is a pixel in ARGB format (the same that MemoryImageSource uses in the default color model).


Field Summary
protected  int[] data
          The pixels of the image in ARGB format (default java color model)
protected  java.awt.Dimension dim
          The dimension of the image being represented.
 
Constructor Summary
SerializableImage()
           
SerializableImage(java.awt.Image image)
          Create a new serializable image from an AWT image.
SerializableImage(int[] data, java.awt.Dimension dim)
          Create a new image from a pixel array and a Dimension.
 
Method Summary
 java.lang.Object clone()
          Clone a serializable image
 java.awt.Image getImage()
          Create an AWT image from our internal image data.
 java.awt.image.ImageProducer getImageProducer()
          Return an ImageProducer from our internal image data.
 int[] getRep()
          This method returns the raw pixels of the underlying image.
 java.awt.Dimension getSize()
          returns the dimension of the image.
private  void readObject(java.io.ObjectInputStream in)
          Reads the compressed image from the input stream
private  void writeObject(java.io.ObjectOutputStream out)
          Writes the dimensions and the data compressed to the outputstream For now, the image will always be compressed.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dim

protected java.awt.Dimension dim
The dimension of the image being represented.


data

protected int[] data
The pixels of the image in ARGB format (default java color model)

Constructor Detail

SerializableImage

public SerializableImage()

SerializableImage

public SerializableImage(int[] data,
                         java.awt.Dimension dim)
Create a new image from a pixel array and a Dimension.


SerializableImage

public SerializableImage(java.awt.Image image)
Create a new serializable image from an AWT image.

Method Detail

clone

public java.lang.Object clone()
Clone a serializable image


readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads the compressed image from the input stream


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes the dimensions and the data compressed to the outputstream For now, the image will always be compressed.


getImage

public java.awt.Image getImage()
Create an AWT image from our internal image data.


getImageProducer

public java.awt.image.ImageProducer getImageProducer()
Return an ImageProducer from our internal image data.


getSize

public java.awt.Dimension getSize()
returns the dimension of the image.


getRep

public int[] getRep()
This method returns the raw pixels of the underlying image. It kind of breaks the abstraction barrier, but it comes in handy to implement filters without needing a PixelGrabber