Top Fields Constructors Methods
com.sun.scenario.effect.impl.state

public Class GaussianRenderState

extends LinearConvolveRenderState
Class Inheritance
Imports
com.sun.javafx.geom.Rectangle, com.sun.javafx.geom.transform.Affine2D, .BaseTransform, .NoninvertibleTransformException, com.sun.scenario.effect.Color4f, .Filterable, .ImageData, com.sun.scenario.effect.impl.BufferUtil, java.nio.FloatBuffer

Field Summary

Modifier and TypeField and Description
private float
private float
private BaseTransform
private boolean
public static final float
private float
private LinearConvolveRenderState.PassType
private BaseTransform
private float[]
private Color4f
private RenderState.EffectCoordinateSpace
private float
private float
private int
private FloatBuffer
private float
private float
Inherited from com.sun.scenario.effect.impl.state.LinearConvolveRenderState:
BLACK_COMPONENTSMAX_COMPILED_KERNEL_SIZEMAX_KERNEL_SIZEMIN_EFFECT_RADIUS

Constructor Summary

AccessConstructor and Description
public
GaussianRenderState(float
the Gaussian radius along the user space X axis
xradius
,
float
the Gaussian radius along the user space Y axis
yradius
,
float
the spread amount
spread
,
boolean
true if this is a shadow operation
isShadow
,
Color4f
the color of the shadow operation
shadowColor
,
BaseTransform
the transform applied to the filter operation
filtertx
)

Constructs a RenderState for a 2 dimensional Gaussian convolution.

public
GaussianRenderState(float
the Gaussian radius along the indicated direction
radius
,
float
the delta X of the unit vector along which to apply the convolution
dx
,
float
the delta Y of the unit vector along which to apply the convolution
dy
,
BaseTransform
the transform applied to the filter operation
filtertx
)

Constructs a RenderState for a single dimensional, directional Gaussian convolution (as for a MotionBlur operation).

Method Summary

Modifier and TypeMethod and Description
public RenderState.EffectCoordinateSpace
getEffectTransformSpace()

Implements com.sun.scenario.effect.impl.state.RenderState.getEffectTransformSpace.

Return a hint indicating which coordinate space should be used for the pixel filtering for this particular filtering operation.

pack-priv static FloatBuffer
getGaussianWeights(FloatBuffer weights, int pad, float radius, float spread)

public Rectangle
getInputClip(int
the index of the input being processed
i
,
Rectangle
the output clip supplied to the given filter operation
filterClip
)

Implements com.sun.scenario.effect.impl.state.RenderState.getInputClip.

Return the clip for the indicated input based on the indicated output clip.

public int
getInputKernelSize(int
the pass for which the intended kernel size is desired
pass
)

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getInputKernelSize.

Returns the size of the desired convolution kernel for the given pass as it would be applied in the coordinate space indicated by the getInputKernelSize(int) method.

public BaseTransform
getInputTransform(BaseTransform
the BaseTransform object for the filter operation
filterTransform
)

Implements com.sun.scenario.effect.impl.state.RenderState.getInputTransform.

Return the transform that should be used to obtain pixel input from the Effect inputs for this filter operation.

public int
getPassKernelSize()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassKernelSize.

Returns the appropriate kernel size for the pass that was last validated using validateInput().

public Rectangle
getPassResultBounds(Rectangle
the bounds of the input image
srcdimension
,
Rectangle
the area needed for the final result
outputClip
)

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassResultBounds.

Returns the size of the scaled result image needed to hold the output for the currently validated pass with the indicated input dimensions and output clip.

public float[]
getPassShadowColorComponents()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassShadowColorComponents.

For a shadow convolution operation, return the 4 float versions of the color components, in the range [0, 1] for the shadow color to be substituted for the input colors.

public LinearConvolveRenderState.PassType
getPassType()

Overrides com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassType.

Return a hint about the way that the weights will be applied to the pixels for the currently validated pass.

public float[]
getPassVector()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassVector.

Returns an array of 4 floats used to initialize a float4 Shader constant with the relative starting location of the first weight in the convolution kernel and the incremental offset between each sample to be weighted and accumulated.

