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

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

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

ImageView.setCache介绍

暂无

代码示例

代码示例来源: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: com.bitplan.radolan/com.bitplan.radolan

/**
 * init the Image
 */
public void initImage() {
 // simple displays ImageView the image as is
 imageView = new ImageView();
 imageView.setImage(getImage());
 imageView.setSmooth(true);
 imageView.setCache(true);
}

代码示例来源: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: stackoverflow.com

// resizes the image to have width and height of 100 while preserving the ratio and using
 // higher quality filtering method; this ImageView is also cached to 
// improve performance

ImageView iv2 =newImageView();     iv2.setImage(image);
iv2.setFitHeight(100);  iv2.setFitWidth(100);  iv2.setPreserveRatio(true); iv2.setSmooth(true); iv2.setCache(true);

代码示例来源: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

imgView.setPreserveRatio(true);
imgView.setSmooth(true);
imgView.setCache(true);
setGraphic(imgView);

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

imageView.setCache(true);
imageView.setCacheHint(CacheHint.SPEED);

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

);
imageView.setCache(true);
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));
  }
}

相关文章