This discussion is archived
2 Replies Latest reply: Jan 7, 2013 4:43 AM by 898076 RSS

SnapshotParameters obligatory fill

898076 Newbie
Currently Being Moderated
SnapshotParameters.setFill(null) fills the target image, before drawing into it, with white. Is there any way of retaining the original image?

The following:
Group g = new Group();
g.setBlendMode(BlendMode.SRC_OVER);
g.getChildren().add(new ImageView(base));
g.getChildren().add(new ImageView(overlay));
g.snapshot(params, null);
is very slow.
  • 1. Re: SnapshotParameters obligatory fill
    twasyl Newbie
    Currently Being Moderated
    Hi,

    What I usually do to get the "original" snapshot is by setting the transparent color for the fill:
    SnapshotParameters params = new SnapshotParameters();
    params.setFill(Color.TRANSPARENT);
    
    WritableImage wImg = new WritableImage(width, height);
    wImg = g.snapshot(params, wImg);
    I also never pass null as parameters for the snapshot method because it will "fill" the given one.
  • 2. Re: SnapshotParameters obligatory fill
    898076 Newbie
    Currently Being Moderated
    I tried params.setFill(Color.TRANSPARENT), and the snaphot has indeed transparent background in such a case, but the underlying image is still lost. If the original image was visible in your case, then perhaps it is an inconsistency between platforms? I use Linux, Java 1.7.0_05. If you'd describe your platform, I could post a bug report.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points