Example usage for javafx.scene.image WritableImage WritableImage

List of usage examples for javafx.scene.image WritableImage WritableImage

Introduction

In this page you can find the example usage for javafx.scene.image WritableImage WritableImage.

Prototype

public WritableImage(@NamedArg("reader") PixelReader reader, @NamedArg("x") int x, @NamedArg("y") int y,
        @NamedArg("width") int width, @NamedArg("height") int height) 

Source Link

Document

Construct an image of the specified dimensions, initialized from the indicated region of the PixelReader .

Usage

From source file:Main.java

/**
 * Returns writable image object that can then be played during gameplay.
 * @param image         the image object
 * @param x            x-coordinate//from  w  w w  . ja v a2  s .c  o  m
 * @param y            y-coordinate
 * @param width         Width of the window
 * @param height      Height of the window
 * @return            Sub image of the image object         
 */
public static WritableImage getSubImage(Image image, int x, int y, int width, int height) {
    return new WritableImage(image.getPixelReader(), x, y, width, height);
}