Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javafx.scene.image.Image;
import javafx.scene.image.WritableImage;

public class Main {
    /**
     * Returns writable image object that can then be played during gameplay.
     * @param image         the image object
     * @param x            x-coordinate
     * @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);
    }
}