java - JavaFX: multiple snapshots in single image -
i learned use snapshot
make image
object out of node. having multiple group
s hold various strokes, i'm trying create single image strokes both groups. purpose i'm using following code:
group strokes1; group strokes2; writeableimage im = null; snapshotparameters params = new snapshotparameters(); params.setfill(color.transparent); params.setviewport(new rectangle2d(0, 0, 400, 400)); im = strokes1.snapshot(params, im); im = strokes2.snapshot(params, im);
the documentation snapshot
function says
"if image non-null, node rendered existing image."
however, resulting image im
contains strokes strokes2
. doing wrong?
one way achieve goal use setcomposite() method on graphics2d of bufferedimage converted, solution discussed briefly here , here.
this gist provide runnable complete example of approach.
Comments
Post a Comment