public FloatBuffer
getPassWeights()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassWeights.

A FloatBuffer padded out to the required size as specified by the getPeerSize() method filled with the convolution weights needed for the currently validated pass.

public int
getPassWeightsArrayLength()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassWeightsArrayLength.

Returns the maximum number of valid float4 elements that should be referenced from the buffer returned by getWeights() for the currently validated pass.

public BaseTransform
getResultTransform(BaseTransform
the BaseTransform object for the filter operation
filterTransform
)

Implements com.sun.scenario.effect.impl.state.RenderState.getResultTransform.

Return the transform that should be used to transform the results of the filter operation.

public Color4f
getShadowColor()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getShadowColor.

Returns the Color4f representing the shadow color if this is a shadow operation.

public boolean
isNop()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isNop.

Returns true if the resulting operation is globally a NOP operation.

public boolean
isPassNop()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isPassNop.

Returns true if the operation of the currently validated pass would be a NOP operation.

public boolean
isShadow()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isShadow.

Returns true if this is a shadow convolution operation where a constant color is substituted for the color components of the output.

public ImageData
validatePassInput(ImageData
the ImageData object supplied by the source effect
src
,
int
the pass of the operation being applied (usually horizontal for pass 0 and vertical for pass 1)
pass
)

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.validatePassInput.

Validates the RenderState object for a given pass of the convolution.

private void
Inherited from com.sun.scenario.effect.impl.state.LinearConvolveRenderState:
getPassPeergetPeerSizenearOnenearZero

Field Detail

inputRadiusXback to summary
private float inputRadiusX
inputRadiusYback to summary
private float inputRadiusY
inputtxback to summary
private BaseTransform inputtx
isShadowback to summary
private boolean isShadow
MAX_RADIUSback to summary
public static final float MAX_RADIUS
passRadiusback to summary
private float passRadius
passTypeback to summary
private LinearConvolveRenderState.PassType passType
resulttxback to summary
private BaseTransform resulttx
samplevectorsback to summary
private float[] samplevectors
shadowColorback to summary
private Color4f shadowColor
spaceback to summary
private RenderState.EffectCoordinateSpace space
spreadback to summary
private float spread
spreadPassback to summary
private float spreadPass
validatedPassback to summary
private int validatedPass
weightsback to summary
private FloatBuffer weights
weightsValidRadiusback to summary
private float weightsValidRadius
weightsValidSpreadback to summary
private float weightsValidSpread

Constructor Detail

GaussianRenderStateback to summary
public GaussianRenderState(float xradius, float yradius, float spread, boolean isShadow, Color4f shadowColor, BaseTransform filtertx)

Constructs a RenderState for a 2 dimensional Gaussian convolution.

Parameters
xradius:float

the Gaussian radius along the user space X axis

yradius:float

the Gaussian radius along the user space Y axis

spread:float

the spread amount

isShadow:boolean

true if this is a shadow operation

shadowColor:Color4f

the color of the shadow operation

filtertx:BaseTransform

the transform applied to the filter operation

GaussianRenderStateback to summary
public GaussianRenderState(float radius, float dx, float dy, BaseTransform filtertx)

Constructs a RenderState for a single dimensional, directional Gaussian convolution (as for a MotionBlur operation).

Parameters
radius:float

the Gaussian radius along the indicated direction

dx:float

the delta X of the unit vector along which to apply the convolution

dy:float

the delta Y of the unit vector along which to apply the convolution

filtertx:BaseTransform

the transform applied to the filter operation

Method Detail

getEffectTransformSpaceback to summary
public RenderState.EffectCoordinateSpace getEffectTransformSpace()

Implements com.sun.scenario.effect.impl.state.RenderState.getEffectTransformSpace.

Doc from com.sun.scenario.effect.impl.state.RenderState.getEffectTransformSpace.

Return a hint indicating which coordinate space should be used for the pixel filtering for this particular filtering operation. The getEffectTransform() and getResultTransform() methods will always be used to get the actual transforms to be used to get input data and transform the results, but this method can help to set the expectations of the caller to optimize techniques.

Returns:RenderState.EffectCoordinateSpace

