本文整理汇总了Java中javafx.scene.image.ImageView.setManaged方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setManaged方法的具体用法?Java ImageView.setManaged怎么用?Java ImageView.setManaged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.setManaged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: snapshotNode
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void snapshotNode(Scene scene, Node node) {
SnapshotParameters params = new SnapshotParameters();
Bounds layoutBounds = node.getLayoutBounds();
Bounds bounds = node.localToScene(layoutBounds);
if (!(bounds.getWidth() > 0 && bounds.getHeight() > 0)) {
return;
}
params.setViewport(new Rectangle2D(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()));
WritableImage writable = new WritableImage((int) bounds.getWidth(), (int) bounds.getHeight());
writable = scene.getRoot().snapshot(params, writable);
ImageView imageView = new ImageView(writable);
imageView.getStyleClass().add("snapshot-image");
imageView.setManaged(false);
imageView.setLayoutX(bounds.getMinX());
imageView.setLayoutY(bounds.getMinY());
imageView.setFitWidth(bounds.getWidth());
imageView.setFitHeight(bounds.getHeight());
Region rect = new Region();
rect.getStyleClass().add("snapshot-background");
rect.setLayoutX(bounds.getMinX() - 5);
rect.setLayoutY(bounds.getMinY() - 5);
rect.resize(bounds.getWidth() + 10, bounds.getHeight() + 10);
rect.setManaged(false);
Line line = new Line();
line.setStartX(bounds.getMaxX() + 4);
line.setStartY(bounds.getMaxY() + 4);
line.setEndX(bounds.getMaxX() + 200);
line.setEndY(bounds.getMaxY() + 200);
line.setStroke(imagePattern);
line.setStrokeWidth(5);
line.setManaged(false);
getChildren().addAll(rect, imageView); //, line);
}