I am trying to create a JavaFX library displaying an SVG file as an image, work with the whole version of Java 8: https://github.com/codecentric/javafxsvg
The problem is that it uses the renderScale attributes java.fx.Screen, which is private and does not have direct or indirect access in the public API.
In most cases, the value is 1.0f and can be 2.0f to display Retina on a Mac.
com.sun.javafx.tk.quantum.QuantumToolkit.getMaxRenderScale();
This gives the value that I want, but is in the com.sun package, therefore not in the public API, and you can change (and change DO, see renaming below) between lower versions.
com.sun.glass.ui.Screen.getRenderScale();
It is not a public API and was called getScale () in the previous version.
The same renaming for this next accessor, whose purpose was to expose the internal attributes!
com.sun.javafx.stage.ScreenHelper.getScreenAccessor(Screen).getRenderScale();
// was ScreenHelper.getScreenAccessor(Screen).getScale() in previous version
If I use the abstracts of the internal API, it can work for the latest version: 1.8.0_74, but gives NoSuchMethodError for some previous versions (for example, 1.8.0_51).
How can I make it work for the whole java version of jre?
Please note that I tried a naive approach to calculating it from dpi, but I only need to get a rounded value (1.0 or 2.0), and I do not have a rule for calculating the scale.