As you may know Synthetica V3 comes along with UI-Scaling support. The UI-properties listed below help you to control scaling to fit your needs.
-
Synthetica.scaleFactor
Percentage integer value to scale the complete UI.
-
Synthetica.font.scaleFactor
Percentage integer value can be used to specify a scale factor for fonts only - if not set Synthetica.scaleFactor
will be used for font scaling.
-
Synthetica.font.respectSystemDPI
Boolean value - works only if Synthetica UI-Scaling is not active, if set to true
or not set (null
) and Swing UI-Scaling is disabled fonts will be scaled with system DPI setting.
-
Synthetica.imageScaleAlgorithm
Integer value - supported since V3.1.0 to specify the algorithm used for image scaling. Default value is 1 and stands for smooth/bicubic scaling. A value of 0 means disabled and leads to the scaling results of V3.0.0.
For linear scaling it's recommended to set Synthetica.font.respectSystemDPI
to false
when using the UI-Scaling option. Otherwise, especially on high-resolution platforms, fonts of your application may appear too big if a Synthetica scale factor is not set or set to 100.
//Example:
UIManager.put("Synthetica.scaleFactor", 150);
UIManager.put("Synthetica.font.respectSystemDPI", false);
UIManager.setLookAndFeel("de.javasoft.synthetica.dark.SyntheticaPlainLookAndFeel");
Image Scaling
As you maybe know most of our themes are based on image files. In Synthetica V3.1 image scaling support has been improved to work fine even for indeterminate scale factors. In the screenshots below you can clearly see the differences in scaling between Swing UI-Scaling, Synthetica V3.0 and Synthetica V3.1.
Swing UI-Scaling
As you an see in the screenshots below the default Swing scaling of Java 9 has some issues like unwanted artifacts and image scaling quality.
Synthetica V3.0 Scaling
In Synthetica V3.0 these issues do not appear if the scaling factor is a whole multiple means 100%, 200%, 300%... However, even if image scaling is slightly better than Swing's default scaling it's not as good as it could be.
Synthetica V3.1 Scaling
In Synthetica V3.1 image scaling was massively improved. So the complete application appears pretty well scaled even with intermediate scale factors.
Synthetica V3.1 also provides an enhanced API to simplify image scaling for your needs. The HiDpi class provides some new methods to let you scale your images easily.
//Example:
//scale image relatively with the current Synthetica scale factor
scaledImage = HiDpi.scaleImage(myImage);
//scale image absolutely to reach the passed width/height
scaledImage = HiDpi.scaleImage(myImage, newWidth, newHeight);
//scale multi resolution image with the current Synthetica scale factor
scaledImage = HiDpi.createImage(myImage, myHiResImage).getScaledInstance();
//or directly by passing image file names
scaledImage = HiDpi.createImage(getClass(), "arrow.png", "[email protected]").getScaledInstance();
BTW: Synthetica V3.1.0 will be released pretty soon.
Related Links