View Full Version : Surface:drawText is ignoring Alpha Value

2007-07-31, 09:01
This appears to be a bug I found while working on one of my applets.

static SDL_Surface *draw_ttf_font(JiveFont *font, Uint32 color, const char *str) {
SDL_Color clr;

clr.r = (color >> 24) & 0xFF;
clr.g = (color >> 16) & 0xFF;
clr.b = (color >> 8) & 0xFF;

return TTF_RenderUTF8_Blended(font->ttf, str, clr);

RGB values are defined but the Alpha channel is ignored.

I did some investigating and it looks like this is either a limitation of SDL (SDL_Color which currently doesn't have a member for alpha) or the freetype library.

Does anyone have some insight into this?

2007-07-31, 15:09
Actually it looks like a limitation of the SDL_ttf library. The way it renders blended text would need to be changed to let you draw text with an alpha channel.

I don't think we should change this now, so this will have to be a feature. I know why you want to draw transparent text and have asked Noah for different color values you can use instead of the transparency.