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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With