Package 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
An abstract implementation of the Light interface.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
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
void
Sets the new light color,newColor
should be in sRGB.static final double
sRGBToLsRGB
(double value) Conversion function for light values.
-
Constructor Details
-
AbstractLight
-
-
Method Details
-
sRGBToLsRGB
public static final double sRGBToLsRGB(double value) Conversion function for light values. -
getColor
public double[] getColor(boolean linear) -
setColor
Sets the new light color,newColor
should be in sRGB. -
isConstant
public boolean isConstant()- Specified by:
isConstant
in interfaceLight
- 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 interfaceLight
- 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- Returns:
- an array of height rows, width columns where each element is an array of three components representing the x, y and z components of the light vector.
-
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 interfaceLight
- 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 pointslightRow
- 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.
-