Zooming multiple images at once javafx

Viewed 142

Language: Java FX

Objective is to have zoom functionality working(both digital and tile zoom). By tile zoom , i mean loading next set of images corresponding to the area which is getting zoomed.

Please help::: Experience in Java FX is very limited, hence finding it very difficult to proceed

1. I have one implementation for zooming which is nothing but by setting the viewport for the image view.

Lets call this digital zoom

imageView.setViewport(new Rectangle2D(x, y, width, height));

2. Another implementation for zooming is upon the zoom request , next set of images will be loaded which is actually represents the zoomed area.

Lets call this tile zoom

for (int xNavigation = xWindowStart; xNavigation <= xWindowEnd; xNavigation++) {
                for (int yNavigation = yWindowStart; yNavigation <= yWindowEnd; yNavigation++) {
                    count++;
                    try {
                        image1 = new Image(new FileInputStream(
                                Constants.PATH_TILL_FOLDER + tileZoom + "/" + xNavigation + "_" + yNavigation + Constants.FILE_EXTESNION
                        ));
                        ImageView imageView1 = new ImageView();
//                        System.out.println("Zoom levels::::" + tileZoom);
                        imageView1.setX(xval);
                        imageView1.setY(yval);

                        imageView1.setFitHeight(image1.getHeight() * digitalZoomLevel);
                        imageView1.setFitWidth(image1.getWidth() * digitalZoomLevel);
                        imageView1.setPreserveRatio(true);
                        imageView1.setImage(image1);

                        root.getChildren().add(imageView1);
                        //System.out.println("X"+imageView1.getX());
                        //System.out.println("Y"+imageView1.getY());

                        yval = yval + image1.getHeight() ;

//                        System.out.println("Going to paint image :" + xNavigation + "-" + yNavigation);

                    } catch (FileNotFoundException ex) {
                        Logger.getLogger(DataZoom.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
                yval = 0;
                xval = xval + image1.getWidth();

            }
            System.out.println("Number of images painted tile" + count);
            System.out.println("Tile Zoom");

My Problem is first solution is developed to support 1 image only. How will i handle the digital zoom for multiple images ???.

Why zooming multiple images ?. Eg: picture of monalisa by a set of images.

1 Answers
Related