本文整理汇总了Java中javafx.scene.Group.setBlendMode方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setBlendMode方法的具体用法?Java Group.setBlendMode怎么用?Java Group.setBlendMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Group
的用法示例。
在下文中一共展示了Group.setBlendMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mkRoot
import javafx.scene.Group; //导入方法依赖的package包/类
@Override
public Node mkRoot() {
Image image = new Image(LenaSample.LENA);
GesturePane gesturePane = new GesturePane(new ImageView(image));
gesturePane.setMaxSize(image.getWidth(), image.getHeight());
ImageView background = new ImageView(LenaSample.LENA);
background.setFitWidth(image.getWidth());
background.setFitHeight(image.getHeight());
Rectangle shade = new Rectangle(image.getWidth(),
image.getHeight(),
Color.grayRgb(0, 0.5));
Rectangle viewRect = new Rectangle();
viewRect.setStroke(Color.WHITE);
viewRect.setStrokeWidth(2);
viewRect.setFill(Color.WHITE);
// shade * rect
Group group = new Group(shade, viewRect);
group.setBlendMode(BlendMode.MULTIPLY);
Pane viewportSim = new Pane(background, group);
viewportSim.maxWidthProperty().bind(background.fitWidthProperty());
viewportSim.maxHeightProperty().bind(background.fitHeightProperty());
gesturePane.targetViewportProperty().addListener((o, p, n) -> {
viewRect.setTranslateX(n.getMinX());
viewRect.setTranslateY(n.getMinY());
viewRect.setWidth(n.getWidth());
viewRect.setHeight(n.getHeight());
});
HBox box = new HBox(gesturePane, viewportSim);
box.setAlignment(Pos.CENTER);
VBox.setVgrow(box, Priority.ALWAYS);
Label description = new Label("Zoom and scroll on the left image(wrapped in a GesturePane)" +
"; the right image will reflect the actual viewport " +
"of the current transformation");
description.setWrapText(true);
description.setPadding(new Insets(16));
return new VBox(description, box);
}