This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Blitting DC text

Blitting DC text

Postby perrs » Sep 16, 2009 @ 8:55pm

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.
pm Member
Posts: 4
Joined: Sep 16, 2009 @ 8:35pm

Postby Birdiestyle » Sep 18, 2009 @ 10:07pm

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).
A <a href="">bird</a> in the hand...
User avatar
pm Member
Posts: 144
Joined: Nov 8, 2001 @ 5:42pm
Location: Wisconsin

Re: Blitting DC text

Postby Johan » Sep 19, 2009 @ 6:30am

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
User avatar
pm Member
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden

Postby perrs » Sep 21, 2009 @ 7:31pm

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.
pm Member
Posts: 4
Joined: Sep 16, 2009 @ 8:35pm

Return to GapiDraw


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.


sponge, Johan

Forum permissions

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