com.jhlabs.image
Class LightFilter

java.lang.Object
  extended by com.jhlabs.image.AbstractBufferedImageOp
      extended by com.jhlabs.image.WholeImageFilter
          extended by 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
 class LightFilter.AmbientLight
           
 class LightFilter.DistantLight
           
static class LightFilter.Light
          A class representing a light.
static class LightFilter.Material
          A class representing material properties.
 class LightFilter.PointLight
           
 class LightFilter.SpotLight
           
 
Field Summary
static int AMBIENT
           
static int BUMPS_FROM_BEVEL
          Use a custom function as the bump map.
static int BUMPS_FROM_IMAGE
          Use the input image brightness as the bump map.
static int BUMPS_FROM_IMAGE_ALPHA
          Use the input image alpha as the bump map.
static int BUMPS_FROM_MAP
          Use a separate image alpha channel as the bump map.
static int COLORS_CONSTANT
          Use constant material color.
static int COLORS_FROM_IMAGE
          Take the output colors from the input image.
static int DISTANT
           
static int POINT
           
protected static float r255
           
static int SPOT
           
 
Fields inherited from class com.jhlabs.image.WholeImageFilter
originalSpace, transformedSpace
 
Constructor Summary
LightFilter()
           
 
Method Summary
 void addLight(LightFilter.Light light)
           
protected  int[] filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)
          Actually filter the pixels.
 Function2D getBumpFunction()
           
 float getBumpHeight()
           
 int getBumpShape()
           
 float getBumpSoftness()
           
 int getBumpSource()
           
 int getColorSource()
           
 int getDiffuseColor()
           
 java.awt.Image getEnvironmentMap()
           
 java.util.Vector getLights()
           
 LightFilter.Material getMaterial()
           
 float getViewDistance()
           
protected  Color4f phongShade(Vector3f position, Vector3f viewpoint, Vector3f normal, Color4f diffuseColor, Color4f specularColor, LightFilter.Material material, LightFilter.Light[] lightsArray)
           
 void removeLight(LightFilter.Light light)
           
 void setBumpFunction(Function2D bumpFunction)
           
 void setBumpHeight(float bumpHeight)
           
 void setBumpShape(int bumpShape)
           
 void setBumpSoftness(float bumpSoftness)
           
 void setBumpSource(int bumpSource)
           
 void setColorSource(int colorSource)
           
 void setDiffuseColor(int diffuseColor)
           
 void setEnvironmentMap(java.awt.image.BufferedImage environmentMap)
           
protected  void setFromRGB(Color4f c, int argb)
           
 void setMaterial(LightFilter.Material material)
           
 void setViewDistance(float viewDistance)
           
 java.lang.String toString()
           
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
Constructor Detail

LightFilter

public LightFilter()
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: WholeImageFilter
Actually filter the pixels.

Specified by:
filterPixels in class WholeImageFilter
Parameters:
width - the image width
height - the image height
inPixels - the image pixels
transformedSpace - 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:
toString in class java.lang.Object