I use the following code to generate an image of a node and add it with an ImageView to my Scene:
SnapshotParameters snapParams = new SnapshotParameters();
snapParams.setFill(Color.TRANSPARENT);
this.dragImage = new ImageView(draggable.snapshot(snapParams, null));
...
frontPane.getChildren().add(this.dragImage);
Bounds localBounds = frontPane.sceneToLocal(draggable
.localToScene(draggable.getBoundsInLocal()));
this.dragImage.relocate(localBounds.getMinX(),
localBounds.getMinY());
Unfortunately, the rendered image is very blurred as can be seen in my screenshot. Any ideas what might be the problem or how to retreive an unblurred image would be welcome.
Update:
while playing arround i removed
this.dragImage.relocate(localBounds.getMinX(),localBounds.getMinY());
which results in a sharp image with no blur at all. I have no idea why this is the case and i still need to translate the image to the correct position.
I got rid of the blur with a simple cast to int in the relocate call:
I found that
localBounds.getMinX()
is 638.5 andlocalBounds.getMinY()
is 136.5. Further experimentation brought me to the conclusion that non integral values for the translation led to the blurred image.An explanation for this can be found in the API doc for Shape at "Interaction with coordinate systems".