APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.effect

public Class PerspectiveTransform

extends Effect
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .DoublePropertyBase, .ObjectProperty, javafx.scene.Node, com.sun.javafx.effect.EffectDirtyBits, com.sun.javafx.geom.BaseBounds, .RectBounds, com.sun.javafx.geom.transform.BaseTransform, com.sun.javafx.scene.BoundsAccessor

An effect that provides non-affine transformation of the input content. Most typically PerspectiveTransform is used to provide a "faux" three-dimensional effect for otherwise two-dimensional content.

A perspective transformation is capable of mapping an arbitrary quadrilateral into another arbitrary quadrilateral, while preserving the straightness of lines. Unlike an affine transformation, the parallelism of lines in the source is not necessarily preserved in the output.

Note that this effect does not adjust the coordinates of input events or any methods that measure containment on a Node. The results of mouse picking and the containment methods are undefined when a Node has a PerspectiveTransform effect in place.

Example:

PerspectiveTransform perspectiveTrasform = new PerspectiveTransform();
perspectiveTrasform.setUlx(10.0);
perspectiveTrasform.setUly(10.0);
perspectiveTrasform.setUrx(310.0);
perspectiveTrasform.setUry(40.0);
perspectiveTrasform.setLrx(310.0);
perspectiveTrasform.setLry(60.0);
perspectiveTrasform.setLlx(10.0);
perspectiveTrasform.setLly(90.0);

Group g = new Group();
g.setEffect(perspectiveTrasform);
g.setCache(true);

Rectangle rect = new Rectangle();
rect.setX(10.0);
rect.setY(10.0);
rect.setWidth(280.0);
rect.setHeight(80.0);
rect.setFill(Color.web("0x3b596d"));

Text text = new Text();
text.setX(20.0);
text.setY(65.0);
text.setText("Perspective");
text.setFill(Color.ALICEBLUE);
text.setFont(Font.font(null, FontWeight.BOLD, 36));

g.getChildren().addAll(rect, text);

The code above produces the following:

The visual effect of
PerspectiveTransform on text

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private float[]
private ObjectProperty<Effect>
input

The input for this Effect.

private DoubleProperty
llx

The x coordinate of the output location onto which the lower left corner of the source is mapped.

private DoubleProperty
lly

The y coordinate of the output location onto which the lower left corner of the source is mapped.

private DoubleProperty
lrx

The x coordinate of the output location onto which the lower right corner of the source is mapped.

private DoubleProperty
lry

The y coordinate of the output location onto which the lower right corner of the source is mapped.

private DoubleProperty
ulx

The x coordinate of the output location onto which the upper left corner of the source is mapped.

private DoubleProperty
uly

The y coordinate of the output location onto which the upper left corner of the source is mapped.

private DoubleProperty
urx

The x coordinate of the output location onto which the upper right corner of the source is mapped.

private DoubleProperty
ury

The y coordinate of the output location onto which the upper right corner of the source is mapped.

Constructor Summary

AccessConstructor and Description
public
PerspectiveTransform()

Creates a new instance of PerspectiveTransform with default parameters.

public
PerspectiveTransform(double
the x coordinate of upper left corner
ulx
,
double
the y coordinate of upper left corner
uly
,
double
the x coordinate of upper right corner
urx
,
double
the y coordinate of upper right corner
ury
,
double
the x coordinate of lower right corner
lrx
,
double
the y coordinate of lower right corner
lry
,
double
the x coordinate of lower left corner
llx
,
double
the y coordinate of lower left corner
lly
)

Creates a new instance of PerspectiveTransform with the specified ulx, uly, urx, ury, lrx, lry, llx, and lly.

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv Effect
copy()

Implements abstract javafx.scene.effect.Effect.copy.

pack-priv PerspectiveTransform
pack-priv BaseBounds
getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)

Implements abstract javafx.scene.effect.Effect.getBounds.

Returns bounds of given node with applied effect.

public final Effect
public final double
public final double
public final double
public final double
public final double
public final double
public final double
public final double
public final ObjectProperty<Effect>
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final void
public final void
setLlx(double value)

public final void
setLly(double value)

public final void
setLrx(double value)

public final void
setLry(double value)

public final void
setUlx(double value)

public final void
setUly(double value)

private void
public final void
setUrx(double value)

public final void
setUry(double value)

public final DoubleProperty
public final DoubleProperty
pack-priv void
private void
public final DoubleProperty
public final DoubleProperty
Inherited from javafx.scene.effect.Effect:
containsCycleseffectBoundsChangedgetInputBoundsgetKernelSizegetPeergetShadowBoundsmarkDirtysynctransformBounds

Field Detail

