Asked By akiril
27-May-08 12:04 AM

Hello,
Problem: can't output text by TextOut (or ExtTextOut or DrawText) to a
bitmap, created with CreateDIBSection, so that bitmap can later be AlphaBlend
to a paint DC.
In pseudo code:
1. paintDC = BeginPaint()
2. compatibleDC = CreateCompatibleDC (paintDC)
3. bitmap = CreateDIBSection (32 bit, 1 plane, BI_RGB compression,
biSizeImage=0)
4. Select bitmap into the compatibleDC
5. fill the bitmap with some ARGB color
6. TextOut in any mode (SetBkMode) with any back color (SetBkColor) and any
text color (SetTextColor).
7. AlphaBlend compatibleDC into paintDC with AlphaFormat=AC_SRC_ALPHA
A string, used on step 6, is not visible when executed on Vista x64 (no
composition).
Note: steps 1-5, 7 are taken from Alpha Blending a Bitmap
(http://msdn.microsoft.com/en-us/library/ms532295(VS.85).aspx)
The real application uses a compatibleDC as an offscreen and drawing
directly to the paintDC is almost not an option.
Test systems: 32-bit XP SP2 and 64-bit Vista Business. Several other 64-bit
systems (some Intel-, some AMD-based) has the same problem, hence video
driver does not seem to contribute to a problem.
So, is it a known "limitation"? Or am I missing something obvious?
Side question: on 32-bit XP SP2, the behaviour of TextOut (step 6) is
different, depending on which brush is used during class registration. For
example, wcex.hbrBackground= (HBRUSH)GetStockObject(BLACK_BRUSH); works, but
(HBRUSH)(COLOR_WINDOW+1) causes the string to appear in a wrong color on a
wrong background.
Thank you for your time!
--
Kirill.