Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Image Transparency
Image Transparency [message #437304] Wed, 02 June 2004 20:59 Go to next message
Eclipse UserFriend
Originally posted by: raf_k.sympatico.ca

I have been trying to get the following simple block of code to work
correctly for the past 3 days. The "save_edit.gif" image is the one used
by Eclipse in the File->Save MenuItem. When I run this code, the GUI
renders correctly except for the transparency of the "save_edit.gif"
image. Areas meant to be transparent are actually rendered white. Does
anyone here have any ideas why this might be?

I installed and ran the ImageAnalyzer example from the SWT Examples jar,
and loaded the same "save_edit.gif" image to find that the transparency
did render correctly. Why won't it in my program? I'm about to give up.

Thanks in advance for any ideas/suggestions.

Best regards,

-Raf Kaplon


public static void main (String [] args) {
Display display = new Display ();
Image image = new Image(display,
Test.class.getResourceAsStream("save_edit.gif"));
Shell shell = new Shell(display);
Menu menuBar = new Menu(shell, SWT.BAR);
shell.setMenuBar(menuBar);
MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
fileItem.setText("File");
Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
fileItem.setMenu(fileMenu);
MenuItem saveItem = new MenuItem(fileMenu, SWT.PUSH);
saveItem.setText("Save");
saveItem.setImage(image);
shell.open();
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) display.sleep();
}
image.dispose();
display.dispose();
}
Re: Image Transparency (Additional Information) [message #437306 is a reply to message #437304] Wed, 02 June 2004 23:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: raf_k.sympatico.ca

I installed the latest Eclipse release (2.1.3) on my colleague's laptop,
compiled the same code block, and was met with the exact same problem. My
colleague has Windows XP Home Edition, I have Windows XP Professional.
Re: Image Transparency [message #437375 is a reply to message #437304] Thu, 03 June 2004 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.forritan.net

Hi,

try this:

ImageData imageData=
new ImageData(Test.class.getResourceAsStream("save_edit.gif"));
Image image=
new Image(display, imageData, imageData.getTransparencyMask());

Regards,
Eyðun

Raf Kaplon wrote:
> I have been trying to get the following simple block of code to work
> correctly for the past 3 days. The "save_edit.gif" image is the one used
> by Eclipse in the File->Save MenuItem. When I run this code, the GUI
> renders correctly except for the transparency of the "save_edit.gif"
> image. Areas meant to be transparent are actually rendered white. Does
> anyone here have any ideas why this might be?
>
> I installed and ran the ImageAnalyzer example from the SWT Examples jar,
> and loaded the same "save_edit.gif" image to find that the transparency
> did render correctly. Why won't it in my program? I'm about to give up.
>
> Thanks in advance for any ideas/suggestions.
>
> Best regards,
>
> -Raf Kaplon
>
>
> public static void main (String [] args) {
> Display display = new Display ();
> Image image = new Image(display,
> Test.class.getResourceAsStream("save_edit.gif"));
> Shell shell = new Shell(display);
> Menu menuBar = new Menu(shell, SWT.BAR);
> shell.setMenuBar(menuBar);
> MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
> fileItem.setText("File");
> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
> fileItem.setMenu(fileMenu);
> MenuItem saveItem = new MenuItem(fileMenu, SWT.PUSH);
> saveItem.setText("Save");
> saveItem.setImage(image);
> shell.open();
> while(!shell.isDisposed()) {
> if(!display.readAndDispatch()) display.sleep();
> }
> image.dispose();
> display.dispose();
> }
>
Re: Image Transparency (Additional Information) [message #437376 is a reply to message #437306] Thu, 03 June 2004 13:05 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Post a screen shot.

"Raf Kaplon" <raf_k@sympatico.ca> wrote in message
news:c9lmb2$crj$1@eclipse.org...
> I installed the latest Eclipse release (2.1.3) on my colleague's laptop,
> compiled the same code block, and was met with the exact same problem. My
> colleague has Windows XP Home Edition, I have Windows XP Professional.
>
Re: Image Transparency [message #437384 is a reply to message #437375] Thu, 03 June 2004 14:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.forritan.net

Hi again

I forgot to mention that this problem is not on version 3.0RC1. So on
the next release (3.0) - which will be released later this month - your
code works just fine.

Regards,
Eyðun

Eyðun Nielsen wrote:

> Hi,
>
> try this:
>
> ImageData imageData=
> new ImageData(Test.class.getResourceAsStream("save_edit.gif"));
> Image image=
> new Image(display, imageData, imageData.getTransparencyMask());
>
> Regards,
> Eyðun
>
> Raf Kaplon wrote:
>
>> I have been trying to get the following simple block of code to work
>> correctly for the past 3 days. The "save_edit.gif" image is the one used
>> by Eclipse in the File->Save MenuItem. When I run this code, the GUI
>> renders correctly except for the transparency of the "save_edit.gif"
>> image. Areas meant to be transparent are actually rendered white. Does
>> anyone here have any ideas why this might be?
>>
>> I installed and ran the ImageAnalyzer example from the SWT Examples jar,
>> and loaded the same "save_edit.gif" image to find that the transparency
>> did render correctly. Why won't it in my program? I'm about to give up.
>>
>> Thanks in advance for any ideas/suggestions.
>>
>> Best regards,
>>
>> -Raf Kaplon
>>
>>
>> public static void main (String [] args) {
>> Display display = new Display ();
>> Image image = new Image(display,
>> Test.class.getResourceAsStream("save_edit.gif"));
>> Shell shell = new Shell(display);
>> Menu menuBar = new Menu(shell, SWT.BAR);
>> shell.setMenuBar(menuBar);
>> MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
>> fileItem.setText("File");
>> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
>> fileItem.setMenu(fileMenu);
>> MenuItem saveItem = new MenuItem(fileMenu, SWT.PUSH);
>> saveItem.setText("Save");
>> saveItem.setImage(image);
>> shell.open();
>> while(!shell.isDisposed()) {
>> if(!display.readAndDispatch()) display.sleep();
>> }
>> image.dispose();
>> display.dispose();
>> }
>>
Re: Image Transparency [message #437391 is a reply to message #437384] Thu, 03 June 2004 15:43 Go to previous message
Eclipse UserFriend
Originally posted by: raf_k.sympatico.ca

Thanks Eyðun, it works perfectly now.

Best regards,

-Raf Kaplon


Eyðun Nielsen wrote:

> Hi again

> I forgot to mention that this problem is not on version 3.0RC1. So on
> the next release (3.0) - which will be released later this month - your
> code works just fine.

> Regards,
> Eyðun

> Eyðun Nielsen wrote:

> > Hi,
> >
> > try this:
> >
> > ImageData imageData=
> > new ImageData(Test.class.getResourceAsStream("save_edit.gif"));
> > Image image=
> > new Image(display, imageData, imageData.getTransparencyMask());
> >
> > Regards,
> > Eyðun
> >
> > Raf Kaplon wrote:
> >
> >> I have been trying to get the following simple block of code to work
> >> correctly for the past 3 days. The "save_edit.gif" image is the one used
> >> by Eclipse in the File->Save MenuItem. When I run this code, the GUI
> >> renders correctly except for the transparency of the "save_edit.gif"
> >> image. Areas meant to be transparent are actually rendered white. Does
> >> anyone here have any ideas why this might be?
> >>
> >> I installed and ran the ImageAnalyzer example from the SWT Examples jar,
> >> and loaded the same "save_edit.gif" image to find that the transparency
> >> did render correctly. Why won't it in my program? I'm about to give up.
> >>
> >> Thanks in advance for any ideas/suggestions.
> >>
> >> Best regards,
> >>
> >> -Raf Kaplon
> >>
> >>
> >> public static void main (String [] args) {
> >> Display display = new Display ();
> >> Image image = new Image(display,
> >> Test.class.getResourceAsStream("save_edit.gif"));
> >> Shell shell = new Shell(display);
> >> Menu menuBar = new Menu(shell, SWT.BAR);
> >> shell.setMenuBar(menuBar);
> >> MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
> >> fileItem.setText("File");
> >> Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
> >> fileItem.setMenu(fileMenu);
> >> MenuItem saveItem = new MenuItem(fileMenu, SWT.PUSH);
> >> saveItem.setText("Save");
> >> saveItem.setImage(image);
> >> shell.open();
> >> while(!shell.isDisposed()) {
> >> if(!display.readAndDispatch()) display.sleep();
> >> }
> >> image.dispose();
> >> display.dispose();
> >> }
> >>
Previous Topic:Possible bug in the SWT_AWT bridge?
Next Topic:[JFace] What are dialog units (DLUs)?
Goto Forum:
  


Current Time: Wed Apr 24 18:46:36 GMT 2024

Powered by FUDForum. Page generated in 0.02726 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top