an EffectSpace value to describe the expected output from the getEffectTransform(...) and getResultTransform(...) methods.

Annotations
@Override
getGaussianWeightsback to summary
pack-priv static FloatBuffer getGaussianWeights(FloatBuffer weights, int pad, float radius, float spread)
getInputClipback to summary
public Rectangle getInputClip(int i, Rectangle filterClip)

Implements com.sun.scenario.effect.impl.state.RenderState.getInputClip.

Doc from com.sun.scenario.effect.impl.state.RenderState.getInputClip.

Return the clip for the indicated input based on the indicated output clip.

Parameters
i:int

the index of the input being processed

filterClip:Rectangle

the output clip supplied to the given filter operation

Returns:Rectangle

the required rectangle from the indicated input to provide enough pixels to produce the indicated output clip

Annotations
@Override
getInputKernelSizeback to summary
public int getInputKernelSize(int pass)

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getInputKernelSize.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getInputKernelSize.

Returns the size of the desired convolution kernel for the given pass as it would be applied in the coordinate space indicated by the getInputKernelSize(int) method. This value is calculated at the start of the render operation and does not vary as the filter operation progresses, but it may not represent the actual kernel size used when the indicated pass actually occurs if the validatePassInput() method needs to choose different values when it sees the incoming image source.

Parameters
pass:int

the pass for which the intended kernel size is desired

Returns:int

the intended kernel size for the requested pass

Annotations
@Override
getInputTransformback to summary
public BaseTransform getInputTransform(BaseTransform filterTransform)

Implements com.sun.scenario.effect.impl.state.RenderState.getInputTransform.

Doc from com.sun.scenario.effect.impl.state.RenderState.getInputTransform.

Return the transform that should be used to obtain pixel input from the Effect inputs for this filter operation. The returned transform is handed to all input Effect objects to obtain pixel data for the inputs. Typically, the output of getInputTransform(transform) and getResultTransform(transform) could be concatenated to produce the original filterTransform.

Parameters
filterTransform:BaseTransform

the BaseTransform object for the filter operation

Returns:BaseTransform

the BaseTransform object to use for the input effects

Annotations
@Override
getPassKernelSizeback to summary
public int getPassKernelSize()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassKernelSize.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassKernelSize.

Returns the appropriate kernel size for the pass that was last validated using validateInput().

Returns:int

the pixel kernel size of the current pass

Annotations
@Override
getPassResultBoundsback to summary
public Rectangle getPassResultBounds(Rectangle srcdimension, Rectangle outputClip)

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassResultBounds.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassResultBounds.

Returns the size of the scaled result image needed to hold the output for the currently validated pass with the indicated input dimensions and output clip. The image may be further scaled after the shader operation is through to obtain the final result bounds. This value is only of use to the actual shader to understand exactly how much room to allocate for the shader result.

Parameters
srcdimension:Rectangle

the bounds of the input image

outputClip:Rectangle

the area needed for the final result

Returns:Rectangle

the bounds of the result image for the current pass

Annotations
@Override
getPassShadowColorComponentsback to summary
public float[] getPassShadowColorComponents()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassShadowColorComponents.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassShadowColorComponents.

For a shadow convolution operation, return the 4 float versions of the color components, in the range [0, 1] for the shadow color to be substituted for the input colors. This method will only be called if isShadow() returns true.

Returns:float[]

the array of 4 floats representing the shadow color components

Annotations
@Override
getPassTypeback to summary
public LinearConvolveRenderState.PassType getPassType()

Overrides com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassType.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassType.

Return a hint about the way that the weights will be applied to the pixels for the currently validated pass.

Returns:LinearConvolveRenderState.PassType

the appropriate PassType that describes the filtering operation for this pass of the algorithm

Annotations
@Override
getPassVectorback to summary
public float[] getPassVector()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassVector.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassVector.

Returns an array of 4 floats used to initialize a float4 Shader constant with the relative starting location of the first weight in the convolution kernel and the incremental offset between each sample to be weighted and accumulated. The values are stored in the array in the following order:

    shadervec.x = vector[0] = incdx // X delta between subsequent samples
    shadervec.y = vector[1] = incdy // Y delta between subsequent samples
    shadervec.z = vector[2] = startdx // X offset to first convolution sample
    shadervec.w = vector[3] = startdy // Y offset to first convolution sample
