Top Description Fields Constructors Methods
com.sun.scenario.effect

public Class DisplacementMap

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

An effect that shifts each pixel according to an (x,y) distance from the (red,green) channels of a map image, respectively.

Field Summary

Modifier and TypeField and Description
private FloatMap
private float
private float
private float
private float
private boolean

Constructor Summary

AccessConstructor and Description
public
DisplacementMap(FloatMap mapData)

Constructs a new DisplacementMap effect, using the default input for source data.

public
DisplacementMap(FloatMap
the map data
mapData
,
Effect
the content input Effect
contentInput
)

Constructs a new DisplacementMap effect using the specified input Effect for source data, or the default input if contentInput is null.

Method Summary

Modifier and TypeMethod and Description
public ImageData
filterImageDatas(FilterContext fctx, BaseTransform transform, Rectangle outputClip, RenderState rstate, ImageData... inputs)

Overrides com.sun.scenario.effect.CoreEffect.filterImageDatas.

Convenience method that sends the given input data through the current peer, and then attempts to release the input image data.

public final Effect

Returns:

the content input for this Effect
getContentInput
()

Returns the content input for this Effect.

public DirtyRegionContainer
getDirtyRegions(Effect
the default input Effect to be used in all cases where a filter has a null input
defaultInput
,
DirtyRegionPool
the pool of dirty regions
regionPool
)

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

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

public final FloatMap

Returns:

the map data for this Effect
getMapData
()

Returns the map data for this Effect.

public float

Returns:

the x offset factor
getOffsetX
()

Returns the x offset factor.

public float

Returns:

the y offset factor
getOffsetY
()

Returns the y offset factor.

