Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 如何将平面图像或缓冲图像(JAI)转换为图像(JavaFX)_Image Processing_Javafx_Jai - Fatal编程技术网

Image processing 如何将平面图像或缓冲图像(JAI)转换为图像(JavaFX)

Image processing 如何将平面图像或缓冲图像(JAI)转换为图像(JavaFX),image-processing,javafx,jai,Image Processing,Javafx,Jai,在使用JAI操作后,我试图更改ImageView实例中表示的图像。JAI可以输出平面图像、渲染图像(非awt)或缓冲图像(非awt),但这些类型对于ImageView构造无效 import java.awt.image.renderable.ParameterBlock; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; impor

在使用JAI操作后,我试图更改ImageView实例中表示的图像。JAI可以输出平面图像、渲染图像(非awt)或缓冲图像(非awt),但这些类型对于ImageView构造无效

import java.awt.image.renderable.ParameterBlock;
import javafx.application.Application; 
import javafx.scene.Scene; 
import javafx.scene.control.ScrollPane;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.stage.Stage; 
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.media.jai.Interpolation;

public class A11 extends Application{

  int zoom = 100;
  ImageView img = new ImageView();
  Image src = new Image("file.bmp");

  public static void main(String args[]){
    launch(args); // start application
  }

  @Override 
  public void start(Stage window){
    ParameterBlock pb = new ParameterBlock();
    pb.addSource(src); // source Image
    pb.add(zoom/100); // xScale
    pb.add(zoom/100); // yScale
    pb.add(0.0F); // xTranslate
    pb.add(0.0F); // yTranslate
    pb.add(Interpolation.getInstance(Interpolation.INTERP_BICUBIC));
    PlanarImage dest = JAI.create("scale", pb, null);

    // NEED TO CONVERT 'dest' TO 'destImage' HERE

    ImageView frame = new ImageView(destImage);
    ScrollPane pane = new ScrollPane(frame);
    window.setScene(new Scene(pane,800,600));
    window.show(); 
  }
}

您是否经常使用
buffereImage
不仅仅是
awt
类?似乎没有在api中列出该名称的类型,例如
PlanarImage.getAsBufferedImage
返回
java.awt.image.BufferedImage
。在这种情况下,您可以简单地使用
SwingFXUtils
。(但确实创建了3个对象。)啊哈!我相信你是对的,先生