de.jreality.shader
Class ImageData
java.lang.Object
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
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)
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
getOriginalImage
public Image getOriginalImage()
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