Is it possible to get ARGB pixel data from a javafx.scene.canvas.Canvas
? I am aware that javafx.scene.image.Image
provides a PixelReader
for performing this operation but I would like to get this data directly from the canvas if possible.
Asked
Active
Viewed 3,325 times
15

Troy Squillaci
- 415
- 3
- 9
1 Answers
9
I believe I've found a solution. Since Canvas
extends Node
, it inherits the Node.snapshot()
method which saves the current state of the canvas to a WritableImage
. Since WritableImage
extends Image
, I can get the PixelReader
from the WritableImage
and read the pixel data. This may not be the most optimal solution, but it works for my application.

Troy Squillaci
- 415
- 3
- 9