Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Image with SWT.IMAGE_GRAY style
Image with SWT.IMAGE_GRAY style [message #456354] Tue, 31 May 2005 22:38 Go to next message
Connie Lam is currently offline Connie LamFriend
Messages: 24
Registered: July 2009
Junior Member
Hi,

Given an image, I want to be able to do the following:
1. Display the image with transparent background (RGB(0, 255, 255) in my
case).
2. Display the image as being grayed-out and, at the same time, have
transparent background.

I'm able to do this on a GIF and 16 color BMP using the following code:

InputStream inputStream =
test.getClass().getResourceAsStream("..\\..\\icons\\img.bmp ");
ImageData imgData = new ImageData(inputStream);
imgData.transparentPixel = imgData.palette.getPixel(new RGB(0, 255, 255));
final Image image = new Image(display, imgData);
final Image disabledImage = new Image(display, image, SWT.IMAGE_GRAY);

shell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
GC gc = event.gc;
gc.drawImage(image, 0, 0);
gc.drawImage(disabledImage, 50, 0);
}
});

However, I can only get #1 working when I tried the same code on a 24-bit
BMP.
(the 24-bit BMP has the same background color RGB(0, 255, 255) as the
previous
2 images). The grayed-out image does not have a transparent background -
it
has a light gray background instead.

Is this a bug? Is there a solution/workaround for me to fix the problem?

Thanks for your help!
Connie
Re: Image with SWT.IMAGE_GRAY style [message #456368 is a reply to message #456354] Wed, 01 June 2005 15:17 Go to previous messageGo to next message
Silenio Quarti is currently offline Silenio QuartiFriend
Messages: 31
Registered: July 2009
Member
This might be a bug, but I cannot really confirm without seeing your
testcase. Please could you open a bug report with a simple snnipet that
shows our problem?

Thanks! Silenio
Re: Image with SWT.IMAGE_GRAY style [message #456373 is a reply to message #456368] Wed, 01 June 2005 17:23 Go to previous message
Connie Lam is currently offline Connie LamFriend
Messages: 24
Registered: July 2009
Junior Member
Thanks! I've filed bug 97914.
Previous Topic:Intercept / Abort SWT.Close
Next Topic:How to make background window flash
Goto Forum:
  


Current Time: Fri Apr 26 09:57:13 GMT 2024

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

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

Back to the top