I have an image that has no transparency and no alpha data. But the code in ImageHandle.getImageData(), we still classify it as having alpha data (which is wrong) I need more info on this topic and probably could discuss this. The original change was made here: eclipse-platform/eclipse.platform.swt#1138
Following snippet, we lose the image completely for tool items at 100%
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class ImageTransparencyFix {
public static void main(String[] args) {
System.setProperty("swt.autoScale.updateOnRuntime", "true");
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Image Transparency Toolbar Demo");
shell.setSize(300, 200);
shell.setLayout(new FillLayout());
Image original = new Image(display, ImageTransparencyFix.class.getResourceAsStream("png-image.png"));
ImageData data = original.getImageData();
Image transparentImage = new Image(display, data, data.getTransparencyMask());
ToolBar imageToolBar = new ToolBar(shell, SWT.FLAT);
for (int i = 0; i < 3; i++) {
ToolItem item = new ToolItem(imageToolBar, SWT.PUSH);
item.setImage(transparentImage);
item.setToolTipText("Image ToolItem ToolTip " + i);
}
// 4) Open UI
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
// 5) Dispose resources
transparentImage.dispose();
original.dispose();
display.dispose();
}
}
I have an image that has no transparency and no alpha data. But the code in ImageHandle.getImageData(), we still classify it as having alpha data (which is wrong) I need more info on this topic and probably could discuss this. The original change was made here: eclipse-platform/eclipse.platform.swt#1138
Following snippet, we lose the image completely for tool items at 100%