本文整理匯總了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);
}