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
public abstract class AbstractLight extends java.lang.Object implements Light
An abstract implementation of the Light interface.- Version:
- $Id: AbstractLight.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description private double[]colorLight color in linear sRGB
-
Constructor Summary
Constructors Constructor Description AbstractLight(java.awt.Color color)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(java.awt.Color newColor)Sets the new light color,newColorshould be in sRGB.static doublesRGBToLsRGB(double value)Conversion function for light values.
-
-
-
Method Detail
-
sRGBToLsRGB
public static final double sRGBToLsRGB(double value)
Conversion function for light values.
-
getColor
public double[] getColor(boolean linear)
-
setColor
public void setColor(java.awt.Color newColor)
Sets the new light color,newColorshould be in sRGB.
-
isConstant
public boolean isConstant()
- Specified by:
isConstantin 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:
getLightMapin 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:
getLightRowin 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.
-
-