On Sun, May 3, 2009 at 6:28 PM, Roderick Colenbrander thunderbird2k@gmail.com wrote:
On Sat, May 2, 2009 at 11:18 PM, Joel Holdsworth joel@airwebreathe.org.uk wrote:
On Sat, 2009-05-02 at 22:56 +0200, Roderick Colenbrander wrote:
On Sat, May 2, 2009 at 8:57 PM, Joel Holdsworth joel@airwebreathe.org.uk wrote:
On Sat, 2009-05-02 at 20:38 +0200, Roderick Colenbrander wrote:
On Sat, May 2, 2009 at 6:55 PM, Joel Holdsworth joel@airwebreathe.org.uk wrote:
Hi All,
I've hit a bit of a wall with alpha blended icons. CreateIcon is working fine for icon creation, but ExtractIcon and LoadIconFromResource etc. are all proving more of a problem. All of these use various GDI DIB functions to coerce the icon bitmap to the correct colour depth and size. The problem is that preserving the alpha channel through these DIB functions seems to be impossible because they go via X11, so until the dib engine is merged (after hell freezes over) I'm not sure I can go much further.
Joel
If you say X11 might be problematic note that more and more display drivers are offering visuals with alpha, so 32-bit ones instead of 24-bit. You could force the selection of such a visual in winex11.drv for testing.
Roderick
Is that right? I simply assumed it would screw it up. If the problem can be solved with fixes to user32 or gdi32, then I can probably find the solution. If it involves work on winex11, then I'm not really the right guy for the job.
Why again did you need this specific alphablend method? The icon can't be converted to use some basic color keying for transparency or so?
The reason is that the outlines will look aliased, and there will be no drop-shadows - without alpha the Tango icons won't look better than the current set. Also, I figured that icon rendering should be fixed for the sake of wine as a whole - which I think it should. It seems like a good little task for a wine beginner, and indeed I've made a lot of progress
- I'm just a bit stuck.
The culprit is a transfer through StretchDIBits in user32 which strips the alpha channel. I can't see a way round it - using StretchBlt doesn't help, and neither does GdiTransparentBlt.
Another insentive: I suspect fixing this would also fix bug #201 which is now over 8 years old!
I just looked a little more into it. As you mentioned StretchDIBits in user32 removes the alpha channel. According to this post at MSDN (http://msdn.microsoft.com/en-us/library/dd145023(VS.85).aspx) the function got extended in Vista to include PNG support because PNG is used for most icons in Vista. It might be useful to check that out. The page mentions it was meant for printers but most likely they also use this for icon rendering. I think it can be used in cooperation with XRender (there are various xrender examples for dealing with alpha).
Roderick
Have you also tried to use the GDI AlphaBlend function? This is the one which should be used I think and we back it by XRender ..
Roderick