I have a simple JavaFX program that uses an image for the background on the main Pane
. Currently I'm loading the image directly in my .css
file:
.pane {
-fx-background-image: url('map.png');
-fx-background-size: 1000 800;
}
This works fine, but the quality of the image -fx-background-size
generates is rather poor.
Instead I'd like to use java.awt.Image#getScaledInstance
with Image.SCALE_SMOOTH
(or the JavaFX equivalent), which generates an image of much higher quality.
Can I use getScaledInstance
directly and somehow pass a Java awt
image to my css file? Or inline it with setStyle
?
I'm aware that since this image is only being resized once I could just resize the original image and import that, but I'd like to know if what I want to do is possible.