DrawText(HDC) overwrites my ARGB bitmap's alpha

Started by
0 comments, last by HaywireGuy 20 years, 6 months ago
So I''ve heard that doin'' text thing in Direct3D can be very slow. OK, then I came up with this idea to do text in Direct3D in a hope to get text without killin'' my framerate (it''s not an original idea). 1. Create/load my 32bits ARGB texture. 2. Use Win32 and HDC stuff to DrawText on the bitmap. 3. Use this texture for text display. OK, I tried this, and later bump into one problem. DrawText function modifies the alpha values of the area it has drawn to. So the text region will have alpha value of 0, and became totally transparent (you can see through the text if it''s on a bitmap image). So how should I overcome this problem? Is there ways to prevent DrawText() from overwritin'' my alpha values? Now I backup the alpha before DrawText(), but that''s additional work. Thanks for any help
Advertisement
You want opaque text, on a transparent background?

You can just check each individual pixel on your bitmap to see if it is the color you specified for your text. If it is, set the alpha value to 255, if it is not, set it to 0.

This topic is closed to new replies.

Advertisement