Salut, je voudrais copier un bout de surface dans une autre surface.
Je fais des sprites donc je charge mon image dans _img.
Citation
SDL_Surface *_img;
_img = IMG_Load("imgs/cerebes.png");
Plus tard, je découpe mon image et je l'affiche à l'écran.
Citation
SDL_BlitSurface(temp, &sprite[REPOS][k], ecran, &pos);
Le problème c'est que je dois faire des modifications sur mon image et je voudrais la copier dans une SDL_Surface mais je veux que l'image découpé.
Voici ce que j'ai fait :
Citation
SDL_Surface *temp;
temp = SDL_CreateRGBSurface(_img->flags, sprite[REPOS][k].w,
sprite[REPOS][k].h _img->format->BitsPerPixel,
_img->format->Rmask, _img->format->Gmask,
_img->format->Bmask,
_img->format->Amask);
SDL_BlitSurface(_img, &sprite[REPOS][k], temp, &topLeft);
flipH(temp);
SDL_BlitSurface(temp, &sprite[REPOS][k], ecran, &pos);
Le bout de code plus haut fonctionne mais la transparence est perdu.
Avec IMG_LOAD(); de SDL_Image, la transparence est automatiquement géré. Je crer ma surface temp puis je crer ma surface rgb en lui assignant les propriétés de mon _img. Ma surface temp devient invisible et lorsque j'enlève les masques (_img->format->Amask) alors le fond de mon image est noir au lieu d'être transparent.
Aidez moi plz - Problème de transparence
Partager