diff options
author | Kevin Barnes <krbarnes> | 2009-09-29 14:13:56 +0000 |
---|---|---|
committer | Kevin Barnes <krbarnes> | 2009-09-29 14:13:56 +0000 |
commit | 370cf1595dfb69c7180c7cbfc71bbc85fce04050 (patch) | |
tree | 207964c89f26806a8591f4479c978473c099acfc | |
parent | bd52a4082739e315645298860f2c48361efabf9b (diff) | |
download | eclipse.platform.swt-370cf1595dfb69c7180c7cbfc71bbc85fce04050.tar.gz eclipse.platform.swt-370cf1595dfb69c7180c7cbfc71bbc85fce04050.tar.xz eclipse.platform.swt-370cf1595dfb69c7180c7cbfc71bbc85fce04050.zip |
278132 - icons with overlays become faded in appearance
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java index ae32b734f8..8cc3613156 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java @@ -1054,9 +1054,22 @@ void initNative(String filename) { int green = (int) (color.greenComponent() * 255); int blue = (int) (color.blueComponent() * 255); this.transparentPixel = (red << 16) + (green << 8) + blue; - } else { - this.alphaData = alphaData; - } + + /* + * If the image has opaque pixels that have the same color as the transparent + * pixel, create an alpha image instead of using transparent pixel. + */ + for (int j = 0; j < srcData.length; j+=4) { + if (srcData [j] != 0) { + int pixel = (srcData[j+1] << 16) + (srcData[j+2] << 8) + srcData[j+3]; + if (pixel == this.transparentPixel){ + this.transparentPixel = -1; + break; + } + } + } + } + if (this.transparentPixel == -1) this.alphaData = alphaData; } // For compatibility, images created from .ico files are treated as SWT.ICON format, even though |