org.apache.batik.ext.awt.image
Class AbstractLight
java.lang.Object
|
+--org.apache.batik.ext.awt.image.AbstractLight
- All Implemented Interfaces:
- Light
- Direct Known Subclasses:
- DistantLight, PointLight, SpotLight
- public abstract class AbstractLight
- extends java.lang.Object
- implements Light
An abstract implementation of the Light interface.
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. |
boolean |
isConstant()
|
void |
setColor(java.awt.Color newColor)
Sets the new light color, newColor should be in sRGB. |
static double |
sRGBToLsRGB(double value)
Conversion function for light values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.batik.ext.awt.image.Light |
getLight |
AbstractLight
public AbstractLight(java.awt.Color color)
sRGBToLsRGB
public static final double sRGBToLsRGB(double value)
- Conversion function for light values.
getColor
public double[] getColor(boolean linear)
- Specified by:
getColor
in interface Light
- 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
setColor
public void setColor(java.awt.Color newColor)
- Sets the new light color, newColor should be in sRGB.
- Specified by:
setColor
in interface Light
isConstant
public boolean isConstant()
- Specified by:
isConstant
in interface Light
- Returns:
- true if the light is constant over the whole surface
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.
- Specified by:
getLightMap
in interface Light
- Parameters:
x
- x-axis coordinate where the light should be computedy
- y-axis coordinate where the light should be computeddx
- delta x for computing light vectors in user spacedy
- delta y for computing light vectors in user spacewidth
- number of samples to compute on the x axisheight
- number of samples to compute on the y axisz
- 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.
- Specified by:
getLightRow
in interface Light
- Parameters:
x
- x-axis coordinate where the light should be computedy
- y-axis coordinate where the light should be computeddx
- delta x for computing light vectors in user spacewidth
- number of samples to compute on the x axisz
- array containing the z elevation for all the pointslightRwo
- 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.
Copyright © 2002 Apache Software Foundation. All Rights Reserved.