LinearConvolveRenderState object manages the strategies of
applying a 1 or 2 pass linear convolution to an input and calculates the
necessary data for the filter shader to compute the convolution.
The object is constructed based on the transform that was provided for
the entire filter operation and determines its strategy.
Methods prefixed by getInput*() return information about the
general plan for obtaining and managing the input source image.
After the input effect is called with the information from the
getInput*() methods and its result ImageData is obtained,
the validatePassInput() method is used to examine the size and
transform of the supplied input and determine the parameters needed to
perform the convolution for the first pass.
Once validated, the methods prefixed by getPass*() return information
for applying the convolution for that validated pass.
If necessary, the validatePassInput() method is called on the
results of the first pass to calculate further data for the second pass.
Finally the getResultTransform() method is used to possibly transform
the final resulting ImageData of the last pass.
| Modifier and Type | Class and Description |
|---|---|
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final float[] | |
| public static final int | |
| public static final int | |
| pack-priv static final float |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract int | Returns: the intended kernel size for the requested passthe pass for which the intended kernel size is desired pass)Returns the size of the desired convolution kernel for the given pass
as it would be applied in the coordinate space indicated by the
|
| public abstract int | Returns: the pixel kernel size of the current passReturns the appropriate kernel size for the pass that was last validated using validateInput(). |
| public EffectPeer | Returns: theEffectPeer to use for this pass, or nullthe r, FilterContext Renderer being used for this filter operationthe fctx)FilterContext being used for this filter operationReturn the |
| public abstract Rectangle | Returns: the bounds of the result image for the current passthe bounds of the input image srcdimension, Rectangle the area needed for the final result outputClip)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 abstract float[] | Returns: the array of 4 floats representing the shadow color componentsFor a shadow convolution operation, return the 4 float versions of
the color components, in the range |
| public LinearConvolveRenderState. | Returns: the appropriatePassType that describes the filtering
operation for this pass of the algorithmReturn a hint about the way that the weights will be applied to the pixels for the currently validated pass. |
| public abstract float[] | Returns: an array of 4 floats representing[ incdx, incdy, startdx, startdy ]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 abstract FloatBuffer | Returns: aFloatBuffer containing the kernel convolution weightsA |
| public abstract int | Returns: the maximum number of valid float4 elements in the weights bufferReturns the maximum number of valid float4 elements that should be referenced from the buffer returned by getWeights() for the currently validated pass. |
| public static int | Returns: the number of convolution weights which will be applied by the associated peer.the number of computed convolution kernel weights ksize)Returns the peer sample count for a given kernel size. |
| public abstract Color4f | Returns: theColor4f for the shadow color, or nullReturns the |
| public abstract boolean | Returns: true if the operation is a global NOPReturns true if the resulting operation is globally a NOP operation. |
| public abstract boolean | Returns: true if the current pass is a NOPReturns true if the operation of the currently validated pass would be a NOP operation. |
| public abstract boolean | Returns: true if this is a shadow operationReturns true if this is a shadow convolution operation where a constant color is substituted for the color components of the output. |
| pack-priv static boolean | Returns: true if the accumulated value will be close enough to sizethe value being summed across the pixels v, int the number of pixels being summed across size)Returns true if summing v over size pixels ends up close enough to size.0 that we will not have shifted the sampling by enough to see any changes. |
| pack-priv static boolean | Returns: true if the accumulated value will be negligiblethe value being summed across the pixels v, int the number of pixels being summed across size)Returns true if summing v over size pixels ends up close enough to 0.0 that we will not have shifted the sampling by enough to see any changes. |
| public abstract ImageData | Returns: theImageData to be used for the actual convolution
operationthe src, int ImageData object supplied by the source effectthe pass of the operation being applied (usually horizontal
for pass 0 and vertical for pass 1) pass)Validates the |
| BLACK_COMPONENTS | back to summary |
|---|---|
| pack-priv static final float[] BLACK_COMPONENTS | |
| MAX_COMPILED_KERNEL_SIZE | back to summary |
|---|---|
| public static final int MAX_COMPILED_KERNEL_SIZE | |
| MAX_KERNEL_SIZE | back to summary |
|---|---|
| public static final int MAX_KERNEL_SIZE | |
| MIN_EFFECT_RADIUS | back to summary |
|---|---|
| pack-priv static final float MIN_EFFECT_RADIUS | |
| LinearConvolveRenderState | back to summary |
|---|---|
| public LinearConvolveRenderState() | |
| getInputKernelSize | back to summary |
|---|---|
| public abstract int getInputKernelSize(int pass) Returns the size of the desired convolution kernel for the given pass
as it would be applied in the coordinate space indicated by the
| |
| getPassKernelSize | back to summary |
|---|---|
| public abstract int getPassKernelSize() Returns the appropriate kernel size for the pass that was last validated using validateInput().
| |
| getPassPeer | back to summary |
|---|---|
| public EffectPeer Return the
| |
| getPassResultBounds | back to summary |
|---|---|
| public abstract Rectangle getPassResultBounds(Rectangle srcdimension, Rectangle outputClip) 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. | |
| getPassShadowColorComponents | back to summary |
|---|---|
| public abstract float[] getPassShadowColorComponents() For a shadow convolution operation, return the 4 float versions of
the color components, in the range
| |
| getPassType | back to summary |
|---|---|
| public LinearConvolveRenderState. Return a hint about the way that the weights will be applied to the pixels for the currently validated pass.
| |
| getPassVector | back to summary |
|---|---|
| public abstract float[] 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.
| |
| getPassWeights | back to summary |
|---|---|
| public abstract FloatBuffer getPassWeights() A
| |
| getPassWeightsArrayLength | back to summary |
|---|---|
| public abstract int getPassWeightsArrayLength() Returns the maximum number of valid float4 elements that should be referenced from the buffer returned by getWeights() for the currently validated pass.
| |
| getPeerSize | back to summary |
|---|---|
| public static int getPeerSize(int ksize) Returns the peer sample count for a given kernel size. There are only a few peers defined to operate on specific sizes of convolution kernel. If there are peers defined only for kernel sizes of 8 and 16 and a given effect has a linear convolution kernel with 5 weights, then the peer for size 8 will be used and the buffer of weights must be padded out to the appropriate size with 0s so that the shader constant pool will be fully initialized and the extra unneeded convolution samples will be ignored by the 0 weights.
| |
| getShadowColor | back to summary |
|---|---|
| public abstract Color4f getShadowColor() Returns the
| |
| isNop | back to summary |
|---|---|
| public abstract boolean 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.
| |
| isPassNop | back to summary |
|---|---|
| public abstract boolean isPassNop() Returns true if the operation of the currently validated pass would be a NOP operation.
| |
| isShadow | back to summary |
|---|---|
| public abstract boolean 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
| |
| nearOne | back to summary |
|---|---|
| pack-priv static boolean nearOne(float v, int size) Returns true if summing v over size pixels ends up close enough to size.0 that we will not have shifted the sampling by enough to see any changes. "Close enough" in this context is measured by whether or not using the coordinate in a linear interpolating sampling operation on 8-bit per sample images will cause the next pixel over to be blended in.
| |
| nearZero | back to summary |
|---|---|
| pack-priv static boolean nearZero(float v, int size) Returns true if summing v over size pixels ends up close enough to 0.0 that we will not have shifted the sampling by enough to see any changes. "Close enough" in this context is measured by whether or not using the coordinate in a linear interpolating sampling operation on 8-bit per sample images will cause the next pixel over to be blended in.
| |
| validatePassInput | back to summary |
|---|---|
| public abstract ImageData validatePassInput(ImageData src, int pass) Validates the | |
| Modifier and Type | Field and Description |
|---|---|
| public static final LinearConvolveRenderState. | GENERAL_VECTOR
The kernel on this pass can be applied in any direction or with any kind of offset. |
| public static final LinearConvolveRenderState. | HORIZONTAL_CENTERED
The kernel on this pass will be applied horizontally with the kernel centered symmetrically around each pixel. |
| public static final LinearConvolveRenderState. | VERTICAL_CENTERED
The kernel on this pass will be applied vertically with the kernel centered symmetrically around each pixel. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static LinearConvolveRenderState. | |
| public static LinearConvolveRenderState. |
| GENERAL_VECTOR | back to summary |
|---|---|
| public static final LinearConvolveRenderState. The kernel on this pass can be applied in any direction or with any kind of offset. No assumptions are made about the offset and delta of the kernel vector. | |
| HORIZONTAL_CENTERED | back to summary |
|---|---|
| public static final LinearConvolveRenderState. The kernel on this pass will be applied horizontally with the kernel centered symmetrically around each pixel. The specific conditions indicated by this type are:
| |
| VERTICAL_CENTERED | back to summary |
|---|---|
| public static final LinearConvolveRenderState. The kernel on this pass will be applied vertically with the kernel centered symmetrically around each pixel. The specific conditions indicated by this type are:
| |
| PassType | back to summary |
|---|---|
| private PassType() | |
| valueOf | back to summary |
|---|---|
| public static LinearConvolveRenderState. | |
| values | back to summary |
|---|---|
| public static LinearConvolveRenderState. | |