TextOut to a 32-bit bitmap for AlphaBlend on Vista x64 - Somebody |
27-May-08 02:08:44
|
Thats because GDI functions mostly only know about RGB, not ARGB. *MOST* GDI
functions will set the A channel to 0 and thus make your text transparent.
You'll find even basic functions like FillRect() and SetPixel() don't work
correctly when writing to ARGB surfaces.
So the way you need to do it is to build your bitmap on a 24bit RGB surface,
then after you are done, loop through and set the A channel to 0xff and then
AlphaBlend() and WS_EX_LAYERED will work as expected. |
 |
| |
TextOut to a 32-bit bitmap for AlphaBlend on Vista x64 - Michael Phillips, Jr. |
27-May-08 09:21:01
|
Is there any reason why you cannot switch steps 6 and 7?
The AlphaBlend function requires that the pixels in the bitmap be
premultiplied by the alpha channel.
If the alpha channel contains a pixel color greater than zero and not 255,
then the rgb channels will have their color intensity changed.
Your text will have its rgb color intensity altered in those areas of the
bitmap.
If the alpha channel is 0, then those rgb channels in the bitmap will be
completely transparent. Your text will disappear, if it falls within those
areas. |
 |
| |
TextOut to a 32-bit bitmap for AlphaBlend on Vista x64 - Kirill |
27-May-08 10:13:48
|
Hello,
It's true and I'm aware of that, but unfortunately it does not explain why
the code works correctly under 32-bit Windows XP.
I thought about this as well and it indeed fixes the problem. Unfortunately,
I'm not sure how well it will work with TextOut and ClearType (seemingly,
the latter may use alpha channel).
--
Kirill. |
 |
| |
TextOut to a 32-bit bitmap for AlphaBlend on Vista x64 - Kirill |
27-May-08 10:21:32
|
Michael,
Well... in a sample application it does fix the problem. But in the real
application steps 2 (using window's DC) through 6 are not a part of WM_PAINT
event handler. And it would be difficult to bring step 6 into WM_PAINT.
I've read about that, and even though it does not explain why it works under
32-bit Windows XP, your comment makes me wonder who's responsible for
pre-multiplying? If a bitmap is supposed to be pre-multiplied by the caller,
then 64-bit Windows Vista is very likely to be broken, because I verified
the pixels' values and in a simple test they're all relatively good (e.g.
0x00FFFFFF when drawing with white). If the pre-multiplication is done
inside of AlphaBlend, then looks like TextOut is broken on 64-bit version,
because it seemingly fills alpha with 0.
--
Kirill. |
 |
| |
TextOut to a 32-bit bitmap for AlphaBlend on Vista x64 - jeta |
27-May-08 10:22:51
|
Hi Kirill,
Can you send an email to me at: jetan@online.microsoft.com(remove
Best regards,
Jeffrey Tan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights. |
 |
| |