What is the best way to read pixels of a JavaFX Canvas?

Viewed 3752

I want to get the color for specific coordinates inside a Canvas. I already tried getting a snapshot using this code:

WritableImage snap = gc.getCanvas().snapshot(null, null);
snap.getPixelReader().getArgb(x, y); //This just gets the color without assigning it.

But it just takes too much time for my application. I was wondering if there is any other way to access the color of a pixel for which I know the coordinates.

2 Answers
Related