Using PNG with Alpha channel in SWT Widgets [message #446617] |
Mon, 29 November 2004 16:50 |
Eclipse User |
|
|
|
Originally posted by: vinodhd.gmail.com
Hi,
I am trying to display PNG icons with alpha channel on my swt.Tree widget.
The code looks something like this:
<snip>
adminItem = new TreeItem(adminTree, 0);
adminItem.setText("Administration");
icon = new Image(PlatformUI.getWorkbench().getDisplay(),
Platform.getLocation().toString()+"/Icons/server.png");
adminItem.setImage(icon);
icon.dispose();
</snip>
Now when I ran this, I saw that the alpha channel was not used at all and I
got a black background. I tried converting the PNG to Windows ICON .ico
file and I got the transparency but it was a little jagged. The ICON was in
Windows XP style icon with 8 bit alpha channel. I think the alpha channel
was reduced to one bit.
Is it possible to load a PNG with alpha channel and use it in widgets like
Tree? If I set the TransparentPixel it works, but then without the alpha
channel I lose the visual excellence of the images.
I was wondering how eclipse uses Images in it's IDE. Can someone give me
some pointers to proceed with?
Thankee Sais
- Vinny
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02969 seconds