Hello everybody,
I encounter a problem with transparencies, using libSDL-1.2.9.
I want to alter the alpha-mask of a surface to change according to the position of another surface blitted on the first one.
Unfortunately I got no transparency, i.e. the colorkey is displayed as an opaque color.
some (pseudo)code to get the idea :
SDL_Surface *screen, *tmp, *cover_surface, *peep_hole;
SDL_Rect pos;
…
tmp = SDL_CreateRGBSurface(…);
cover_surface = SDL_DisplayFormatAlpha(tmp);
SDL_SetColorKey(cover_surface, SDL_SRCCOLORKEY, GREEN); /GREEN defined as SDL_MapRGB(…) - macro/
SDL_FreeSurface(tmp);
…
peep_hole = get_circle(rad, GREEN); /surface with a GREEN circle and transparent rest, formatted same way as display/
…
while(!abortion_criterion){
/*draw covering surface with something to peep through*/
SDL_FillRect(cover_surface, NULL, BLACK);
pos.x += x_increment;
pos.y += y_increment;
SDL_BlitSurface(peep_hole, NULL, cover_surface, &pos);
/*draw something to peep at and cover it*/
SDL_BlitSurface(some_image, NULL, screen, NULL);
SDL_BlitSurface(cover_surface, NULL, screen, NULL);
....
wait_for_some_time();
}
…
So this code results in a green circle moving on a black surface =(.
Hopefully someone can help me with this …
Thanks,
Stefan Gulan______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193