SWT: Get a different sized version of a system icon

Viewed 119

Some system icons have a selection of different sizes (presumably like .ico or .icns files). In SWT, I am able to fetch the default icon for certain states, like ICON_INFORMATION or ICON_WARNING etc.

I want to get a version of this icon that uses a different size. For instance, when I fetch ICON_INFORMATION using the below code, the size of the icon is 32x32.

Label icon = new Label(parent, SWT.NONE);
icon.setImage(Display.getCurrent().getSystemImage(SWT.ICON_INFORMATION));

On a colored background (Composite with INHERIT_FORCE to avoid a white frame), this icon looks like so (on a Windows 7 system):

Windows default information icon

Let's say I want a 16x16 version of this icon. I find that extracting the image data and resizing it myself makes for a lower quality icon than what is used elsewhere on the system.

If I resize the icon to 16x16, the quality looks like so:

Scaled icon

An example of the quality I'm after is like this 16x16 icon from a native Windows feature:

Windows update information icon 16x16

Obviously the one used natively by Windows in this case looks better. Is there a way I can fetch it? Or is my best method to stick to resizing the only one I can get my hands on? Is it possible to get the system icon as an array of Image with different sizes?

0 Answers
Related