java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.PerspectiveTransform
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:
- Since:
- JavaFX 2.0
-
Property Summary
TypePropertyDescriptionfinal ObjectProperty
<Effect> The input for thisEffect
.final DoubleProperty
The x coordinate of the output location onto which the lower left corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the lower left corner of the source is mapped.final DoubleProperty
The x coordinate of the output location onto which the lower right corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the lower right corner of the source is mapped.final DoubleProperty
The x coordinate of the output location onto which the upper left corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the upper left corner of the source is mapped.final DoubleProperty
The x coordinate of the output location onto which the upper right corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the upper right corner of the source is mapped. -
Constructor Summary
ConstructorDescriptionCreates a new instance of PerspectiveTransform with default parameters.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. -
Method Summary
Modifier and TypeMethodDescriptionfinal Effect
getInput()
Gets the value of theinput
property.final double
getLlx()
Gets the value of thellx
property.final double
getLly()
Gets the value of thelly
property.final double
getLrx()
Gets the value of thelrx
property.final double
getLry()
Gets the value of thelry
property.final double
getUlx()
Gets the value of theulx
property.final double
getUly()
Gets the value of theuly
property.final double
getUrx()
Gets the value of theurx
property.final double
getUry()
Gets the value of theury
property.final ObjectProperty
<Effect> The input for thisEffect
.final DoubleProperty
The x coordinate of the output location onto which the lower left corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the lower left corner of the source is mapped.final DoubleProperty
The x coordinate of the output location onto which the lower right corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the lower right corner of the source is mapped.final void
Sets the value of theinput
property.final void
setLlx
(double value) Sets the value of thellx
property.final void
setLly
(double value) Sets the value of thelly
property.final void
setLrx
(double value) Sets the value of thelrx
property.final void
setLry
(double value) Sets the value of thelry
property.final void
setUlx
(double value) Sets the value of theulx
property.final void
setUly
(double value) Sets the value of theuly
property.final void
setUrx
(double value) Sets the value of theurx
property.final void
setUry
(double value) Sets the value of theury
property.final DoubleProperty
The x coordinate of the output location onto which the upper left corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the upper left corner of the source is mapped.final DoubleProperty
The x coordinate of the output location onto which the upper right corner of the source is mapped.final DoubleProperty
The y coordinate of the output location onto which the upper right corner of the source is mapped.
-
Property Details
-
input
The input for thisEffect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- See Also:
-
ulx
The x coordinate of the output location onto which the upper left corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
uly
The y coordinate of the output location onto which the upper left corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
urx
The x coordinate of the output location onto which the upper right corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
ury
The y coordinate of the output location onto which the upper right corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
lrx
The x coordinate of the output location onto which the lower right corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
lry
The y coordinate of the output location onto which the lower right corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
llx
The x coordinate of the output location onto which the lower left corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
lly
The y coordinate of the output location onto which the lower left corner of the source is mapped.- Default value:
- 0.0
- See Also:
-
-
Constructor Details
-
PerspectiveTransform
public PerspectiveTransform()Creates a new instance of PerspectiveTransform with default parameters. -
PerspectiveTransform
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
- the x coordinate of upper left corneruly
- the y coordinate of upper left cornerurx
- the x coordinate of upper right cornerury
- the y coordinate of upper right cornerlrx
- the x coordinate of lower right cornerlry
- the y coordinate of lower right cornerllx
- the x coordinate of lower left cornerlly
- the y coordinate of lower left corner- Since:
- JavaFX 2.1
-
-
Method Details
-
setInput
Sets the value of theinput
property.- Property description:
- The input for this
Effect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Parameters:
value
- the value for theinput
property- See Also:
-
getInput
Gets the value of theinput
property.- Property description:
- The input for this
Effect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Returns:
- the value of the
input
property - See Also:
-
inputProperty
The input for thisEffect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- Returns:
- the
input
property - See Also:
-
setUlx
public final void setUlx(double value) Sets the value of theulx
property.- Property description:
- The x coordinate of the output location onto which the upper left corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for theulx
property- See Also:
-
getUlx
public final double getUlx()Gets the value of theulx
property.- Property description:
- The x coordinate of the output location onto which the upper left corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
ulx
property - See Also:
-
ulxProperty
The x coordinate of the output location onto which the upper left corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
ulx
property - See Also:
-
setUly
public final void setUly(double value) Sets the value of theuly
property.- Property description:
- The y coordinate of the output location onto which the upper left corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for theuly
property- See Also:
-
getUly
public final double getUly()Gets the value of theuly
property.- Property description:
- The y coordinate of the output location onto which the upper left corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
uly
property - See Also:
-
ulyProperty
The y coordinate of the output location onto which the upper left corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
uly
property - See Also:
-
setUrx
public final void setUrx(double value) Sets the value of theurx
property.- Property description:
- The x coordinate of the output location onto which the upper right corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for theurx
property- See Also:
-
getUrx
public final double getUrx()Gets the value of theurx
property.- Property description:
- The x coordinate of the output location onto which the upper right corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
urx
property - See Also:
-
urxProperty
The x coordinate of the output location onto which the upper right corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
urx
property - See Also:
-
setUry
public final void setUry(double value) Sets the value of theury
property.- Property description:
- The y coordinate of the output location onto which the upper right corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for theury
property- See Also:
-
getUry
public final double getUry()Gets the value of theury
property.- Property description:
- The y coordinate of the output location onto which the upper right corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
ury
property - See Also:
-
uryProperty
The y coordinate of the output location onto which the upper right corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
ury
property - See Also:
-
setLrx
public final void setLrx(double value) Sets the value of thelrx
property.- Property description:
- The x coordinate of the output location onto which the lower right corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for thelrx
property- See Also:
-
getLrx
public final double getLrx()Gets the value of thelrx
property.- Property description:
- The x coordinate of the output location onto which the lower right corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
lrx
property - See Also:
-
lrxProperty
The x coordinate of the output location onto which the lower right corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
lrx
property - See Also:
-
setLry
public final void setLry(double value) Sets the value of thelry
property.- Property description:
- The y coordinate of the output location onto which the lower right corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for thelry
property- See Also:
-
getLry
public final double getLry()Gets the value of thelry
property.- Property description:
- The y coordinate of the output location onto which the lower right corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
lry
property - See Also:
-
lryProperty
The y coordinate of the output location onto which the lower right corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
lry
property - See Also:
-
setLlx
public final void setLlx(double value) Sets the value of thellx
property.- Property description:
- The x coordinate of the output location onto which the lower left corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for thellx
property- See Also:
-
getLlx
public final double getLlx()Gets the value of thellx
property.- Property description:
- The x coordinate of the output location onto which the lower left corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
llx
property - See Also:
-
llxProperty
The x coordinate of the output location onto which the lower left corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
llx
property - See Also:
-
setLly
public final void setLly(double value) Sets the value of thelly
property.- Property description:
- The y coordinate of the output location onto which the lower left corner of the source is mapped.
- Default value:
- 0.0
- Parameters:
value
- the value for thelly
property- See Also:
-
getLly
public final double getLly()Gets the value of thelly
property.- Property description:
- The y coordinate of the output location onto which the lower left corner of the source is mapped.
- Default value:
- 0.0
- Returns:
- the value of the
lly
property - See Also:
-
llyProperty
The y coordinate of the output location onto which the lower left corner of the source is mapped.- Default value:
- 0.0
- Returns:
- the
lly
property - See Also:
-