[SDL] Font color gradients
David Olsen
jolynsbass at gmail.com
Sat Apr 5 14:36:51 PDT 2008
I would think that using the output from SDL_TTF(Blended - the one that
gives you a per-pixel alpha image), you could blit the text onto a
predefined surface which contains a color gradient, and you should get a
resulting image of the sort you want. (Oh, first you must have SRCALPHA
turned on in both surfaces, or it won't act as a mask. Look at the
documentation of the SDL_SetAlpha function) I might have the surface order
reversed... you might need to blit the colored gradient surface onto the
rendered text surface. But a little experimentation along those lines should
get you set up.
-Dave
----- Original Message -----
From: "Mason Wheeler" <masonwheeler at yahoo.com>
To: <sdl at lists.libsdl.org>
Sent: Saturday, April 05, 2008 7:12 AM
Subject: [SDL] Font color gradients
> I've been looking through SDL_TTF, and it looks like the only option
> available is to render a font in a single, solid color. How would I do
> gradients and other custom colorations? The ideal way would be to use the
> glyph shapes as "cutouts" in an existing graphic from an SDL_Surface,
> which would allow custom colors to be defined beforehand. If this isn't
> feasible, I'd like to be able to define multiple foreground colors and
> create a gradient from them.
>
> How would I go about doing something like this?
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
More information about the SDL
mailing list