Hello,
due to the scaling problems on Linux with
https://bugs.openjdk.org/browse/JDK-8326428, I tried to implement a
workaround by manually setting glass.gtk.uiScale to the appropriate
value. However, when this value is not 100%, small images, in this case
40x40, often have artifacts around the borders:
Original image:
The same does not happen when using the same uiScale on Windows. This
was done with the latest ea build on Ubuntu 23.10. The exact scale does
not matter as long it is not 100%.
This is the code I used:
|public class ImageSize extends Application {
public static void main(String[] args) {
System.setProperty("glass.gtk.uiScale", "400%");
Application.launch(ImageSize.class, args);
}
@Override
public void start(Stage primaryStage) throws Exception {
var img =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAEuAAABLgF7cRpNAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAACJhJREFUWIXNmHt0VNUVxn/n3nkmE/KCZDJBkCBIxRBIgqBBEKSAi2i7ZAG1tauCheUjARUp6lpW66K11CICoViLq7TlYZ9YFaGtlYfSKJiglPAQwQWBSUzIa5JJ5nlP/7hhXplMEnF1+f01c+539vnO2fvsve+FrznEV2GkcJmzCMlTwM0CPMB2TKyvWuu4fLW2r0pgcdmlEk3hCaSYG8eWW8KrQbQXjm0cevH/KrBouXOKlHIVUpT2g+4D/hjUtNWfbBr66UDXGoBAKQrLnaXAUyAmD3QhQEPIt0VQPFO1yVH91Ql8ViqFTc65IJ4BihJRjaogKCWaltCiRMjdQqirq9bbP/zSAouWSqNmrr9HIJ8ExvRlCOC3j2bS3KGx4jct/aEj4ZBArqnemPtmbxxD7MD8+VI9Z69fKqlbJWB4v1bqRmqygi/Qf76AEhBvTCh3HhKC1dUbHHtjOUrswFm7c4dE/ooBigNobte43BYc6DRdqGTPhDLnzxIKLHi4biyIBQNeoRs2q8Bq/vKZSwhWFS+/dH3kWJSLVUWbPpCLbTUJpow1M3mMmRF2A6McRkZkG3lxSTqnLwY4cNzDqVr/QDQqmlRmAqfjCkQqJQgZuSMenzeI/5zwcuiEN7wrFe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zLlFSu7vW8qXgdxavTF3USJGryd4BSkubxmSPj+TDRyi0kXnA32y+mOq6JHGHBnwH0GQe/XCAKiTMlB8tGKYsy9iv/tH/WaLNSCnAglfKPrAyaAmln6yKafmKmx8ffA/40AyV2Na31IAAAAASUVORK5CYII=";
var r = new ImageView(img);
r.setFitWidth(40);
r.setFitHeight(40);
var s = new StackPane(r);
s.setBackground(Background.fill(Color.BLACK));
var scene = new Scene(s, 100, 100);
primaryStage.setScene(scene);
primaryStage.setTitle("Test");
primaryStage.show();
}
}|
Is this a bug or a limitation in the renderer?
Best
Christopher Schnick