[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.11 TTF_RenderUNICODE_Blended

SDL_Surface *TTF_RenderUNICODE_Blended(TTF_Font *font, const Uint16 *text, SDL_Color fg)

font
Font to render the text with. A NULL pointer is not checked.
text
The UNICODE null terminated string to render.
fg
The color to render the text in. Pixels are blended between transparent and this color to draw the antialiased glyphs.

Render the UNICODE encoded text using font with fg color onto a new surface, using the Blended mode (see section Blended). The caller (you!) is responsible for freeing any returned surface.

NOTE: Passing a NULL font into this function will cause a segfault.
NOTE: Passing a NULL text into this function will result in undefined behavior.

Returns: a pointer to a new SDL_Surface. NULL is returned on errors.

 
// Render some UNICODE text in blended black to a new surface
// then blit to the upper left of the screen
// then free the text surface
//SDL_Surface *screen;
SDL_Color color={0,0,0};
SDL_Surface *text_surface;
Uint16 text[]={'H','e','l','l','o',' ',
               'W','o','r','l','d','!'};
if(!(text_surface=TTF_RenderUNICODE_Blended(font,text,color))) {
    //handle error here, perhaps print TTF_GetError at least
} else {
    SDL_BlitSurface(text_surface,NULL,screen,NULL);
    //perhaps we can reuse it, but I assume not for simplicity.
    SDL_FreeSurface(text_surface);
}

See Also:
3.3.15 TTF_SizeUNICODE,
3.4.9 TTF_RenderText_Blended,
3.4.10 TTF_RenderUTF8_Blended,
3.4.12 TTF_RenderGlyph_Blended,
3.4.3 TTF_RenderUNICODE_Solid,
3.4.7 TTF_RenderUNICODE_Shaded



This document was generated on January, 14 2006 using texi2html