本文整理汇总了Java中javafx.scene.effect.PerspectiveTransform类的典型用法代码示例。如果您正苦于以下问题:Java PerspectiveTransform类的具体用法?Java PerspectiveTransform怎么用?Java PerspectiveTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PerspectiveTransform类属于javafx.scene.effect包,在下文中一共展示了PerspectiveTransform类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIconContent
import javafx.scene.effect.PerspectiveTransform; //导入依赖的package包/类
public static Node createIconContent() {
javafx.scene.Group g = new javafx.scene.Group(
createKey("A", 0d, 28d),
createKey("S", 25d, 28d),
createKey("D", 50d, 28d),
createKey("W", 20d, 0d)
);
g.setLayoutX(30);
g.setLayoutY(20);
PerspectiveTransform pt = new PerspectiveTransform();
pt.setLlx(0);
pt.setLly(90);
pt.setLrx(90);
pt.setLry(90);
pt.setUlx(15);
pt.setUly(10);
pt.setUrx(80);
pt.setUry(5);
g.setEffect(pt);
return g;
}
示例2: computeEnd
import javafx.scene.effect.PerspectiveTransform; //导入依赖的package包/类
static PerspectiveTransform computeEnd(ObservableValue<? extends Number> x, ObservableValue<? extends Number> y, ObservableValue<? extends Number> width, ObservableValue<? extends Number> height, ObservableValue<Pos> noEffectPos) {
double ratioX = x.getValue().doubleValue() / width.getValue().doubleValue() * 3;
double ratioY = y.getValue().doubleValue() / height.getValue().doubleValue() * 3;
ObjectBinding<Perspective> perspective = Bindings.createObjectBinding(() -> new Perspective(ratioX, ratioY, width.getValue().doubleValue(), height.getValue().doubleValue(), noEffectPos.getValue()), width, height, noEffectPos);
PerspectiveTransform effect = new PerspectiveTransform();
effect.ulxProperty().bind(createPerspectivePropertyBinding(p -> p.ulx, perspective));
effect.ulyProperty().bind(createPerspectivePropertyBinding(p -> p.uly, perspective));
effect.urxProperty().bind(createPerspectivePropertyBinding(p -> p.urx, perspective));
effect.uryProperty().bind(createPerspectivePropertyBinding(p -> p.ury, perspective));
effect.lrxProperty().bind(createPerspectivePropertyBinding(p -> p.lrx, perspective));
effect.lryProperty().bind(createPerspectivePropertyBinding(p -> p.lry, perspective));
effect.llxProperty().bind(createPerspectivePropertyBinding(p -> p.llx, perspective));
effect.llyProperty().bind(createPerspectivePropertyBinding(p -> p.lly, perspective));
return effect;
}
示例3: drawImage
import javafx.scene.effect.PerspectiveTransform; //导入依赖的package包/类
/** Draws the current image.
* @param topLeft where the top-left corner of the current image should be rendered
* @param topRight where the top-right corner of the current image should be rendered
* @param bottomRight where the bottom-right corner of the current image should be rendered
* @param bottomLeft where the bottom-left corner of the current image should be rendered
*/
public void drawImage(Point2D topLeft, Point2D topRight, Point2D bottomRight, Point2D bottomLeft) {
ensureRealized();
PerspectiveTransform t = new PerspectiveTransform();
t.setUlx(topLeft.getX());
t.setUly(topLeft.getY());
t.setUrx(topRight.getX());
t.setUry(topRight.getY());
t.setLrx(bottomRight.getX());
t.setLry(bottomRight.getY());
t.setLlx(bottomLeft.getX());
t.setLly(bottomLeft.getY());
context.setEffect(t);
context.drawImage(currentImage, 0, 0);
if (autoFlush) {
flush();
}
}
示例4: initShadowOverlay
import javafx.scene.effect.PerspectiveTransform; //导入依赖的package包/类
private void initShadowOverlay() {
transformLeft = new PerspectiveTransform();
transformRight = new PerspectiveTransform();
leftImage = new ImageView();
leftImage.setFitWidth(PREF_PANE_WIDTH);
leftImage.setFitHeight(SIZE.getHeight());
leftImage.setEffect(transformLeft);
leftImage.setMouseTransparent(true);
rightImage = new ImageView();
rightImage.setFitWidth(PREF_PANE_WIDTH);
rightImage.setFitHeight(SIZE.getHeight());
rightImage.setEffect(transformRight);
rightImage.setMouseTransparent(true);
shadowRect = new Rectangle(SIZE.getWidth() * 0.45, SIZE.getHeight());
shadowRect.setFill(Color.BLACK);
shadowRect.setOpacity(SHADOW_OPACITY);
shadowRect.setEffect(transformRight);
shadowOverlay = new Pane();
shadowOverlay.setPrefSize(0, SIZE.getHeight());
shadowOverlay.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
shadowOverlay.getChildren().addAll(leftImage, rightImage, shadowRect);
}
示例5: getNamedEffectList
import javafx.scene.effect.PerspectiveTransform; //导入依赖的package包/类
List<NamedEffect> getNamedEffectList() {
List<NamedEffect> nes = new ArrayList<NamedEffect>();
PerspectiveTransform pt = new PerspectiveTransform();
pt.setUlx(10);
pt.setUly(10);
pt.setUrx(150);
pt.setUry(50);
pt.setLrx(150);
pt.setLry(100);
pt.setLlx(10);
pt.setLly(70);
nes.add(new NamedEffect("perspective", pt));
return nes;
}
示例6: showEffect
import javafx.scene.effect.PerspectiveTransform; //导入依赖的package包/类
private void showEffect() {
if (showTileEffectProperty.get()) {
ObservableValue<Double> xConstant = FxConstants.object(mouseX.get());
ObservableValue<Double> yConstant = FxConstants.object(mouseY.get());
PerspectiveTransform transform = TilePerspectiveUtils.computeEnd(xConstant, yConstant, widthProperty(), heightProperty(), noEffectPosProperty);
setEffect(transform);
}
}