Package com.jhlabs.image
Class LightFilter
- java.lang.Object
-
- com.jhlabs.image.AbstractBufferedImageOp
-
- com.jhlabs.image.WholeImageFilter
-
- com.jhlabs.image.LightFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp,java.lang.Cloneable
- Direct Known Subclasses:
ChromeFilter
public class LightFilter extends WholeImageFilter
A filter which produces lighting and embossing effects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLightFilter.AmbientLightclassLightFilter.DistantLightstatic classLightFilter.LightA class representing a light.static classLightFilter.MaterialA class representing material properties.classLightFilter.PointLightclassLightFilter.SpotLight
-
Field Summary
Fields Modifier and Type Field Description static intAMBIENTstatic intBUMPS_FROM_BEVELUse a custom function as the bump map.static intBUMPS_FROM_IMAGEUse the input image brightness as the bump map.static intBUMPS_FROM_IMAGE_ALPHAUse the input image alpha as the bump map.static intBUMPS_FROM_MAPUse a separate image alpha channel as the bump map.static intCOLORS_CONSTANTUse constant material color.static intCOLORS_FROM_IMAGETake the output colors from the input image.static intDISTANTstatic intPOINTprotected static floatr255static intSPOT-
Fields inherited from class com.jhlabs.image.WholeImageFilter
originalSpace, transformedSpace
-
-
Constructor Summary
Constructors Constructor Description LightFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLight(LightFilter.Light light)protected int[]filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)Actually filter the pixels.Function2DgetBumpFunction()floatgetBumpHeight()intgetBumpShape()floatgetBumpSoftness()intgetBumpSource()intgetColorSource()intgetDiffuseColor()java.awt.ImagegetEnvironmentMap()java.util.VectorgetLights()LightFilter.MaterialgetMaterial()floatgetViewDistance()protected Color4fphongShade(Vector3f position, Vector3f viewpoint, Vector3f normal, Color4f diffuseColor, Color4f specularColor, LightFilter.Material material, LightFilter.Light[] lightsArray)voidremoveLight(LightFilter.Light light)voidsetBumpFunction(Function2D bumpFunction)voidsetBumpHeight(float bumpHeight)voidsetBumpShape(int bumpShape)voidsetBumpSoftness(float bumpSoftness)voidsetBumpSource(int bumpSource)voidsetColorSource(int colorSource)voidsetDiffuseColor(int diffuseColor)voidsetEnvironmentMap(java.awt.image.BufferedImage environmentMap)protected voidsetFromRGB(Color4f c, int argb)voidsetMaterial(LightFilter.Material material)voidsetViewDistance(float viewDistance)java.lang.StringtoString()-
Methods inherited from class com.jhlabs.image.WholeImageFilter
filter, transformSpace
-
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB, stringToColor
-
-
-
-
Field Detail
-
COLORS_FROM_IMAGE
public static final int COLORS_FROM_IMAGE
Take the output colors from the input image.- See Also:
- Constant Field Values
-
COLORS_CONSTANT
public static final int COLORS_CONSTANT
Use constant material color.- See Also:
- Constant Field Values
-
BUMPS_FROM_IMAGE
public static final int BUMPS_FROM_IMAGE
Use the input image brightness as the bump map.- See Also:
- Constant Field Values
-
BUMPS_FROM_IMAGE_ALPHA
public static final int BUMPS_FROM_IMAGE_ALPHA
Use the input image alpha as the bump map.- See Also:
- Constant Field Values
-
BUMPS_FROM_MAP
public static final int BUMPS_FROM_MAP
Use a separate image alpha channel as the bump map.- See Also:
- Constant Field Values
-
BUMPS_FROM_BEVEL
public static final int BUMPS_FROM_BEVEL
Use a custom function as the bump map.- See Also:
- Constant Field Values
-
r255
protected static final float r255
- See Also:
- Constant Field Values
-
AMBIENT
public static final int AMBIENT
- See Also:
- Constant Field Values
-
DISTANT
public static final int DISTANT
- See Also:
- Constant Field Values
-
POINT
public static final int POINT
- See Also:
- Constant Field Values
-
SPOT
public static final int SPOT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setMaterial
public void setMaterial(LightFilter.Material material)
-
getMaterial
public LightFilter.Material getMaterial()
-
setBumpFunction
public void setBumpFunction(Function2D bumpFunction)
-
getBumpFunction
public Function2D getBumpFunction()
-
setBumpHeight
public void setBumpHeight(float bumpHeight)
-
getBumpHeight
public float getBumpHeight()
-
setBumpSoftness
public void setBumpSoftness(float bumpSoftness)
-
getBumpSoftness
public float getBumpSoftness()
-
setBumpShape
public void setBumpShape(int bumpShape)
-
getBumpShape
public int getBumpShape()
-
setViewDistance
public void setViewDistance(float viewDistance)
-
getViewDistance
public float getViewDistance()
-
setEnvironmentMap
public void setEnvironmentMap(java.awt.image.BufferedImage environmentMap)
-
getEnvironmentMap
public java.awt.Image getEnvironmentMap()
-
setColorSource
public void setColorSource(int colorSource)
-
getColorSource
public int getColorSource()
-
setBumpSource
public void setBumpSource(int bumpSource)
-
getBumpSource
public int getBumpSource()
-
setDiffuseColor
public void setDiffuseColor(int diffuseColor)
-
getDiffuseColor
public int getDiffuseColor()
-
addLight
public void addLight(LightFilter.Light light)
-
removeLight
public void removeLight(LightFilter.Light light)
-
getLights
public java.util.Vector getLights()
-
setFromRGB
protected void setFromRGB(Color4f c, int argb)
-
filterPixels
protected int[] filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)Description copied from class:WholeImageFilterActually filter the pixels.- Specified by:
filterPixelsin classWholeImageFilter- Parameters:
width- the image widthheight- the image heightinPixels- the image pixelstransformedSpace- the output bounds- Returns:
- the output pixels
-
phongShade
protected Color4f phongShade(Vector3f position, Vector3f viewpoint, Vector3f normal, Color4f diffuseColor, Color4f specularColor, LightFilter.Material material, LightFilter.Light[] lightsArray)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-