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:
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() |
double |
getLlx() |
double |
getLly() |
double |
getLrx() |
double |
getLry() |
double |
getUlx() |
double |
getUly() |
double |
getUrx() |
double |
getUry() |
Effect |
impl_copy()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
BaseBounds |
impl_getBounds(BaseBounds bounds,
BaseTransform tx,
Node node,
BoundsAccessor boundsAccessor)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
ObjectProperty<Effect> |
inputProperty() |
DoubleProperty |
llxProperty() |
DoubleProperty |
llyProperty() |
DoubleProperty |
lrxProperty() |
DoubleProperty |
lryProperty() |
void |
setInput(Effect value) |
void |
setLlx(double value) |
void |
setLly(double value) |
void |
setLrx(double value) |
void |
setLry(double value) |
void |
setUlx(double value) |
void |
setUly(double value) |
void |
setUrx(double value) |
void |
setUry(double value) |
DoubleProperty |
ulxProperty() |
DoubleProperty |
ulyProperty() |
DoubleProperty |
urxProperty() |
DoubleProperty |
uryProperty() |
impl_effectDirtyProperty, impl_getImpl, impl_isEffectDirty, impl_sync
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)
public final Effect getInput()
public final ObjectProperty<Effect> inputProperty()
public final void setUlx(double value)
public final double getUlx()
public final DoubleProperty ulxProperty()
public final void setUly(double value)
public final double getUly()
public final DoubleProperty ulyProperty()
public final void setUrx(double value)
public final double getUrx()
public final DoubleProperty urxProperty()
public final void setUry(double value)
public final double getUry()
public final DoubleProperty uryProperty()
public final void setLrx(double value)
public final double getLrx()
public final DoubleProperty lrxProperty()
public final void setLry(double value)
public final double getLry()
public final DoubleProperty lryProperty()
public final void setLlx(double value)
public final double getLlx()
public final DoubleProperty llxProperty()
public final void setLly(double value)
public final double getLly()
public final DoubleProperty llyProperty()
@Deprecated public BaseBounds impl_getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)
Effect
impl_getBounds
in class Effect
@Deprecated public Effect impl_copy()
Copyright © 2020. All rights reserved.