public RenderState
getRenderState(FilterContext
the context object that would be used by the Renderer if this call is preparing for a render operation, or null
fctx
,
BaseTransform
the transform for the output of this operation
transform
,
Rectangle
the clip rectangle that may restrict this operation, or null
outputClip
,
Object
the rendering helper object that can be used to shortcut this operation under certain conditions, or null
renderHelper
,
Effect
the Effect to be used in place of any null inputs
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 float

Returns:

the x scale factor
getScaleX
()

Returns the x scale factor.

public float

Returns:

the y scale factor
getScaleY
()

Returns the y scale factor.

public boolean

Returns:

true if wrapping is enabled, false otherwise
getWrap
()

Returns whether values taken from outside the edges of the map "wrap around" or not.

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
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
setMapData(FloatMap
the map data for this Effect
mapData
)

Sets the map data for this Effect.

public void
setOffsetX(float
the x offset factor
offsetX
)

Sets the x offset factor.

public void
setOffsetY(float
the y offset factor
offsetY
)

Sets the y offset factor.

public void
setScaleX(float
the x scale factor
scaleX
)

Sets the x scale factor.

public void
setScaleY(float
the y scale factor
scaleY
)

Sets the y scale factor.

public void
setWrap(boolean
true if wrapping is enabled, false otherwise
wrap
)

Sets whether values taken from outside the edges of the map "wrap around" or not.

public Point2D

Returns:

the undefined point (NaN, NaN)
transform
(Point2D
the point in the coordinate space of the primary content input to be transformed
p
,
Effect
the default input Effect to be used in all cases where a filter has a null input
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

Returns:

the untransformed point in the coordinate space of the primary content input
untransform
(Point2D
the point in the coordinate space of the result output to be transformed
p
,
Effect
the default input Effect to be used in all cases where a filter has a null input
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:
getAccelTypegetPeerupdatePeerKeyupdatePeerKey

Field Detail

mapDataback to summary
private FloatMap mapData
offsetXback to summary
private float offsetX
offsetYback to summary
private float offsetY
scaleXback to summary
private float scaleX
scaleYback to summary
private float scaleY
wrapback to summary
private boolean wrap

Constructor Detail

DisplacementMapback to summary
public DisplacementMap(FloatMap mapData)

Constructs a new DisplacementMap effect, using the default input for source data. This is a shorthand equivalent to:

    new DisplacementMap(mapData, DefaultInput)
Exceptions
IllegalArgumentException:
if mapData is null
DisplacementMapback to summary
public DisplacementMap(FloatMap mapData, Effect contentInput)

Constructs a new DisplacementMap effect using the specified input Effect for source data, or the default input if contentInput is null.

Parameters
mapData:FloatMap

the map data

contentInput:Effect

the content input Effect

Exceptions
IllegalArgumentException:
if mapData is null

Method Detail

filterImageDatasback to summary
public ImageData filterImageDatas(FilterContext fctx, BaseTransform transform, Rectangle outputClip, RenderState rstate, ImageData... inputs)

Overrides com.sun.scenario.effect.CoreEffect.filterImageDatas.

Doc from com.sun.scenario.effect.CoreEffect.filterImageDatas.

Convenience method that sends the given input data through the current peer, and then attempts to release the input image data.

Annotations
@Override
getContentInputback to summary
public final Effect getContentInput()

Returns the content input for this Effect.

Returns:Effect

the content input for this Effect

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.

Parameters
defaultInput:Effect

the default input Effect to be used in all cases where a filter has a null input

regionPool:DirtyRegionPool

the pool of dirty regions

Returns:DirtyRegionContainer

the dirty region container

Annotations
@Override
getMapDataback to summary
public final FloatMap getMapData()

Returns the map data for this Effect.

Returns:FloatMap

the map data for this Effect

getOffsetXback to summary
public float getOffsetX()

Returns the x offset factor.

Returns:float

the x offset factor

getOffsetYback to summary
public float getOffsetY()

Returns the y offset factor.

Returns:float

the y offset factor

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.

Parameters
fctx:FilterContext

the context object that would be used by the Renderer if this call is preparing for a render operation, or null

transform:BaseTransform

the transform for the output of this operation

outputClip:Rectangle

the clip rectangle that may restrict this operation, or null

renderHelper:Object

the rendering helper object that can be used to shortcut this operation under certain conditions, or null

defaultInput:Effect

the Effect to be used in place of any null inputs

Annotations
@Override
getScaleXback to summary
public float getScaleX()

Returns the x scale factor.

Returns:float

the x scale factor

getScaleYback to summary
public float getScaleY()

Returns the y scale factor.

Returns:float

the y scale factor

getWrapback to summary
public boolean getWrap()

Returns whether values taken from outside the edges of the map "wrap around" or not.

Returns:boolean

true if wrapping is enabled, false otherwise

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.

Returns:boolean

true if this effect may reduce opacity of some pixels of one of it's input (and thus the default input) or it's relevant input(s) might have reduced opaque pixels of the default input already.

Annotations
@Override
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

setMapDataback to summary
public void setMapData(FloatMap mapData)

Sets the map data for this Effect.

Parameters
mapData:FloatMap

the map data for this Effect

Exceptions
IllegalArgumentException:
if mapData is null
setOffsetXback to summary
public void setOffsetX(float offsetX)

Sets the x offset factor.

      Min:  n/a
      Max:  n/a
  Default: -0.5
 Identity:  0.0
Parameters
offsetX:float

the x offset factor

setOffsetYback to summary
public void setOffsetY(float offsetY)

Sets the y offset factor.

      Min:  n/a
      Max:  n/a
  Default: -0.5
 Identity:  0.0
Parameters
offsetY:float

the y offset factor

setScaleXback to summary
public void setScaleX(float scaleX)

Sets the x scale factor.

      Min: n/a
      Max: n/a
  Default: 1.0
 Identity: 1.0
Parameters
scaleX:float

the x scale factor

setScaleYback to summary
public void setScaleY(float scaleY)

Sets the y scale factor.

      Min: n/a
      Max: n/a
  Default: 1.0
 Identity: 1.0
Parameters
scaleY:float

the y scale factor

setWrapback to summary
public void setWrap(boolean wrap)

Sets whether values taken from outside the edges of the map "wrap around" or not.

      Min:  n/a
      Max:  n/a
  Default: false
 Identity:  n/a
Parameters
wrap:boolean

true if wrapping is enabled, false otherwise

transformback to summary
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. 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?"

Since the displacement map represents a mapping from output pixels to relative source pixels, there may be multiple answers or no answer for any given input coordinate so this method returns (NaN, NaN).

Parameters
p:Point2D

the point in the coordinate space of the primary content input to be transformed

defaultInput:Effect

the default input Effect to be used in all cases where a filter has a null input

Returns:Point2D

the undefined point (NaN, NaN)

Annotations
@Override
untransformback to summary
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. In essence, this method asks the question "Which source coordinate contributes most to the definition of the output at the specified coordinate?"

This method returns the floating point coordinate where the backwards mapping displacement map tells it to get the data for the specified coordinate.

Parameters
p:Point2D

the point in the coordinate space of the result output to be transformed

defaultInput:Effect

the default input Effect to be used in all cases where a filter has a null input

Returns:Point2D

the untransformed point in the coordinate space of the primary content input

Annotations
@Override