问题
I was thinking of glorifying my undecorated JavaFX stage with a drop shadow. I know how to do this with StageStyle.TRANSPARENT, but I noticed that as soon as I pass this flag to the Stage, the performance of my app drops approximately by 10x.
Anyone have ideas what might cause this enormous performance drop? Is there any other way to add a drop shadow to an undecorated Stage? Perhaps hacking away with two stages would yield better performance?
EDIT: OK, I'm trying this with two stages.. the performance problems are completely gone now, with a dummy "shadow stage" behind the complex main stage.
I have just two questions now, 1. How can I make the shadow stage not appear in the taskbar? 2. How can I make the shadow stage mouse transparent?
EDIT2: Appararently, and unfortunately, what I'm trying to achieve isn't possible without JNI. What a pity that a transparent Stage eats all performance for some reason.
回答1:
There is currently no way to improve the performance of stages with StageStyle.TRANSPARENT using the standard JavaFX toolkit.
See related issue tracker reference:
- RT-17510 Improve performance of rendering a TRANSPARENT stage on Windows 7
The issue is currently not planned for implementation, though I guess it could be considered for inclusion in some undetermined future release.
Anecdotally, the performance has been fine for little widget projects I have created and I have never noticed an issue, but I guess there is an issue there with some applications otherwise there wouldn't be an open issue in the JavaFX issue tracker around it.
来源:https://stackoverflow.com/questions/27039349/performance-of-stagestyle-transparent