Project: SWT
Bug 22564 Cannot draw transparent PNG files properly
Reported: 2002-08-20 05:05:23 | Status: resolved fixed

I have a problem with the following code. The problem is that the image drawn on my canvas is collapsed if the imageData is created from a PNG file with transparency. It seems that RGBs are drawn well but an alpha channel has shifted to the right. There is no problem with transparent GIFs or non-transparent PNGs. It happens on Linux. ------ code ------ void drawHalf(GC gc, ImageData imageData, int destx, int desty) { Image image = new Image(null, imageData); gc.setClipping(destx + imageData.width/2, desty, imageData.width/2, imageData.height); gc.drawImage(image, destx, desty); image.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Image.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java