de.jreality.shader
Class ImageData

java.lang.Object
  extended by de.jreality.shader.ImageData
All Implemented Interfaces:
Serializable

public class ImageData
extends Object
implements Serializable

This class covers data of an image either created as a Image or as a byte[] array containing RGBA values for each pixel (row/column order ?). If bytes or Image is available use a Constructor - otherwise use a factory method to load an image from an Input source

Note: this class is immutable. The Constructors that have an image parameter just extract the data from the given image and don't reference it any longer. byte[] data is copied. Pending: do we want to keep the original image to pass out as RO instance?

Author:
weissman
See Also:
Serialized Form

Constructor Summary
ImageData(byte[] data, int width, int height)
           
ImageData(Image img)
           
ImageData(Image img, double[] channelMatrix)
           
ImageData(Image img, int width, int height)
           
ImageData(Image img, int width, int height, double[] channelMatrix)
           
 
Method Summary
 byte[] getByteArray()
           
 byte[] getByteArray(double[] channelArithmeticMatrix)
          applies the given matrix to all pixel values.
 int getHeight()
           
 Image getImage()
           
 int getWidth()
           
static ImageData load(Input input)
           
static ImageData load(Input input, double[] channelMatrix)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageData

public ImageData(byte[] data,
                 int width,
                 int height)

ImageData

public ImageData(Image img)

ImageData

public ImageData(Image img,
                 int width,
                 int height)

ImageData

public ImageData(Image img,
                 double[] channelMatrix)

ImageData

public ImageData(Image img,
                 int width,
                 int height,
                 double[] channelMatrix)
Method Detail

load

public static ImageData load(Input input)
                      throws IOException
Throws:
IOException

load

public static ImageData load(Input input,
                             double[] channelMatrix)
                      throws IOException
Throws:
IOException

getHeight

public int getHeight()

getWidth

public int getWidth()

getImage

public Image getImage()
Returns:
a readonly instance of the Image

getByteArray

public byte[] getByteArray()
Returns:
a copy of the byte data

getByteArray

public byte[] getByteArray(double[] channelArithmeticMatrix)
applies the given matrix to all pixel values.

Parameters:
channelArithmeticMatrix - the matrix to multiply the byte array with
Returns:
the transformed byte array

toString

public String toString()
Overrides:
toString in class Object