Hello everyone and sorry for my English, I use google translate.
Here is my problem, when I use TTF_RenderUNICODE_Blended to render with transparency and I copy the surface to another, the transparency is not preserved.
Can you help me ?
THANKS.
SDL_Surface *pSurface, *pLetter;
SDL_Color colorText = {255,255,255,255};
SDL_Rect dest;
TTF_Font *pFontTTF;
pFontTTF = TTF_OpenFont("arial.ttf", 14);
pSurface = SDL_CreateRGBSurface(0, 250, 250, 32, 0, 0, 0, 0);
SDL_SetSurfaceBlendMode(pSurface, SDL_BLENDMODE_BLEND);
SDL_SetColorKey(pSurface, SDL_TRUE, SDL_MapRGBA(pSurface->format, 0, 0, 0, 0));
pLetter = TTF_RenderUNICODE_Blended(pFontTTF, 65, color); // Render A
IMG_SavePNG(pLetter, "a.png"); // preserves alpha
dest.x = 0;
dest.y = 0;
dest.w = pLetter->w;
dest.h = pLetter->h;
SDL_BlitSurface(pLetter, NULL, pSurface, &dest);
IMG_SavePNG(pLetter, "a-blit.png"); // not preserves alpha