These values are used in the shader loop as follows:
    samplelocation = outputpixellocation.xy + shadervec.zw;
    for (each weight) {
        sum += weight * sample(samplelocation.xy);
        samplelocation.xy += shadervec.xy;
    }
The values are relative to the texture coordinate space which are normalized to the range [0,1] over the source texture.
Returns:float[]

an array of 4 floats representing [ incdx, incdy, startdx, startdy ]

Annotations
@Override
getPassWeightsback to summary
public FloatBuffer getPassWeights()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassWeights.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassWeights.

A FloatBuffer padded out to the required size as specified by the getPeerSize() method filled with the convolution weights needed for the currently validated pass.

Returns:FloatBuffer

a FloatBuffer containing the kernel convolution weights

Annotations
@Override
getPassWeightsArrayLengthback to summary
public int getPassWeightsArrayLength()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassWeightsArrayLength.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getPassWeightsArrayLength.

Returns the maximum number of valid float4 elements that should be referenced from the buffer returned by getWeights() for the currently validated pass.

Returns:int

the maximum number of valid float4 elements in the weights buffer

Annotations
@Override
getResultTransformback to summary
public BaseTransform getResultTransform(BaseTransform filterTransform)

Implements com.sun.scenario.effect.impl.state.RenderState.getResultTransform.

Doc from com.sun.scenario.effect.impl.state.RenderState.getResultTransform.

Return the transform that should be used to transform the results of the filter operation. The returned transform is combined with the resulting filter result texture to produce an output ImageData object. Typically, the output of getInputTransform(transform) and getResultTransform(transform) could be concatenated to produce the original filterTransform.

Parameters
filterTransform:BaseTransform

the BaseTransform object for the filter operation

Returns:BaseTransform

the BaseTransform object to be applied to the result texture

Annotations
@Override
getShadowColorback to summary
public Color4f getShadowColor()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getShadowColor.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.getShadowColor.

Returns the Color4f representing the shadow color if this is a shadow operation. This value is dependent only on the original Effect from which this RenderState was instantiated and does not vary as the filter operation progresses.

Returns:Color4f

the Color4f for the shadow color, or null

Annotations
@Override
isNopback to summary
public boolean isNop()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isNop.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isNop.

Returns true if the resulting operation is globally a NOP operation. This condition is calculated at the start of the render operation and is based on whether the perturbations of the convolution kernel would be noticeable at all in the coordinate space of the output.

Returns:boolean

true if the operation is a global NOP

Annotations
@Override
isPassNopback to summary
public boolean isPassNop()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isPassNop.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isPassNop.

Returns true if the operation of the currently validated pass would be a NOP operation.

Returns:boolean

true if the current pass is a NOP

Annotations
@Override
isShadowback to summary
public boolean isShadow()

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isShadow.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.isShadow.

Returns true if this is a shadow convolution operation where a constant color is substituted for the color components of the output. This value is dependent only on the original Effect from which this RenderState was instantiated and does not vary as the filter operation progresses.

Returns:boolean

true if this is a shadow operation

Annotations
@Override
validatePassInputback to summary
public ImageData validatePassInput(ImageData src, int pass)

Implements abstract com.sun.scenario.effect.impl.state.LinearConvolveRenderState.validatePassInput.

Doc from com.sun.scenario.effect.impl.state.LinearConvolveRenderState.validatePassInput.

Validates the RenderState object for a given pass of the convolution. The supplied source image is provided so that the RenderState object can determine if it needs to change its strategy for how the convolution operation will be performed and to scale its data for the getPass*() methods relative to the source dimensions and transform.

Parameters
src:ImageData

the ImageData object supplied by the source effect

pass:int

the pass of the operation being applied (usually horizontal for pass 0 and vertical for pass 1)

Returns:ImageData

the ImageData to be used for the actual convolution operation

Annotations
@Override
validateWeightsback to summary
private void validateWeights()