| Summary: | [Graphics] Alpha information lost from .ico files | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Billy Biggs <billy.biggs> | ||||||
| Component: | SWT | Assignee: | Praveen <pinnamur> | ||||||
| Status: | CLOSED DUPLICATE | QA Contact: | Felipe Heidrich <eclipse.felipe> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | benjamin_pasero, bpasero, eclipse.felipe, ericwill, lindawat, lshanmug, michaelvanmeekeren, Silenio_Quarti, snorthov, xixiyan | ||||||
| Version: | 3.1 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux-GTK | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Billy Biggs
This problem should first be solved in Image#init(Device, ImageData). When the ImageData is loaded from a PNG file it has 24bit of color information (image.data) and the alpha channel is stored in the image.alphaData array. When it is loaded from a ICO file the color and alpha information is store in 32bit in the image.data array. The init blits the 32bit byte array to a 24bit byte array throwing away the alpha. Not for 3.1? I got some code working but far from ideal. Unfortunately I don't think we have the time to write the code, test all the cases (different versions of GTK and all that) and still fix the bugs. Not for 3.1. Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info. Any workaround? Praveen, can you take at look at this problem ? As I am stuck with 3.5.2, a workaround that I could use would be great too. (In reply to comment #8) > As I am stuck with 3.5.2, a workaround that I could use would be great too. the only workaround I can think of is changing the images, maybe converting the .ico (that show the problem) to .png (or some other format that works better with alpha). Sure Felipe, I will try to work on this. Actually I have found out that loading the ICO file with the Image() constructor instead of ImageLoader, the transparency is better. See also bug 256969. In fact, on Windows, using Image() results in missing transparency whereas the ImageLoader is working. Weird. Created attachment 165094 [details]
Patch v01
Felipe, I have added code changes for handling alpha data of Icon files. I have tested it using different images/icons and they appear good at the moment. Please review the patch and post your comments. Thanks.
Created attachment 165095 [details]
Testcase
I have added a few alpha icons (multiple icons in a single image) in the attachment along with the snippet that helps in displaying the icon on the shell. Also, ImageAnalyzer example can be used for loading/opening the icon and analyzing it.
Is this candidate for 3.6RC1 ? The patch affects all platforms but only GTK has been fixed and tested to handle ico with alphaData. Not critical for 3.6. (In reply to comment #15) > The patch affects all platforms but only GTK has been fixed and tested to > handle ico with alphaData. Since the reported problem appears on all the platforms, the code changes are independent of the platform. If you are happy with the taken approach in the patch, I would go ahead testing/addressing various scenarios on all platforms. I'll be happy with the code after I know it works everywhere ;-) Yes, the approach seems correct. This can be fixed with the native implementation of ImageLoader. See https://git.eclipse.org/r/#/c/138185/ *** This bug has been marked as a duplicate of bug 545032 *** |