APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.scenario.effect

public Class PhongLighting

extends CoreEffect<RenderState>
Class Inheritance
Imports
com.sun.javafx.geom.BaseBounds, .DirtyRegionContainer, .DirtyRegionPool, .Point2D, .Rectangle, com.sun.javafx.geom.transform.BaseTransform, com.sun.scenario.effect.impl.state.RenderState, com.sun.scenario.effect.light.Light

An effect that applies diffuse and specular lighting to an arbitrary input using a positionable light source.

Field Summary

Modifier and TypeField and Description
private float
private Light
private float
private float
private float

Constructor Summary

AccessConstructor and Description
public
PhongLighting(Light
the light source
light
)

Constructs a new PhongLighting effect for the given Light, with default values for all other properties, using the default input for source data.

public
PhongLighting(Light
the light source
light
,
Effect
the input containing the bump map
bumpInput
,
Effect
the input containing the content data
contentInput
)

Constructs a new PhongLighting effect for the given Light and the given bump and content input Effects with default values for all other properties.

Method Summary

Modifier and TypeMethod and Description
public BaseBounds
getBounds(BaseTransform transform, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.getBounds.

Returns the bounding box that will be affected by this filter operation when viewed under the specified transform, given its list of input Effects and the specified defaultInput effect.

public final Effect

Returns:

the bump input for this Effect
getBumpInput
()

Returns the bump input for this Effect.

public final Effect

Returns:

the content input for this Effect
getContentInput
()

Returns the content input for this Effect.

private Effect
getContentInput(Effect defaultInput)

public float

Returns:

the diffuse constant value
getDiffuseConstant
()

Returns the diffuse constant.

public DirtyRegionContainer
getDirtyRegions(Effect defaultInput, DirtyRegionPool regionPool)

Overrides com.sun.scenario.effect.Effect.getDirtyRegions.

Returns the dirty region container containing dirty regions affected by this filter operation.

public Light

Returns:

the light source
getLight
()

Returns the light source.

public RenderState
getRenderState(FilterContext fctx, BaseTransform transform, Rectangle outputClip, Object renderHelper, Effect defaultInput)

Implements abstract com.sun.scenario.effect.FilterEffect.getRenderState.

Returns the object representing the rendering strategy and state for the filter operation characterized by the specified arguments.

public Rectangle
public float

Returns:

the specular constant value
getSpecularConstant
()

Returns the specular constant.

public float

Returns:

the specular exponent value
getSpecularExponent
()

Returns the specular exponent.

public float

Returns:

the surface scale value
getSurfaceScale
()

Returns the surface scale.

public boolean
reducesOpaquePixels()

Implements abstract com.sun.scenario.effect.Effect.reducesOpaquePixels.

Whether an opacity for any pixel is different (lower) than the corresponding pixel in the default input.

public void
setBumpInput(Effect
the bump input for this Effect
bumpInput
)

Sets the bump input for this Effect to a specific Effect or to the default input if input is null.

public void
setContentInput(Effect
the content input for this Effect
contentInput
)

Sets the content input for this Effect to a specific Effect or to the default input if input is null.

public void
setDiffuseConstant(float
the diffuse constant value
diffuseConstant
)

Sets the diffuse constant.

public void
setLight(Light
the light source
light
)

Sets the light source.

public void
setSpecularConstant(float
the specular constant value
specularConstant
)

Sets the specular constant.

public void
setSpecularExponent(float
the specular exponent value
specularExponent
)

Sets the specular exponent.

public void
setSurfaceScale(float
the surface scale value
surfaceScale
)

Sets the surface scale.

public Point2D
transform(Point2D p, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.transform.

Transform the specified point p from the coordinate space of the primary content input to the coordinate space of the effect output.

public Point2D
untransform(Point2D p, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.untransform.

Transform the specified point p from the coordinate space of the output of the effect into the coordinate space of the primary content input.

Inherited from com.sun.scenario.effect.CoreEffect:
filterImageDatasgetAccelTypegetPeerupdatePeerKeyupdatePeerKey

Field Detail

diffuseConstantback to summary
private float diffuseConstant
lightback to summary
private Light light
specularConstantback to summary
private float specularConstant
specularExponentback to summary
private float specularExponent
surfaceScaleback to summary
private float surfaceScale

Constructor Detail

PhongLightingback to summary
public PhongLighting(Light light)

Constructs a new PhongLighting effect for the given Light, with default values for all other properties, using the default input for source data. This is a convenience constructor that automatically generates a bump map using the default input.

Parameters
light:Light

the light source

Exceptions
IllegalArgumentException:
if light is null
PhongLightingback to summary
public PhongLighting(Light light, Effect bumpInput, Effect contentInput)

Constructs a new PhongLighting effect for the given Light and the given bump and content input Effects with default values for all other properties.

Parameters
light:Light

the light source

bumpInput:Effect

the input containing the bump map

contentInput:Effect

the input containing the content data

Exceptions
IllegalArgumentException:
if light is null

Method Detail

getBoundsback to summary
public BaseBounds getBounds(BaseTransform transform, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.getBounds.

Doc from com.sun.scenario.effect.Effect.getBounds.

Returns the bounding box that will be affected by this filter operation when viewed under the specified transform, given its list of input Effects and the specified defaultInput effect. Note that the returned bounds can be smaller or larger than one or more of the inputs.

Annotations
@Override
getBumpInputback to summary
public final Effect getBumpInput()

Returns the bump input for this Effect.

Returns:Effect

the bump input for this Effect

getContentInputback to summary
public final Effect getContentInput()

Returns the content input for this Effect.

Returns:Effect

the content input for this Effect

getContentInputback to summary
private Effect getContentInput(Effect defaultInput)
getDiffuseConstantback to summary
public float getDiffuseConstant()

Returns the diffuse constant.

Returns:float

the diffuse constant value

getDirtyRegionsback to summary
public DirtyRegionContainer getDirtyRegions(Effect defaultInput, DirtyRegionPool regionPool)

Overrides com.sun.scenario.effect.Effect.getDirtyRegions.

Doc from com.sun.scenario.effect.Effect.getDirtyRegions.

Returns the dirty region container containing dirty regions affected by this filter operation.

Annotations
@Override
getLightback to summary
public Light getLight()

Returns the light source.

Returns:Light

the light source

getRenderStateback to summary
public RenderState getRenderState(FilterContext fctx, BaseTransform transform, Rectangle outputClip, Object renderHelper, Effect defaultInput)

Implements abstract com.sun.scenario.effect.FilterEffect.getRenderState.

Doc from com.sun.scenario.effect.FilterEffect.getRenderState.

Returns the object representing the rendering strategy and state for the filter operation characterized by the specified arguments. This call can also be used to get a state object for non-rendering cases like querying the bounds of an operation in which case the FilterContext object may be null. outputClip and renderHelper may always be null just as they may be null for a given filter operation.

Annotations
@Override
getResultBoundsback to summary
public Rectangle getResultBounds(BaseTransform transform, Rectangle outputClip, ImageData... inputDatas)

Overrides com.sun.scenario.effect.Effect.getResultBounds.

Annotations
@Override
getSpecularConstantback to summary
public float getSpecularConstant()

Returns the specular constant.

Returns:float

the specular constant value

getSpecularExponentback to summary
public float getSpecularExponent()

Returns the specular exponent.

Returns:float

the specular exponent value

getSurfaceScaleback to summary
public float getSurfaceScale()

Returns the surface scale.

Returns:float

the surface scale value

reducesOpaquePixelsback to summary
public boolean reducesOpaquePixels()

Implements abstract com.sun.scenario.effect.Effect.reducesOpaquePixels.

Doc from com.sun.scenario.effect.Effect.reducesOpaquePixels.

Whether an opacity for any pixel is different (lower) than the corresponding pixel in the default input. It is always safe to return true from this method, though the consequences may be that the caller chooses to not utilize a planned optimization.

Annotations
@Override
setBumpInputback to summary
public void setBumpInput(Effect bumpInput)

Sets the bump input for this Effect to a specific Effect or to the default input if input is null.

Parameters
bumpInput:Effect

the bump input for this Effect

setContentInputback to summary
public void setContentInput(Effect contentInput)

Sets the content input for this Effect to a specific Effect or to the default input if input is null.

Parameters
contentInput:Effect

the content input for this Effect

setDiffuseConstantback to summary
public void setDiffuseConstant(float diffuseConstant)

Sets the diffuse constant.

      Min: 0.0
      Max: 2.0
  Default: 1.0
 Identity: n/a
Parameters
diffuseConstant:float

the diffuse constant value

Exceptions
IllegalArgumentException:
if diffuseConstant is outside the allowable range
setLightback to summary
public void setLight(Light light)

Sets the light source.

Parameters
light:Light

the light source

Exceptions
IllegalArgumentException:
if light is null
setSpecularConstantback to summary
public void setSpecularConstant(float specularConstant)

Sets the specular constant.

      Min: 0.0
      Max: 2.0
  Default: 1.0
 Identity: n/a
Parameters
specularConstant:float

the specular constant value

Exceptions
IllegalArgumentException:
if specularConstant is outside the allowable range
setSpecularExponentback to summary
public void setSpecularExponent(float specularExponent)

Sets the specular exponent.

      Min:  0.0
      Max: 40.0
  Default:  1.0
 Identity:  n/a
Parameters
specularExponent:float

the specular exponent value

Exceptions
IllegalArgumentException:
if specularExponent is outside the allowable range
setSurfaceScaleback to summary
public void setSurfaceScale(float surfaceScale)

Sets the surface scale.

      Min:  0.0
      Max: 10.0
  Default:  1.0
 Identity:  n/a
Parameters
surfaceScale:float

the surface scale value

Exceptions
IllegalArgumentException:
if surfaceScale is outside the allowable range
transformback to summary
public Point2D transform(Point2D p, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.transform.

Doc from com.sun.scenario.effect.Effect.transform.

Transform the specified point p from the coordinate space of the primary content input to the coordinate space of the effect output. In essence, this method asks the question "Which output coordinate is most affected by the data at the specified coordinate in the primary source input?"

The definition of which input represents the primary content input and how the coordinate space of that input compares to the coordinate space of the result varies from effect to effect. Note that some effects may have a reasonable definition of how to map source coordinates to destination coordinates, but not the reverse. In particular, effects which map source coordinates discontiguously into the result may have several output coordinates that are affected by a given input coordinate and may choose to return one of many equally valid answers, or an undefined result such as NaN, or some other anomalous value. Most effects perform simple transformations of the color of each pixel and so represent an identity transform and return the point unchanged.

Annotations
@Override
untransformback to summary
public Point2D untransform(Point2D p, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.untransform.

Doc from com.sun.scenario.effect.Effect.untransform.

Transform the specified point p from the coordinate space of the output of the effect into the coordinate space of the primary content input. In essence, this method asks the question "Which source coordinate contributes most to the definition of the output at the specified coordinate?"

The definition of which input represents the primary content input and how the coordinate space of that input compares to the coordinate space of the result varies from effect to effect. Note that some effects may have a reasonable definition of how to map destination coordinates back to source coordinates, but not the reverse. In particular, effects which produce entirely synthetic results not based on any content input may not be able to give a meaningful result to this query and may return undefined coordinates such as 0, Infinity, or NaN. Most effects perform simple transformations of the color of each pixel and so represent an identity transform and return the point unchanged.

Annotations
@Override