org.apache.batik.ext.awt.image

Class AbstractLight

public abstract class AbstractLight extends Object implements Light

An abstract implementation of the Light interface.
Constructor Summary
AbstractLight(Color color)
Method Summary
double[]getColor(boolean linear)
double[][][]getLightMap(double x, double y, double dx, double dy, int width, int height, double[][][] z)
Returns a light map, starting in (x, y) with dx, dy increments, a given width and height, and z elevations stored in the fourth component on the N array.
double[][]getLightRow(double x, double y, double dx, int width, double[][] z, double[][] lightRow)
Returns a row of the light map, starting at (x, y) with dx increments, a given width, and z elevations stored in the fourth component on the N array.
booleanisConstant()
voidsetColor(Color newColor)
Sets the new light color, newColor should be in sRGB.
static doublesRGBToLsRGB(double value)
Conversion function for light values.

Constructor Detail

AbstractLight

public AbstractLight(Color color)

Method Detail

getColor

public double[] getColor(boolean linear)

Parameters: linear if true the color is returned in the Linear sRGB colorspace otherwise the color is in the gamma corrected sRGB color space.

Returns: the light's color

getLightMap

public double[][][] getLightMap(double x, double y, double dx, double dy, int width, int height, double[][][] z)
Returns a light map, starting in (x, y) with dx, dy increments, a given width and height, and z elevations stored in the fourth component on the N array.

Parameters: x x-axis coordinate where the light should be computed y y-axis coordinate where the light should be computed dx delta x for computing light vectors in user space dy delta y for computing light vectors in user space width number of samples to compute on the x axis height number of samples to compute on the y axis z array containing the z elevation for all the points

getLightRow

public double[][] getLightRow(double x, double y, double dx, int width, double[][] z, double[][] lightRow)
Returns a row of the light map, starting at (x, y) with dx increments, a given width, and z elevations stored in the fourth component on the N array.

Parameters: x x-axis coordinate where the light should be computed y y-axis coordinate where the light should be computed dx delta x for computing light vectors in user space width number of samples to compute on the x axis z array containing the z elevation for all the points lightRow array to store the light info to, if null it will be allocated for you and returned.

Returns: an array width columns where each element is an array of three components representing the x, y and z components of the light vector.

isConstant

public boolean isConstant()

Returns: true if the light is constant over the whole surface

setColor

public void setColor(Color newColor)
Sets the new light color, newColor should be in sRGB.

sRGBToLsRGB

public static final double sRGBToLsRGB(double value)
Conversion function for light values.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.