javafx.scene.image.ImageView.setCacheHint()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中javafx.scene.image.ImageView.setCacheHint()方法的一些代码示例,展示了ImageView.setCacheHint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setCacheHint()方法的具体详情如下:
包路径:javafx.scene.image.ImageView
类名称:ImageView
方法名:setCacheHint

ImageView.setCacheHint介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Image tile = new Image("tile.png");

Group house = new Group();
house.setCache(true);
house.setCacheHint(CacheHint.SPEED);

Effect lighting = new Lighting();

for (int i = 0; i < houseWidth; i++) {
 // here is the critical part => don't do new ImageView(new Image("tile.png"))
 ImageView tileView = new ImageView(tile));
 tileView.setEffect(lighting);
 tileView.setCache(true);
 tileView.setCacheHint(CacheHint.SPEED);

 house.add(tileView);  
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
public void cache(Pane node) {
  if (!cache.containsKey(node)) {
    SnapshotParameters snapShotparams = new SnapshotParameters();
    snapShotparams.setFill(Color.TRANSPARENT);
    WritableImage temp = node.snapshot(snapShotparams,
      new WritableImage((int) node.getLayoutBounds().getWidth(),
        (int) node.getLayoutBounds().getHeight()));
    ImageView tempImage = new ImageView(temp);
    tempImage.setCache(true);
    tempImage.setCacheHint(CacheHint.SPEED);
    cache.put(node, new ArrayList<>(node.getChildren()));
    node.getChildren().setAll(tempImage);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void showDialog() {
  if (dialogContainer == null) {
    throw new RuntimeException("ERROR: JFXDialog container is not set!");
  }
  if (isCacheContainer()) {
    tempContent = new ArrayList<>(dialogContainer.getChildren());
    SnapshotParameters snapShotparams = new SnapshotParameters();
    snapShotparams.setFill(Color.TRANSPARENT);
    WritableImage temp = dialogContainer.snapshot(snapShotparams,
      new WritableImage((int) dialogContainer.getWidth(),
        (int) dialogContainer.getHeight()));
    ImageView tempImage = new ImageView(temp);
    tempImage.setCache(true);
    tempImage.setCacheHint(CacheHint.SPEED);
    dialogContainer.getChildren().setAll(tempImage, this);
  } else {
    //prevent error if opening an already opened dialog
    dialogContainer.getChildren().remove(this);
    tempContent = null;
    dialogContainer.getChildren().add(this);
  }
  if (animation != null) {
    animation.play();
  } else {
    setVisible(true);
    setOpacity(1);
    Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED));
  }
}

代码示例来源:origin: stackoverflow.com

imageView.setCacheHint(CacheHint.SPEED);

代码示例来源:origin: stackoverflow.com

imageView.setCacheHint(CacheHint.SPEED);

代码示例来源:origin: com.jfoenix/jfoenix

@Override
public void cache(Pane node) {
  if (!cache.containsKey(node)) {
    SnapshotParameters snapShotparams = new SnapshotParameters();
    snapShotparams.setFill(Color.TRANSPARENT);
    WritableImage temp = node.snapshot(snapShotparams,
      new WritableImage((int) node.getLayoutBounds().getWidth(),
        (int) node.getLayoutBounds().getHeight()));
    ImageView tempImage = new ImageView(temp);
    tempImage.setCache(true);
    tempImage.setCacheHint(CacheHint.SPEED);
    cache.put(node, new ArrayList<>(node.getChildren()));
    node.getChildren().setAll(tempImage);
  }
}

代码示例来源:origin: com.jfoenix/jfoenix

private void showDialog() {
  if (dialogContainer == null) {
    throw new RuntimeException("ERROR: JFXDialog container is not set!");
  }
  if (isCacheContainer()) {
    tempContent = new ArrayList<>(dialogContainer.getChildren());
    SnapshotParameters snapShotparams = new SnapshotParameters();
    snapShotparams.setFill(Color.TRANSPARENT);
    WritableImage temp = dialogContainer.snapshot(snapShotparams,
      new WritableImage((int) dialogContainer.getWidth(),
        (int) dialogContainer.getHeight()));
    ImageView tempImage = new ImageView(temp);
    tempImage.setCache(true);
    tempImage.setCacheHint(CacheHint.SPEED);
    dialogContainer.getChildren().setAll(tempImage, this);
  } else {
    tempContent = null;
    dialogContainer.getChildren().add(this);
  }
  if (animation != null) {
    animation.play();
  } else {
    setVisible(true);
    setOpacity(1);
    Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED));
  }
}

相关文章