@Override public void handle(ActionEvent event) { new Thread(task).start(); } }); }
public static void main(String[] args) { launch(args); }
private void prepareMyWritableImage(){
myWritableImage = new WritableImage(IMG_WIDTH, IMG_HEIGHT); myPixelWriter = myWritableImage.getPixelWriter();
//fill with background blue for(int x = 0; x < IMG_WIDTH; x++){ for(int y = 0; y < IMG_HEIGHT; y++){ myPixelWriter.setColor(x, y, Color.GRAY); } } }
private void drawSomethingOnMyWritableImage(){
int x = (int)(Math.random() * IMG_WIDTH); int y = (int)(Math.random() * IMG_HEIGHT); double r = Math.random(); double g = Math.random(); double b = Math.random();
myPixelWriter.setColor(x, y, new Color(r, g, b, 1.0)); } }
No comments:
Post a Comment