Closed
Description
- I verified I can reproduce this issue against I20250413-1800
Steps to reproduce
From a fresh installation and clean workspace:
- download the attached sample plugin, extract it, import into workspace and run target platform
simple.zip - open the "Sample view" provided by the simple plugin in the target platform
- icons in the tree viewer are blurry and not sharp
Images are no longer blurry after disabling the setting "Use monitor-specific UI scaling" (https://eclipse.dev/eclipse/news/4.36/platform.html#rescaleOnRuntimePreference)
The image is created via following code:
if (cachedElement == null) {
String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
cachedElement = workbench.getSharedImages().getImage(imageKey);
}
ImageData imageData = (ImageData) cachedElement.getImageData().clone();
cachedElement = new Image(Display.getCurrent(), imageData);
It looks like that data is lost when calling new Image(Display.getCurrent(), image.getImageData().clone());
when "Use monitor-specific UI scaling" is enabled.
Could you please help in fixing this issue?
Thanks a lot,
Tobias
Tested under this environment:
- OS & version: Windows 11 - DPIUtil#deviceZoom has value 200
Workarounds
- Use the
nearest
algorithm to scale images by setting this JVM flag:-Dswt.autoScale.method=nearest
. The results are not optimal but they are not blurry.
- Use the constructor that takes a source
Image
instead of the one that takes theImageData
.
...
cachedFolder = new Image(cachedFolder.getDevice(), cachedFolder, SWT.IMAGE_COPY);
return cachedFolder;
Community
- I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.