PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

DrawFont alternative for RGBA surfaces

Hi! I need to extend my GUI system in order to handle the creation of buttons (made from RGBA surfaces) with text displayed over them.

So far, I've been creating my buttons (made from E2DSurface's) during the initialization phase and using the DrawFont method to assign them text. Now that I've changed my button class in order to use an E2DSurfaceBase* I've found out that there's no DrawFont method in E2DSurfaceRGBA. How can I write text to an E2DSurfaceRGBA surface?

Thanks in advance for your reply,

--Nacho
Hi Nacho,

Unfortunately, there is no support for text drawing on RGBA surfaces. The only way to handle this is to create your own font renderer and locking surfaces.
Hi edge,

Thanks for your prompt reply. Just for curiosity's sake: why isn't this feature included in edgelib? I mean, if it's already implemented for RGB surfaces, isn't it the same algorithm for RGBA ones?

Cheers,

--Nacho
Hi Nacho,

The main difference in blitting RGBA to RGBA would be the included alpha channel. To handle this, two options would be necessary:
- Blitting straight onto the RGBA surface, including the alpha channel (a simple memory copy)
- Read the alpha channel and 'blend them' somehow onto the destination surface