devcoordsback to summary
private float[] devcoords
inputback to summary
private ObjectProperty<Effect> input

The input for this Effect. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.

Default Value
null
llxback to summary
private DoubleProperty llx

The x coordinate of the output location onto which the lower left corner of the source is mapped.

Default Value
0.0
llyback to summary
private DoubleProperty lly

The y coordinate of the output location onto which the lower left corner of the source is mapped.

Default Value
0.0
lrxback to summary
private DoubleProperty lrx

The x coordinate of the output location onto which the lower right corner of the source is mapped.

Default Value
0.0
lryback to summary
private DoubleProperty lry

The y coordinate of the output location onto which the lower right corner of the source is mapped.

Default Value
0.0
ulxback to summary
private DoubleProperty ulx

The x coordinate of the output location onto which the upper left corner of the source is mapped.

Default Value
0.0
ulyback to summary
private DoubleProperty uly

The y coordinate of the output location onto which the upper left corner of the source is mapped.

Default Value
0.0
urxback to summary
private DoubleProperty urx

The x coordinate of the output location onto which the upper right corner of the source is mapped.

Default Value
0.0
uryback to summary
private DoubleProperty ury

The y coordinate of the output location onto which the upper right corner of the source is mapped.

Default Value
0.0

Constructor Detail

PerspectiveTransformback to summary
public PerspectiveTransform()

Creates a new instance of PerspectiveTransform with default parameters.

PerspectiveTransformback to summary
public PerspectiveTransform(double ulx, double uly, double urx, double ury, double lrx, double lry, double llx, double lly)

Creates a new instance of PerspectiveTransform with the specified ulx, uly, urx, ury, lrx, lry, llx, and lly.

Parameters
ulx:double

the x coordinate of upper left corner

uly:double

the y coordinate of upper left corner

urx:double

the x coordinate of upper right corner

ury:double

the y coordinate of upper right corner

lrx:double

the x coordinate of lower right corner

lry:double

the y coordinate of lower right corner

llx:double

the x coordinate of lower left corner

lly:double

the y coordinate of lower left corner

Since
JavaFX 2.1

Method Detail

checkChainContainsback to summary
pack-priv boolean checkChainContains(Effect e)

Implements abstract javafx.scene.effect.Effect.checkChainContains.

Annotations
@Override
copyback to summary
pack-priv Effect copy()

Implements abstract javafx.scene.effect.Effect.copy.

Annotations
@Override
createPeerback to summary
pack-priv PerspectiveTransform createPeer()

Implements abstract javafx.scene.effect.Effect.createPeer.

Annotations
@Override
getBoundsback to summary
pack-priv BaseBounds getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)

Implements abstract javafx.scene.effect.Effect.getBounds.

Doc from javafx.scene.effect.Effect.getBounds.

Returns bounds of given node with applied effect. We *never* pass null in as a bounds. This method will NOT take a null bounds object. The returned value may be the same bounds object passed in, or it may be a new object.

Annotations
@Override
getInputback to summary
public final Effect getInput()
getLlxback to summary
public final double getLlx()
getLlyback to summary
public final double getLly()
getLrxback to summary
public final double getLrx()
getLryback to summary
public final double getLry()
getUlxback to summary
public final double getUlx()
getUlyback to summary
public final double getUly()
getUrxback to summary
public final double getUrx()
getUryback to summary
public final double getUry()
inputPropertyback to summary
public final ObjectProperty<Effect> inputProperty()
llxPropertyback to summary
public final DoubleProperty llxProperty()
llyPropertyback to summary
public final DoubleProperty llyProperty()
lrxPropertyback to summary
public final DoubleProperty lrxProperty()
lryPropertyback to summary
public final DoubleProperty lryProperty()
setInputback to summary
public final void setInput(Effect value)
setLlxback to summary
public final void setLlx(double value)
setLlyback to summary
public final void setLly(double value)
setLrxback to summary
public final void setLrx(double value)
setLryback to summary
public final void setLry(double value)
setUlxback to summary
public final void setUlx(double value)
setUlyback to summary
public final void setUly(double value)
setupDevCoordsback to summary
private void setupDevCoords(BaseTransform transform)
setUrxback to summary
public final void setUrx(double value)
setUryback to summary
public final void setUry(double value)
ulxPropertyback to summary
public final DoubleProperty ulxProperty()
ulyPropertyback to summary
public final DoubleProperty ulyProperty()
updateback to summary
pack-priv void update()

Implements abstract javafx.scene.effect.Effect.update.

Annotations
@Override
updateXformback to summary
private void updateXform()
urxPropertyback to summary
public final DoubleProperty urxProperty()
uryPropertyback to summary
public final DoubleProperty uryProperty()