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:
| Modifier and Type | Field and Description |
|---|---|
| private float[] | |
| private ObjectProperty | input
The input for this |
| 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. |
| Access | Constructor and Description |
|---|---|
| public | |
| 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. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv Effect | |
| pack-priv PerspectiveTransform | |
| pack-priv BaseBounds | getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)
Implements abstract javafx. 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 | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| private void | |
| public final void | |
| public final void | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| pack-priv void | |
| private void | |
| public final DoubleProperty | |
| public final DoubleProperty |
| devcoords | back to summary |
|---|---|
| private float[] devcoords | |
| input | back to summary |
|---|---|
| private ObjectProperty<Effect> input The input for this
| |
| llx | back to summary |
|---|---|
| private DoubleProperty llx The x coordinate of the output location onto which the lower left corner of the source is mapped.
| |
| lly | back to summary |
|---|---|
| private DoubleProperty lly The y coordinate of the output location onto which the lower left corner of the source is mapped.
| |
| lrx | back to summary |
|---|---|
| private DoubleProperty lrx The x coordinate of the output location onto which the lower right corner of the source is mapped.
| |
| lry | back to summary |
|---|---|
| private DoubleProperty lry The y coordinate of the output location onto which the lower right corner of the source is mapped.
| |
| ulx | back to summary |
|---|---|
| private DoubleProperty ulx The x coordinate of the output location onto which the upper left corner of the source is mapped.
| |
| uly | back to summary |
|---|---|
| private DoubleProperty uly The y coordinate of the output location onto which the upper left corner of the source is mapped.
| |
| urx | back to summary |
|---|---|
| private DoubleProperty urx The x coordinate of the output location onto which the upper right corner of the source is mapped.
| |
| ury | back to summary |
|---|---|
| private DoubleProperty ury The y coordinate of the output location onto which the upper right corner of the source is mapped.
| |
| PerspectiveTransform | back to summary |
|---|---|
| public PerspectiveTransform() Creates a new instance of PerspectiveTransform with default parameters. | |
| PerspectiveTransform | back 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.
| |
| checkChainContains | back to summary |
|---|---|
| pack-priv boolean checkChainContains(Effect e) Implements abstract javafx.
| |
| copy | back to summary |
|---|---|
| pack-priv Effect copy() Implements abstract javafx.
| |
| createPeer | back to summary |
|---|---|
| pack-priv PerspectiveTransform createPeer() Implements abstract javafx.
| |
| getBounds | back to summary |
|---|---|
| pack-priv BaseBounds getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor) Implements abstract javafx. Doc from javafx. 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.
| |
| getInput | back to summary |
|---|---|
| public final Effect getInput() | |
| getLlx | back to summary |
|---|---|
| public final double getLlx() | |
| getLly | back to summary |
|---|---|
| public final double getLly() | |
| getLrx | back to summary |
|---|---|
| public final double getLrx() | |
| getLry | back to summary |
|---|---|
| public final double getLry() | |
| getUlx | back to summary |
|---|---|
| public final double getUlx() | |
| getUly | back to summary |
|---|---|
| public final double getUly() | |
| getUrx | back to summary |
|---|---|
| public final double getUrx() | |
| getUry | back to summary |
|---|---|
| public final double getUry() | |
| inputProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| llxProperty | back to summary |
|---|---|
| public final DoubleProperty llxProperty() | |
| llyProperty | back to summary |
|---|---|
| public final DoubleProperty llyProperty() | |
| lrxProperty | back to summary |
|---|---|
| public final DoubleProperty lrxProperty() | |
| lryProperty | back to summary |
|---|---|
| public final DoubleProperty lryProperty() | |
| setInput | back to summary |
|---|---|
| public final void setInput(Effect value) | |
| setLlx | back to summary |
|---|---|
| public final void setLlx(double value) | |
| setLly | back to summary |
|---|---|
| public final void setLly(double value) | |
| setLrx | back to summary |
|---|---|
| public final void setLrx(double value) | |
| setLry | back to summary |
|---|---|
| public final void setLry(double value) | |
| setUlx | back to summary |
|---|---|
| public final void setUlx(double value) | |
| setUly | back to summary |
|---|---|
| public final void setUly(double value) | |
| setupDevCoords | back to summary |
|---|---|
| private void setupDevCoords(BaseTransform transform) | |
| setUrx | back to summary |
|---|---|
| public final void setUrx(double value) | |
| setUry | back to summary |
|---|---|
| public final void setUry(double value) | |
| ulxProperty | back to summary |
|---|---|
| public final DoubleProperty ulxProperty() | |
| ulyProperty | back to summary |
|---|---|
| public final DoubleProperty ulyProperty() | |
| update | back to summary |
|---|---|
| pack-priv void update() Implements abstract javafx.
| |
| updateXform | back to summary |
|---|---|
| private void updateXform() | |
| urxProperty | back to summary |
|---|---|
| public final DoubleProperty urxProperty() | |
| uryProperty | back to summary |
|---|---|
| public final DoubleProperty uryProperty() | |