Hi
I’m having a bit of trouble wrangling with an enhanced font drawing routine.
I have a bit of code which draws (using SDL_TTF) text with a stroked border
(outline), and / or a drop shadow.
Pseudocode:-
Draw Shadow
Blit to destination surface
Draw Outline
Blit to destination surface
Draw Actual Text
Blit to destination surface
For the shadow, I am using a solid font as it is not possible to combine
per-pixel alpha with per-surface alpha. I draw the shadow by drawing the
text a number of times with a low per surface alpha value (around 10). This
gives a nice effect which blends with the destination surface.
For drawing the outline and the actual text, I use a blended font to get the
best out of the nice anti-aliasing which results from the per-pixel alpha.
The routine works fine and looks great but only when the screen is the
destination surface.
Try as I might, I cannot get the code to draw to another SDL surface. I have
tried every possible way I can think of to do this, all without success. I
think I have tried every possible value for the RGB masks, and I have tried
creating the surfaces with and without SDL_SRCALPHA.
I either get no output at all when I blit the new surface to the screen, or
I lose the alpha capabilities completely and get a black box around my text.
Ultimately, the resulting surface will be converted to an OpenGL texture for
final display (please note that I am fully aware of how to do this, I don’t
need any specific advice on this).
Thanks in advance for any possible insight into this!
Steve Lupton**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.