public class PerspectiveTransform extends Effect
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:
Type | Property and Description |
---|---|
ObjectProperty<Effect> |
input
The input for this
Effect . |
DoubleProperty |
llx
The x coordinate of the output location onto which the lower left
corner of the source is mapped.
|
DoubleProperty |
lly
The y coordinate of the output location onto which the lower left
corner of the source is mapped.
|
DoubleProperty |
lrx
The x coordinate of the output location onto which the lower right
corner of the source is mapped.
|
DoubleProperty |
lry
The y coordinate of the output location onto which the lower right
corner of the source is mapped.
|
DoubleProperty |
ulx
The x coordinate of the output location onto which the upper left
corner of the source is mapped.
|
DoubleProperty |
uly
The y coordinate of the output location onto which the upper left
corner of the source is mapped.
|
DoubleProperty |
urx
The x coordinate of the output location onto which the upper right
corner of the source is mapped.
|
DoubleProperty |
ury
The y coordinate of the output location onto which the upper right
corner of the source is mapped.
|
Constructor and Description |
---|
PerspectiveTransform()
Creates 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.
|
Modifier and Type | Method and Description |
---|---|
Effect |
getInput()
Gets the value of the property input.
|
double |
getLlx()
Gets the value of the property llx.
|
double |
getLly()
Gets the value of the property lly.
|
double |
getLrx()
Gets the value of the property lrx.
|
double |
getLry()
Gets the value of the property lry.
|
double |
getUlx()
Gets the value of the property ulx.
|
double |
getUly()
Gets the value of the property uly.
|
double |
getUrx()
Gets the value of the property urx.
|
double |
getUry()
Gets the value of the property ury.
|
ObjectProperty<Effect> |
inputProperty()
The input for this
Effect . |
DoubleProperty |
llxProperty()
The x coordinate of the output location onto which the lower left
corner of the source is mapped.
|
DoubleProperty |
llyProperty()
The y coordinate of the output location onto which the lower left
corner of the source is mapped.
|
DoubleProperty |
lrxProperty()
The x coordinate of the output location onto which the lower right
corner of the source is mapped.
|
DoubleProperty |
lryProperty()
The y coordinate of the output location onto which the lower right
corner of the source is mapped.
|
void |
setInput(Effect value)
Sets the value of the property input.
|
void |
setLlx(double value)
Sets the value of the property llx.
|
void |
setLly(double value)
Sets the value of the property lly.
|
void |
setLrx(double value)
Sets the value of the property lrx.
|
void |
setLry(double value)
Sets the value of the property lry.
|
void |
setUlx(double value)
Sets the value of the property ulx.
|
void |
setUly(double value)
Sets the value of the property uly.
|
void |
setUrx(double value)
Sets the value of the property urx.
|
void |
setUry(double value)
Sets the value of the property ury.
|
DoubleProperty |
ulxProperty()
The x coordinate of the output location onto which the upper left
corner of the source is mapped.
|
DoubleProperty |
ulyProperty()
The y coordinate of the output location onto which the upper left
corner of the source is mapped.
|
DoubleProperty |
urxProperty()
The x coordinate of the output location onto which the upper right
corner of the source is mapped.
|
DoubleProperty |
uryProperty()
The y coordinate of the output location onto which the upper right
corner of the source is mapped.
|
public final ObjectProperty<Effect> inputProperty
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.getInput()
,
setInput(Effect)
public final DoubleProperty ulxProperty
getUlx()
,
setUlx(double)
public final DoubleProperty ulyProperty
getUly()
,
setUly(double)
public final DoubleProperty urxProperty
getUrx()
,
setUrx(double)
public final DoubleProperty uryProperty
getUry()
,
setUry(double)
public final DoubleProperty lrxProperty
getLrx()
,
setLrx(double)
public final DoubleProperty lryProperty
getLry()
,
setLry(double)
public final DoubleProperty llxProperty
getLlx()
,
setLlx(double)
public final DoubleProperty llyProperty
getLly()
,
setLly(double)
public PerspectiveTransform()
public PerspectiveTransform(double ulx, double uly, double urx, double ury, double lrx, double lry, double llx, double lly)
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 cornerpublic final void setInput(Effect value)
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.public final Effect getInput()
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.public final ObjectProperty<Effect> inputProperty()
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.getInput()
,
setInput(Effect)
public final void setUlx(double value)
public final double getUlx()
public final DoubleProperty ulxProperty()
getUlx()
,
setUlx(double)
public final void setUly(double value)
public final double getUly()
public final DoubleProperty ulyProperty()
getUly()
,
setUly(double)
public final void setUrx(double value)
public final double getUrx()
public final DoubleProperty urxProperty()
getUrx()
,
setUrx(double)
public final void setUry(double value)
public final double getUry()
public final DoubleProperty uryProperty()
getUry()
,
setUry(double)
public final void setLrx(double value)
public final double getLrx()
public final DoubleProperty lrxProperty()
getLrx()
,
setLrx(double)
public final void setLry(double value)
public final double getLry()
public final DoubleProperty lryProperty()
getLry()
,
setLry(double)
public final void setLlx(double value)
public final double getLlx()
public final DoubleProperty llxProperty()
getLlx()
,
setLlx(double)
public final void setLly(double value)
public final double getLly()
public final DoubleProperty llyProperty()
getLly()
,
setLly(double)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.