Community
Participate
Working Groups
When product image is a single *.ico file, SWT loads it into an Image and this icon image has the size of the largest image in the icon. We need to be able to select 16x16 version from the image data somehow.
Right now I have worked around the problem by scaling the image when not 16x16 but there must be a better way.
Due to bug 99253, Eclipse should no longer be using .ico files. In any case, one .ico file can contain many images. You can load them using an ImageLoader and select the ImageData you want from the array as needed. Is that what you are asking?
I am simply trying to react to whatever images are returned to me from the IProduct class (as defined in the products extension point). These days we are all over the place as to which images we are putting there. If there are several images listed there and some are gifs, some are pngs: 1) do you see anything wrong in me creating an Image object for each URL and testing the bounds to see which one is 16x16 2) If I have one gif 16x16 and one png 16x16, which one is 'better' and how do I tell programmatically?
1) IMPORTANT: Can you confirm that nobody is using .ICO files? 2) If you intend to use the icon in a shell, use Shell.setImages() and the best image from the list will be used, depending on the purpose.
No, I want to use the icon for a TreeItem that represents the product.
re icons, I have seen eclipse.ico files in org.eclipse.platform and org.eclipse.sdk last night but it seems that MVM is on the ball changing that. Things happen fast these days, hard to follow :-).
Yes, they are gone. Instead, the WINDOW_IMAGES property now has something like this: eclipse.gif,eclipse32.gif,eclipse48.gif,eclipse.png,eclipse32.png,eclipse48.png So how I have two imags that will be 16x16 (eclipse.gif, eclipse.png). When I create the Image object from URLImageDescriptor, how can I tell that eclipse.png is 'better' (i.e. transparent or something)?
You should not be using images with alpha in widgets anywhere other than in the Shell icon unless you are drawing the image yourself. On Windows 2000, we construct a mask from the alpha and this can look bad depending on the alpha values. You can find out which images have alpha using Image.getImageData() and ImageData.getTransparencyType().
(In reply to comment #8) > You should not be using images with alpha in widgets anywhere other than in > the Shell icon unless you are drawing the image yourself. On Windows 2000, we > construct a mask from the alpha and this can look bad depending on the alpha > values. You can find out which images have alpha using Image.getImageData() > and ImageData.getTransparencyType(). Steve, there are three transparency types that can be returned from 'getTransparencyType'? To confirm, I should not use the icon that returns SWT.TRANSPARENCY_ALPHA. What about SWT.TRANSPARENCY_MASK? I assume SWT.TRANSPARENCY_PIXEL would be the one used by formats like GIF and is kosher for widgets like TreeItem.setImage().
Avoid SWT.TRANSPARENCY_ALPHA.
Okeedokee.
Proposed code change: add a check for the image transparency data and skip an image that uses TRANSPARENCY_ALPHA (see the attached patch).
Created attachment 22968 [details] The code that picks the first image from WINDOW_IMAGES that is 16x16 and does not use alpha transparency
Konrad, can you take a look at the patch and add your vote?
Dorian, need your approval too.
+1
Released.