Hello!
I got to do a function here that creates a copy of an image but with
bigger size. I dont want to make it bigger (scretch), only want it to resize! I
am using PNG images with alpha, the mouth and eyes are transparents! I
made it with Gimp:
But I got problems! The image is not how it should be, it is all white!
Here is how I am doing it:
…
loadedImage = IMG_Load(path); // I test to see if it loaded right, I removed to make it smaller
surface = SDL_DisplayFormatAlpha(loadedImage);
SDL_FreeSurface(loadedImage);
surface = redImage(surface->w2,surface->h2,surface);
…
SDL_Surface* redImage(int w,int h,SDL_Surface* src)
{
SDL_Surface* ret = SDL_CreateRGBSurface(src->flags,w,h,src->format->BitsPerPixel,
src->format->Rmask,src->format->Gmask,src->format->Bmask,src->format->Amask);
if (!ret)
return src;
SDL_BlitSurface(src,NULL,ret,NULL);
SDL_FreeSurface(src);
SDL_Surface* surface = SDL_DisplayFormatAlpha(ret);
SDL_FreeSurface(ret);
return surface;
}
I fell that I am making something wrong, tryed many things but nothing seems to work! Whats wrong with it?
Thank you!From: http://img41.imageshack.us/img41/8241/imagemqat.png
To: http://img178.imageshack.us/img178/4120/imagem2l.png
Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. ? gr?tis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx