Displaying pixel-perfect images without blur when zooming

Nico Krebs | www.mensch-und-maschine.de nicokrebs.dev at googlemail.com
Tue Aug 26 17:00:29 UTC 2014


Hi there,

i want to display multiple images (layers) inside a scene and want to be
able to zoom without having "blurry" images as you can see in the images
in the attachment (on the left you can see very big scaled pixels as i
need it and on the right is the "blurry" JavaFX-Result on which i cannot
identify single pixels.

i used the zoom pane example from
https://stackoverflow.com/questions/16680295/javafx-correct-scaling

this is how i initialize my scene:

        ArrayList<ImageView> listOfImageViews = getImageViews();
//imageviews are created from bufferedimages with:
SwingFXUtils.toFXImage(image, null)
        final Group layerGroup = new Group(listOfImageViews);
        this.stackPane = new StackPane();
        stackPane.getChildren().add(layerGroup);
        scene = new Scene(stackPane);
        this.stackPane.getChildren().add(this.scrollPane);
       
this.stackPane.getChildren().add(scrollPane.createZoomPane(listOfImageViews
));
        this.setScene(scene);

and this is how zooming is done:

        ...//calculate scalefactor from scrolling
        ...
        layerGroup .setScaleX(layerGroup .getScaleX() * scaleFactor);
        layerGroup .setScaleY(layerGroup .getScaleY() * scaleFactor);
        ...

when i zoom in so that i theoreticallly could see single pixels, all i
see is a blurry area. (see examples)
i know already that that`s JavaFX default behaviour and even if i set
setSmooth(false), the antialiasing or precision errors or whatever is
causing this, persists.

is there perhaps another way? i am even willing to write my own
implementation of Imageview if it would help.

Can anybody please help me out?

if you need more details, please ask :)

thanks in advance and greetz,
Nico



More information about the openjfx-dev mailing list