I'm currently implementing a routine that can draw text using a device context. Because I need many different font sizes the bitmap font is not feasible.
So far things work great and I can copy the text on to a GapiSurface. I have one problem, however. When copying to the destination surface, I would like that it is only the text pixel and not the background pixels that are copied. In other words, I need a Blit function that can ignore pixels of a certain color (make them transparent) and copy the rest. I believe this is normally called alpha keying, or something similar.
perrs wrote:I need a Blit function that can ignore pixels of a certain color (make them transparent) and copy the rest. I believe this is normally called alpha keying, or something similar.
As BirdieStyle says - you do it as follows:
1. Call SetColorKey on the surface that contains your text and use the background color of your text surface.
2. Call BltFast and use the flag GDBLTFAST_KEYSRC
I actually realized this when I was browsing through the documentation again a few days ago. But thanks anyway for your answer.
Currently I'm having a bit of problems because the background color kind of "shines through" when the font is anti-aliased. I am currently working on this. If you happen to have a good idea, please share.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum