Top Fields Constructors Methods
com.sun.scenario.effect

public Class PerspectiveTransform

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

Field Summary

Modifier and TypeField and Description
private float[]
private float
private float
private float
private float
private final PerspectiveTransformState
private float[][]
private float
private float
private float
private float

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public ImageData
filter(FilterContext
the FilterContext that determines the environment (e.g. the graphics device or code path) on which the filter operation will be performed
fctx
,
BaseTransform
an optional transform under which the filter and its inputs will be viewed
transform
,
Rectangle
the device space (pixel) bounds of the output image or window or clip into which the result of the Effect will be rendered, or null if the output dimensions are not known.
outputClip
,
Object
an object which might be used to render the results of the effect directly.
renderHelper
,
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.filter.

Applies this filter effect to the series of images represented by the input Effects and/or the given defaultInput viewed under the given transform.

public RectBounds
getBounds(BaseTransform
the transform the effect will be viewed under
transform
,
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.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 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 Effect

Returns:

the input for this Effect
getInput
()

Returns the input for this Effect.

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 Rectangle
pack-priv Object
getState()

Overrides com.sun.scenario.effect.Effect.getState.

Returns state object that is associated with this effect instance.

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
setInput(Effect
the input for this Effect
input
)

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

public final void
setQuadMapping(float ulx, float uly, float urx, float ury, float lrx, float lry, float llx, float lly)

private void
setUnitQuadMapping(float
The X coordinate to which (0, 0) is mapped.
ulx
,
float
The Y coordinate to which (0, 0) is mapped.
uly
,
float
The X coordinate to which (1, 0) is mapped.
urx
,
float
The Y coordinate to which (1, 0) is mapped.
ury
,
float
The X coordinate to which (1, 1) is mapped.
lrx
,
float
The Y coordinate to which (1, 1) is mapped.
lry
,
float
The X coordinate to which (0, 1) is mapped.
llx
,
float
The Y coordinate to which (0, 1) is mapped.
lly
)

Sets the transform to map the unit square to the indicated quadrilateral coordinates.

private void
private void
public Point2D
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
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:
filterImageDatasgetAccelTypegetPeerupdatePeerKeyupdatePeerKey

Field Detail

devcoordsback to summary
private float[] devcoords
llxback to summary
private float llx
llyback to summary
private float lly
lrxback to summary
private float lrx
lryback to summary
private float lry
stateback to summary
private final PerspectiveTransformState state
txback to summary
private float[][] tx
ulxback to summary
private float ulx
ulyback to summary
private float uly
urxback to summary
private float urx
uryback to summary
private float ury

Constructor Detail

PerspectiveTransformback to summary
public PerspectiveTransform()
PerspectiveTransformback to summary
public PerspectiveTransform(Effect input)

Method Detail

filterback to summary
public ImageData filter(FilterContext fctx, BaseTransform transform, Rectangle outputClip, Object renderHelper, Effect defaultInput)

Overrides com.sun.scenario.effect.FilterEffect.filter.

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

Applies this filter effect to the series of images represented by the input Effects and/or the given defaultInput viewed under the given transform. The filter does not need to create pixel data for any pixels that fall outside of the destination device-space (pixel) bounds specified by the outputClip Rectangle.

The filter might be able to use the renderHelper object to render the results directly on its own if the object is not null and implements an interface, such as ImageHelper, that the filter recognizes. If the effect renders itself then it will return a null for the ImageData result.

Note that the ImageData object returned by this method must be validated prior to use with ImageData#validate(com.sun.scenario.effect.FilterContext) method.

      boolean valid;

      do {
          ImageData res = filter(fctx, transform, clip, renderer, defaultInput);
          if (res == null) {
              break;
          }
          if (valid = res.validate(fctx)) {
              // Render res.getImage() to the appropriate destination
              // or use it as an input to another chain of effects.
          }
          res.unref();
      } while (!valid);
      

Parameters
fctx:FilterContext

the FilterContext that determines the environment (e.g. the graphics device or code path) on which the filter operation will be performed

transform:BaseTransform

an optional transform under which the filter and its inputs will be viewed

outputClip:Rectangle

the device space (pixel) bounds of the output image or window or clip into which the result of the Effect will be rendered, or null if the output dimensions are not known.

renderHelper:Object

an object which might be used to render the results of the effect directly.

defaultInput:Effect

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

Returns:ImageData

the ImageData holding the result of this filter operation or null if the filter had no output or used the renderHelper to render its results directly.

Annotations
@Override
getBoundsback to summary
public RectBounds 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.

Parameters
transform:BaseTransform

the transform the effect will be viewed under

defaultInput:Effect

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

Returns:RectBounds

the bounding box of this filter

Annotations
@Override
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
getInputback to summary
public final Effect getInput()

Returns the input for this Effect.

Returns:Effect

the input for this Effect

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
getResultBoundsback to summary
public Rectangle getResultBounds(BaseTransform transform, Rectangle outputClip, ImageData... inputDatas)

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

Annotations
@Override
getStateback to summary
pack-priv Object getState()

Overrides com.sun.scenario.effect.Effect.getState.

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

Returns state object that is associated with this effect instance. Subclasses may override this method to return some sort of state object that contains implementation details that are hidden from the public API. Classes outside this package can use the AccessHelper class to get access to this package-private method.

Annotations
@Override
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
setInputback to summary
public void setInput(Effect input)

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

Parameters
input:Effect

the input for this Effect

setQuadMappingback to summary
public final void setQuadMapping(float ulx, float uly, float urx, float ury, float lrx, float lry, float llx, float lly)
setUnitQuadMappingback to summary
private void setUnitQuadMapping(float ulx, float uly, float urx, float ury, float lrx, float lry, float llx, float lly)

Sets the transform to map the unit square to the indicated quadrilateral coordinates. The resulting perspective transform will perform the following coordinate mappings:

    T(0, 0) = (ulx, uly)
    T(0, 1) = (urx, ury)
    T(1, 1) = (lrx, lry)
    T(1, 0) = (llx, lly)
Note that the upper left corner of the unit square (0, 0) is mapped to the coordinates specified by (ulx, uly) and so on around the unit square in a clockwise direction.
Parameters
ulx:float

The X coordinate to which (0, 0) is mapped.

uly:float

The Y coordinate to which (0, 0) is mapped.

urx:float

The X coordinate to which (1, 0) is mapped.

ury:float

The Y coordinate to which (1, 0) is mapped.

lrx:float

The X coordinate to which (1, 1) is mapped.

lry:float

The Y coordinate to which (1, 1) is mapped.

llx:float

The X coordinate to which (0, 1) is mapped.

lly:float

The Y coordinate to which (0, 1) is mapped.

setupDevCoordsback to summary
private void setupDevCoords(BaseTransform transform)
setupTransformsback to summary
private void setupTransforms(BaseTransform transform)
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.

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 transformed point in the coordinate space of the result

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.

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