Bug 567898 - [JFace][HiDPI] ImageDescriptor support alternative naming scheme for high dpi
Summary: [JFace][HiDPI] ImageDescriptor support alternative naming scheme for high dpi
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.18 M3   Edit
Assignee: Christoph Laeubrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2020-10-15 04:28 EDT by Christoph Laeubrich CLA
Modified: 2020-11-03 06:01 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2020-10-15 04:28:47 EDT
Currently jface support a suffix @2 and @1.5 for Url/File.

This works as long as there is only one resolution, but if there are more than one (e.g. 16x16 and 32x32) this produces a lot of duplicate files (as @2x of 16x16 is the same as 32x32.

As it is common to organize icons in folders that has the resolution in the name the following scheme should be supported:

- The path is taken and scanned for the pattern "/(\d+)x(\d+)/"
- If the pattern is found it is replaced with the parsed integer value multiplied with the zoom level

--- 
Example path is platform:/plugin/org.eclipse.icons/icons/16x16/icon.png, pattern matches and return 16 in this case, a zoom level of 200 is requested we calculate:

replacement = 16 * 2 = 32

and get the new path platform:/plugin/org.eclipse.icons/icons/32x32/icon.png

for a zoom level of 150 we get 16 * 1.5 = 24

and a new path platform:/plugin/org.eclipse.icons/icons/24x24/icon.png
---

This has also the advantage that we are not bound to fixed zoom levels.
Comment 1 Eclipse Genie CLA 2020-10-15 12:21:30 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/170856
Comment 3 Lars Vogel CLA 2020-10-23 03:56:17 EDT
Please add to N&N
Comment 4 Christoph Laeubrich CLA 2020-10-23 04:03:04 EDT
(In reply to Lars Vogel from comment #3)
> Please add to N&N

Is there a Wiki-Page for this?
Comment 5 Lars Vogel CLA 2020-10-23 04:29:48 EDT
(In reply to Christoph Laeubrich from comment #4)
> (In reply to Lars Vogel from comment #3)
> > Please add to N&N
> 
> Is there a Wiki-Page for this?

Instructions are in the repo, see https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/170903 for an example and the repo URL
Comment 6 Lars Vogel CLA 2020-10-23 06:41:24 EDT
Image related question, can be also use unicode symbols these days for Images?

Works fine for Label AFAICS and I think it would be really nice if we could use them in toolbars.

Label label = new Label....
label.setText("❌" + "⛲");
Comment 7 Christoph Laeubrich CLA 2020-10-23 08:04:09 EDT
If you don't set an image the text will be used but I think there will be no hover possible or something.

What would be possible is to create a "SymbolsImageDescriptor", given a symbol, a font and an initial size (e.g. 16x16) that renders the symbol as an image on request taking zooming into account this will be also seamless with HighDPI.
I just don't know if SWT/JFace ships with a suitable default or we can identify one across operation systems.
Comment 8 Eclipse Genie CLA 2020-10-23 10:18:40 EDT
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/171188
Comment 9 Lars Vogel CLA 2020-10-23 11:27:06 EDT
Thanks!
Comment 11 Phil Beauvoir CLA 2020-11-03 04:43:55 EST
Does anyone know if this broke icons on Linux?

See Bug 568407