java - JavaFX: multiple snapshots in single image -


i learned use snapshot make image object out of node. having multiple groups 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.

app snapshot

image snapshot


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -