Page 1 of 1

Blitting DC text

PostPosted: Sep 16, 2009 @ 8:55pm
by perrs
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.

How is this possible with GapiDraw?

Thanks in advance.

Per Rasmussen.

PostPosted: Sep 18, 2009 @ 10:07pm
by Birdiestyle
Dont you just want to set the SetColorKey of the CGapiSurface you are drawing the font to to the transparent color... And then when copied to the final surface it will do just as you say(for 1 color).

Re: Blitting DC text

PostPosted: Sep 19, 2009 @ 6:30am
by Johan

PostPosted: Sep 21, 2009 @ 7:31pm
by perrs
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.

Best regards,
Per Rasmussen.