Archived

This topic is now archived and is closed to further replies.

DrawText(HDC) overwrites my ARGB bitmap's alpha

This topic is 5173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites