1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| SDL_Surface* png = IMG_Load("exemple.png");
SDL_Surface* img = SDL_CreateRGBSurface(SDL_HWSURFACE, png->w, png->h, 32, 0, 0, 0, 0);
/* J'essaye tant bien que mal de remplir la surface de transparence mais ça ne marche pas */
SDL_FillRect(img, NULL, SDL_MapRGBA(img->format, 0, 0, 0, 0));
/* J'ai aussi éssayé avec
- SDL_FillRect(img, NULL, SDL_MapRGB(img->format, 0, 0, 0));
- SDL_SetAlpha(img, SDL_SRCALPHA, 0);
- etc.
mais aucun résultat correct... */
/* blit de l'image pour tester */
SDL_Rect pos;
pos.x = 0;
pos.y = 0;
SDL_BlitSurface(png, NULL, img, &pos);
SDL_BlitSurface(img, NULL, ecran, &pos);
SDL_FreeSurface(img);
SDL_FreeSurface(png); |
Partager