get Sub JavaFX Image - Java JavaFX

Java examples for JavaFX:Image

Description

get Sub JavaFX Image

Demo Code


//package com.java2s;

import javafx.scene.image.Image;
import javafx.scene.image.PixelReader;

import javafx.scene.image.WritableImage;

public class Main {
    public static Image getSubImage(Image img, int x, int y, int w, int h) {
        PixelReader reader = img.getPixelReader();
        WritableImage image = new WritableImage(reader, x, y, w, h);
        return image;
    }/*from w  w  w.ja va2s  .c  om*/
}

Related Tutorials