Using DrawFont with an RGBA font to draw into an RGB surface
Posted: Dec 6, 2009 @ 11:42pm
Hi! Since I cannot use DrawFont on RGBA surfaces (see my previous ), I've decided to use RGB surfaces along with RGBA fonts instead.
Now, according to the library's docs the E2DSurface class accepts both E2DSurface and E2DSurfaceRGBA parameters for the DrawFont method. I tried using the latter one with a font that makes use of the alpha channel but I'm getting weird visual results (see the attached Visual Studio solution) so I'm not sure whether it's me that I'm making a mistake or it's the DrawFont method that it's not meant to be used with RGBA surfaces that make use of the alpha channel. Do you mind taking a look at the attachment? It's a very short example that:
1) Renders the RGBA text to an RGB surface (in the initialization phase).
2) Blits the surface from (1) at the top of the display every frame.
3) Uses the RGBA font surface to blit the same text from (2) directly to the display every frame.
Thanks in advance for your help!
--Nacho
Now, according to the library's docs the E2DSurface class accepts both E2DSurface and E2DSurfaceRGBA parameters for the DrawFont method. I tried using the latter one with a font that makes use of the alpha channel but I'm getting weird visual results (see the attached Visual Studio solution) so I'm not sure whether it's me that I'm making a mistake or it's the DrawFont method that it's not meant to be used with RGBA surfaces that make use of the alpha channel. Do you mind taking a look at the attachment? It's a very short example that:
1) Renders the RGBA text to an RGB surface (in the initialization phase).
2) Blits the surface from (1) at the top of the display every frame.
3) Uses the RGBA font surface to blit the same text from (2) directly to the display every frame.
Thanks in advance for your help!
--Nacho